jazz-tools 0.18.31 → 0.18.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +61 -61
- package/CHANGELOG.md +11 -0
- package/dist/{chunk-6BIYT3KH.js → chunk-JXRJMGKV.js} +2 -2
- package/dist/chunk-JXRJMGKV.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/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/tools/coValues/coFeed.ts +2 -2
- package/src/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.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
package/dist/inspector/index.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import React7 from "react";
|
|
5
5
|
|
|
6
6
|
// src/inspector/viewer/new-app.tsx
|
|
7
|
-
import { styled as
|
|
8
|
-
import { useState as
|
|
7
|
+
import { styled as styled21 } from "goober";
|
|
8
|
+
import { useState as useState12 } from "react";
|
|
9
9
|
|
|
10
10
|
// src/inspector/ui/button.tsx
|
|
11
11
|
import { styled } from "goober";
|
|
@@ -180,10 +180,10 @@ var Breadcrumbs = ({
|
|
|
180
180
|
};
|
|
181
181
|
|
|
182
182
|
// src/inspector/viewer/page-stack.tsx
|
|
183
|
-
import { styled as
|
|
183
|
+
import { styled as styled18 } from "goober";
|
|
184
184
|
|
|
185
185
|
// src/inspector/viewer/page.tsx
|
|
186
|
-
import { styled as
|
|
186
|
+
import { styled as styled17 } from "goober";
|
|
187
187
|
import React5 from "react";
|
|
188
188
|
|
|
189
189
|
// src/inspector/ui/badge.tsx
|
|
@@ -1274,7 +1274,7 @@ function CoPlainTextView({ data }) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
|
|
1276
1276
|
// src/inspector/viewer/group-view.tsx
|
|
1277
|
-
import { useState as
|
|
1277
|
+
import { useState as useState7 } from "react";
|
|
1278
1278
|
|
|
1279
1279
|
// src/inspector/ui/table.tsx
|
|
1280
1280
|
import { styled as styled12 } from "goober";
|
|
@@ -1488,8 +1488,205 @@ function Select(props) {
|
|
|
1488
1488
|
] });
|
|
1489
1489
|
}
|
|
1490
1490
|
|
|
1491
|
-
// src/inspector/
|
|
1491
|
+
// src/inspector/ui/data-table.tsx
|
|
1492
|
+
import { useEffect as useEffect6, useMemo, useState as useState6 } from "react";
|
|
1492
1493
|
import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1494
|
+
function DataTable({
|
|
1495
|
+
columns,
|
|
1496
|
+
data,
|
|
1497
|
+
pageSize = 10,
|
|
1498
|
+
initialSort = null,
|
|
1499
|
+
getRowKey,
|
|
1500
|
+
emptyMessage = "No data available"
|
|
1501
|
+
}) {
|
|
1502
|
+
const [currentPage, setCurrentPage] = useState6(1);
|
|
1503
|
+
const [sortConfig, setSortConfig] = useState6(initialSort);
|
|
1504
|
+
const [filters, setFilters] = useState6({});
|
|
1505
|
+
const filteredData = useMemo(() => {
|
|
1506
|
+
return data.filter((row) => {
|
|
1507
|
+
return Object.entries(filters).every(([columnId, filterValue]) => {
|
|
1508
|
+
if (!filterValue) return true;
|
|
1509
|
+
const column = columns.find((col) => col.id === columnId);
|
|
1510
|
+
if (!column?.filterable) return true;
|
|
1511
|
+
if (column.filterFn) {
|
|
1512
|
+
return column.filterFn(row, filterValue);
|
|
1513
|
+
}
|
|
1514
|
+
const cellValue = String(column.accessor(row));
|
|
1515
|
+
return cellValue.toLowerCase().includes(filterValue.toLowerCase());
|
|
1516
|
+
});
|
|
1517
|
+
});
|
|
1518
|
+
}, [data, filters, columns]);
|
|
1519
|
+
const sortedData = useMemo(() => {
|
|
1520
|
+
if (!sortConfig) return filteredData;
|
|
1521
|
+
const column = columns.find((col) => col.id === sortConfig.columnId);
|
|
1522
|
+
if (!column?.sortable) return filteredData;
|
|
1523
|
+
const sorted = [...filteredData].sort((a, b) => {
|
|
1524
|
+
if (column.sortFn) {
|
|
1525
|
+
return column.sortFn(a, b);
|
|
1526
|
+
}
|
|
1527
|
+
const aValue = String(column.accessor(a));
|
|
1528
|
+
const bValue = String(column.accessor(b));
|
|
1529
|
+
return aValue.localeCompare(bValue);
|
|
1530
|
+
});
|
|
1531
|
+
return sortConfig.direction === "desc" ? sorted.reverse() : sorted;
|
|
1532
|
+
}, [filteredData, sortConfig, columns]);
|
|
1533
|
+
const totalPages = Math.ceil(sortedData.length / pageSize);
|
|
1534
|
+
const showPagination = sortedData.length > pageSize;
|
|
1535
|
+
const startIndex = (currentPage - 1) * pageSize;
|
|
1536
|
+
const endIndex = startIndex + pageSize;
|
|
1537
|
+
const paginatedData = sortedData.slice(startIndex, endIndex);
|
|
1538
|
+
useEffect6(() => {
|
|
1539
|
+
setCurrentPage(1);
|
|
1540
|
+
}, [filters]);
|
|
1541
|
+
const handleSort = (columnId) => {
|
|
1542
|
+
const column = columns.find((col) => col.id === columnId);
|
|
1543
|
+
if (!column?.sortable) return;
|
|
1544
|
+
setSortConfig((current) => {
|
|
1545
|
+
if (current?.columnId === columnId) {
|
|
1546
|
+
if (current.direction === "asc") {
|
|
1547
|
+
return { columnId, direction: "desc" };
|
|
1548
|
+
}
|
|
1549
|
+
return null;
|
|
1550
|
+
}
|
|
1551
|
+
return { columnId, direction: "asc" };
|
|
1552
|
+
});
|
|
1553
|
+
};
|
|
1554
|
+
const handleFilterChange = (columnId, value) => {
|
|
1555
|
+
setFilters((current) => ({
|
|
1556
|
+
...current,
|
|
1557
|
+
[columnId]: value
|
|
1558
|
+
}));
|
|
1559
|
+
};
|
|
1560
|
+
const handlePageChange = (page) => {
|
|
1561
|
+
setCurrentPage(Math.max(1, Math.min(page, totalPages)));
|
|
1562
|
+
};
|
|
1563
|
+
return /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
1564
|
+
/* @__PURE__ */ jsxs13(Table, { children: [
|
|
1565
|
+
/* @__PURE__ */ jsx24(TableHead, { children: /* @__PURE__ */ jsx24(TableRow, { children: columns.map((column) => /* @__PURE__ */ jsx24(TableHeader, { children: /* @__PURE__ */ jsxs13(
|
|
1566
|
+
"div",
|
|
1567
|
+
{
|
|
1568
|
+
style: {
|
|
1569
|
+
display: "flex",
|
|
1570
|
+
alignItems: "center",
|
|
1571
|
+
gap: "8px",
|
|
1572
|
+
cursor: column.sortable ? "pointer" : "default"
|
|
1573
|
+
},
|
|
1574
|
+
onClick: () => handleSort(column.id),
|
|
1575
|
+
children: [
|
|
1576
|
+
/* @__PURE__ */ jsx24("span", { children: column.header }),
|
|
1577
|
+
column.sortable && /* @__PURE__ */ jsx24(
|
|
1578
|
+
"span",
|
|
1579
|
+
{
|
|
1580
|
+
style: {
|
|
1581
|
+
fontSize: "12px",
|
|
1582
|
+
opacity: 0.7
|
|
1583
|
+
},
|
|
1584
|
+
children: sortConfig?.columnId === column.id ? sortConfig.direction === "asc" ? "\u2191" : "\u2193" : "\u2195"
|
|
1585
|
+
}
|
|
1586
|
+
)
|
|
1587
|
+
]
|
|
1588
|
+
}
|
|
1589
|
+
) }, column.id)) }) }),
|
|
1590
|
+
/* @__PURE__ */ jsxs13(TableBody, { children: [
|
|
1591
|
+
columns.some((column) => column.filterable) && /* @__PURE__ */ jsx24(TableRow, { children: columns.map((column) => /* @__PURE__ */ jsx24(TableCell, { children: column.filterable && /* @__PURE__ */ jsx24(
|
|
1592
|
+
Input,
|
|
1593
|
+
{
|
|
1594
|
+
label: "Filter",
|
|
1595
|
+
hideLabel: true,
|
|
1596
|
+
type: "search",
|
|
1597
|
+
placeholder: `Filter ${column.header.toLowerCase()}`,
|
|
1598
|
+
value: filters[column.id] || "",
|
|
1599
|
+
onChange: (e) => handleFilterChange(column.id, e.target.value),
|
|
1600
|
+
onClick: (e) => e.stopPropagation()
|
|
1601
|
+
}
|
|
1602
|
+
) }, column.id)) }),
|
|
1603
|
+
paginatedData.length === 0 ? /* @__PURE__ */ jsx24(TableRow, { children: /* @__PURE__ */ jsx24(TableCell, { colSpan: columns.length, children: /* @__PURE__ */ jsx24(
|
|
1604
|
+
"div",
|
|
1605
|
+
{
|
|
1606
|
+
style: {
|
|
1607
|
+
textAlign: "center",
|
|
1608
|
+
padding: "20px",
|
|
1609
|
+
opacity: 0.6
|
|
1610
|
+
},
|
|
1611
|
+
children: emptyMessage
|
|
1612
|
+
}
|
|
1613
|
+
) }) }) : paginatedData.map((row, index) => /* @__PURE__ */ jsx24(TableRow, { children: columns.map((column) => /* @__PURE__ */ jsx24(TableCell, { children: column.accessor(row) }, column.id)) }, getRowKey(row, startIndex + index)))
|
|
1614
|
+
] })
|
|
1615
|
+
] }),
|
|
1616
|
+
showPagination && /* @__PURE__ */ jsxs13(
|
|
1617
|
+
"div",
|
|
1618
|
+
{
|
|
1619
|
+
style: {
|
|
1620
|
+
display: "flex",
|
|
1621
|
+
justifyContent: "space-between",
|
|
1622
|
+
alignItems: "center",
|
|
1623
|
+
marginTop: "16px",
|
|
1624
|
+
padding: "8px 0"
|
|
1625
|
+
},
|
|
1626
|
+
children: [
|
|
1627
|
+
/* @__PURE__ */ jsxs13("div", { style: { fontSize: "14px", opacity: 0.7 }, children: [
|
|
1628
|
+
"Showing ",
|
|
1629
|
+
startIndex + 1,
|
|
1630
|
+
" to ",
|
|
1631
|
+
Math.min(endIndex, sortedData.length),
|
|
1632
|
+
" ",
|
|
1633
|
+
"of ",
|
|
1634
|
+
sortedData.length,
|
|
1635
|
+
" entries",
|
|
1636
|
+
Object.keys(filters).some((key) => filters[key]) && ` (filtered from ${data.length})`
|
|
1637
|
+
] }),
|
|
1638
|
+
/* @__PURE__ */ jsxs13("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
|
|
1639
|
+
/* @__PURE__ */ jsx24(
|
|
1640
|
+
Button,
|
|
1641
|
+
{
|
|
1642
|
+
variant: "secondary",
|
|
1643
|
+
onClick: () => handlePageChange(1),
|
|
1644
|
+
disabled: currentPage === 1,
|
|
1645
|
+
children: "\xAB\xAB"
|
|
1646
|
+
}
|
|
1647
|
+
),
|
|
1648
|
+
/* @__PURE__ */ jsx24(
|
|
1649
|
+
Button,
|
|
1650
|
+
{
|
|
1651
|
+
variant: "secondary",
|
|
1652
|
+
onClick: () => handlePageChange(currentPage - 1),
|
|
1653
|
+
disabled: currentPage === 1,
|
|
1654
|
+
children: "\xAB"
|
|
1655
|
+
}
|
|
1656
|
+
),
|
|
1657
|
+
/* @__PURE__ */ jsxs13("span", { style: { fontSize: "14px" }, children: [
|
|
1658
|
+
"Page ",
|
|
1659
|
+
currentPage,
|
|
1660
|
+
" of ",
|
|
1661
|
+
totalPages
|
|
1662
|
+
] }),
|
|
1663
|
+
/* @__PURE__ */ jsx24(
|
|
1664
|
+
Button,
|
|
1665
|
+
{
|
|
1666
|
+
variant: "secondary",
|
|
1667
|
+
onClick: () => handlePageChange(currentPage + 1),
|
|
1668
|
+
disabled: currentPage === totalPages,
|
|
1669
|
+
children: "\xBB"
|
|
1670
|
+
}
|
|
1671
|
+
),
|
|
1672
|
+
/* @__PURE__ */ jsx24(
|
|
1673
|
+
Button,
|
|
1674
|
+
{
|
|
1675
|
+
variant: "secondary",
|
|
1676
|
+
onClick: () => handlePageChange(totalPages),
|
|
1677
|
+
disabled: currentPage === totalPages,
|
|
1678
|
+
children: "\xBB\xBB"
|
|
1679
|
+
}
|
|
1680
|
+
)
|
|
1681
|
+
] })
|
|
1682
|
+
]
|
|
1683
|
+
}
|
|
1684
|
+
)
|
|
1685
|
+
] });
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
// src/inspector/viewer/group-view.tsx
|
|
1689
|
+
import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1493
1690
|
function partitionMembers(data) {
|
|
1494
1691
|
const everyone = Object.entries(data).filter(([key]) => key === "everyone").map(([key, value]) => ({
|
|
1495
1692
|
id: key,
|
|
@@ -1517,7 +1714,7 @@ function GroupView({
|
|
|
1517
1714
|
onNavigate,
|
|
1518
1715
|
node
|
|
1519
1716
|
}) {
|
|
1520
|
-
const [addMemberType, setAddMemberType] =
|
|
1717
|
+
const [addMemberType, setAddMemberType] = useState7(null);
|
|
1521
1718
|
const { everyone, members, parentGroups, childGroups } = partitionMembers(
|
|
1522
1719
|
data
|
|
1523
1720
|
);
|
|
@@ -1596,28 +1793,28 @@ function GroupView({
|
|
|
1596
1793
|
alert(`Failed to add ${addMemberType}: ${error.message}`);
|
|
1597
1794
|
}
|
|
1598
1795
|
};
|
|
1599
|
-
return /* @__PURE__ */
|
|
1600
|
-
/* @__PURE__ */
|
|
1601
|
-
/* @__PURE__ */
|
|
1602
|
-
/* @__PURE__ */
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
/* @__PURE__ */
|
|
1796
|
+
return /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
1797
|
+
/* @__PURE__ */ jsxs14(Table, { children: [
|
|
1798
|
+
/* @__PURE__ */ jsx25(TableHead, { children: /* @__PURE__ */ jsxs14(TableRow, { children: [
|
|
1799
|
+
/* @__PURE__ */ jsx25(TableHeader, { children: "Member" }),
|
|
1800
|
+
/* @__PURE__ */ jsx25(TableHeader, { children: "Permission" }),
|
|
1801
|
+
/* @__PURE__ */ jsx25(TableHeader, {})
|
|
1605
1802
|
] }) }),
|
|
1606
|
-
/* @__PURE__ */
|
|
1607
|
-
everyone.map((member) => /* @__PURE__ */
|
|
1608
|
-
/* @__PURE__ */
|
|
1609
|
-
/* @__PURE__ */
|
|
1610
|
-
/* @__PURE__ */
|
|
1803
|
+
/* @__PURE__ */ jsxs14(TableBody, { children: [
|
|
1804
|
+
everyone.map((member) => /* @__PURE__ */ jsxs14(TableRow, { children: [
|
|
1805
|
+
/* @__PURE__ */ jsx25(TableCell, { children: member.id }),
|
|
1806
|
+
/* @__PURE__ */ jsx25(TableCell, { children: member.role }),
|
|
1807
|
+
/* @__PURE__ */ jsx25(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ jsx25(
|
|
1611
1808
|
Button,
|
|
1612
1809
|
{
|
|
1613
1810
|
variant: "secondary",
|
|
1614
1811
|
onClick: () => onRemoveMember(member.id),
|
|
1615
|
-
children: /* @__PURE__ */
|
|
1812
|
+
children: /* @__PURE__ */ jsx25(Icon, { name: "delete" })
|
|
1616
1813
|
}
|
|
1617
1814
|
) })
|
|
1618
1815
|
] }, member.id)),
|
|
1619
|
-
members.map((member) => /* @__PURE__ */
|
|
1620
|
-
/* @__PURE__ */
|
|
1816
|
+
members.map((member) => /* @__PURE__ */ jsxs14(TableRow, { children: [
|
|
1817
|
+
/* @__PURE__ */ jsx25(TableCell, { children: /* @__PURE__ */ jsx25(
|
|
1621
1818
|
AccountOrGroupText,
|
|
1622
1819
|
{
|
|
1623
1820
|
coId: member.id,
|
|
@@ -1628,18 +1825,18 @@ function GroupView({
|
|
|
1628
1825
|
}
|
|
1629
1826
|
}
|
|
1630
1827
|
) }),
|
|
1631
|
-
/* @__PURE__ */
|
|
1632
|
-
/* @__PURE__ */
|
|
1828
|
+
/* @__PURE__ */ jsx25(TableCell, { children: member.role }),
|
|
1829
|
+
/* @__PURE__ */ jsx25(TableCell, { children: member.role !== "revoked" && /* @__PURE__ */ jsx25(
|
|
1633
1830
|
Button,
|
|
1634
1831
|
{
|
|
1635
1832
|
variant: "secondary",
|
|
1636
1833
|
onClick: () => onRemoveMember(member.id),
|
|
1637
|
-
children: /* @__PURE__ */
|
|
1834
|
+
children: /* @__PURE__ */ jsx25(Icon, { name: "delete" })
|
|
1638
1835
|
}
|
|
1639
1836
|
) })
|
|
1640
1837
|
] }, member.id)),
|
|
1641
|
-
parentGroups.map((group) => /* @__PURE__ */
|
|
1642
|
-
/* @__PURE__ */
|
|
1838
|
+
parentGroups.map((group) => /* @__PURE__ */ jsxs14(TableRow, { children: [
|
|
1839
|
+
/* @__PURE__ */ jsx25(TableCell, { children: /* @__PURE__ */ jsx25(
|
|
1643
1840
|
AccountOrGroupText,
|
|
1644
1841
|
{
|
|
1645
1842
|
coId: group.id,
|
|
@@ -1650,19 +1847,19 @@ function GroupView({
|
|
|
1650
1847
|
}
|
|
1651
1848
|
}
|
|
1652
1849
|
) }),
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1850
|
+
/* @__PURE__ */ jsx25(TableCell, { children: group.role }),
|
|
1851
|
+
/* @__PURE__ */ jsx25(TableCell, { children: group.role !== "revoked" && /* @__PURE__ */ jsx25(
|
|
1655
1852
|
Button,
|
|
1656
1853
|
{
|
|
1657
1854
|
variant: "secondary",
|
|
1658
1855
|
onClick: () => onRemoveGroup(group.id),
|
|
1659
|
-
children: /* @__PURE__ */
|
|
1856
|
+
children: /* @__PURE__ */ jsx25(Icon, { name: "delete" })
|
|
1660
1857
|
}
|
|
1661
1858
|
) })
|
|
1662
1859
|
] }, group.id))
|
|
1663
1860
|
] })
|
|
1664
1861
|
] }),
|
|
1665
|
-
/* @__PURE__ */
|
|
1862
|
+
/* @__PURE__ */ jsxs14(
|
|
1666
1863
|
"div",
|
|
1667
1864
|
{
|
|
1668
1865
|
style: {
|
|
@@ -1672,14 +1869,14 @@ function GroupView({
|
|
|
1672
1869
|
marginTop: "1rem"
|
|
1673
1870
|
},
|
|
1674
1871
|
children: [
|
|
1675
|
-
/* @__PURE__ */
|
|
1676
|
-
/* @__PURE__ */
|
|
1872
|
+
/* @__PURE__ */ jsx25(Button, { variant: "primary", onClick: () => setAddMemberType("account"), children: "Add Account" }),
|
|
1873
|
+
/* @__PURE__ */ jsx25(Button, { variant: "primary", onClick: () => setAddMemberType("group"), children: "Add Group" })
|
|
1677
1874
|
]
|
|
1678
1875
|
}
|
|
1679
1876
|
),
|
|
1680
|
-
childGroups.length > 0 && /* @__PURE__ */
|
|
1681
|
-
/* @__PURE__ */
|
|
1682
|
-
/* @__PURE__ */
|
|
1877
|
+
childGroups.length > 0 && /* @__PURE__ */ jsxs14(Table, { children: [
|
|
1878
|
+
/* @__PURE__ */ jsx25(TableHead, { children: /* @__PURE__ */ jsx25(TableRow, { children: /* @__PURE__ */ jsx25(TableHeader, { children: "Member of" }) }) }),
|
|
1879
|
+
/* @__PURE__ */ jsx25(TableBody, { children: childGroups.map((group) => /* @__PURE__ */ jsx25(TableRow, { children: /* @__PURE__ */ jsx25(TableCell, { children: /* @__PURE__ */ jsx25(
|
|
1683
1880
|
AccountOrGroupText,
|
|
1684
1881
|
{
|
|
1685
1882
|
coId: group.id,
|
|
@@ -1691,20 +1888,20 @@ function GroupView({
|
|
|
1691
1888
|
}
|
|
1692
1889
|
) }) }, group.id)) })
|
|
1693
1890
|
] }),
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
/* @__PURE__ */
|
|
1891
|
+
/* @__PURE__ */ jsx25(RawDataCard, { data }),
|
|
1892
|
+
/* @__PURE__ */ jsx25(
|
|
1696
1893
|
Modal,
|
|
1697
1894
|
{
|
|
1698
1895
|
isOpen: addMemberType !== null,
|
|
1699
1896
|
onClose: () => setAddMemberType(null),
|
|
1700
1897
|
heading: addMemberType === "account" ? "Add Account" : "Add Group",
|
|
1701
1898
|
showButtons: false,
|
|
1702
|
-
children: /* @__PURE__ */
|
|
1899
|
+
children: /* @__PURE__ */ jsx25("form", { onSubmit: handleAddMemberSubmit, children: /* @__PURE__ */ jsxs14(
|
|
1703
1900
|
"div",
|
|
1704
1901
|
{
|
|
1705
1902
|
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
1706
1903
|
children: [
|
|
1707
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ jsx25(
|
|
1708
1905
|
Input,
|
|
1709
1906
|
{
|
|
1710
1907
|
name: "memberId",
|
|
@@ -1713,13 +1910,13 @@ function GroupView({
|
|
|
1713
1910
|
required: true
|
|
1714
1911
|
}
|
|
1715
1912
|
),
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
1720
|
-
addMemberType === "account" ? /* @__PURE__ */
|
|
1913
|
+
/* @__PURE__ */ jsxs14(Select, { name: "role", label: "Role", children: [
|
|
1914
|
+
/* @__PURE__ */ jsx25("option", { value: "reader", children: "Reader" }),
|
|
1915
|
+
/* @__PURE__ */ jsx25("option", { value: "writer", children: "Writer" }),
|
|
1916
|
+
/* @__PURE__ */ jsx25("option", { value: "admin", children: "Admin" }),
|
|
1917
|
+
addMemberType === "account" ? /* @__PURE__ */ jsx25(Fragment8, { children: /* @__PURE__ */ jsx25("option", { value: "writeOnly", children: "Write Only" }) }) : /* @__PURE__ */ jsx25(Fragment8, { children: /* @__PURE__ */ jsx25("option", { value: "inherit", children: "Inherit" }) })
|
|
1721
1918
|
] }),
|
|
1722
|
-
/* @__PURE__ */
|
|
1919
|
+
/* @__PURE__ */ jsxs14(
|
|
1723
1920
|
"div",
|
|
1724
1921
|
{
|
|
1725
1922
|
style: {
|
|
@@ -1729,7 +1926,7 @@ function GroupView({
|
|
|
1729
1926
|
marginTop: "0.5rem"
|
|
1730
1927
|
},
|
|
1731
1928
|
children: [
|
|
1732
|
-
/* @__PURE__ */
|
|
1929
|
+
/* @__PURE__ */ jsx25(
|
|
1733
1930
|
Button,
|
|
1734
1931
|
{
|
|
1735
1932
|
type: "button",
|
|
@@ -1738,7 +1935,7 @@ function GroupView({
|
|
|
1738
1935
|
children: "Cancel"
|
|
1739
1936
|
}
|
|
1740
1937
|
),
|
|
1741
|
-
/* @__PURE__ */
|
|
1938
|
+
/* @__PURE__ */ jsx25(Button, { type: "submit", variant: "primary", children: "Add" })
|
|
1742
1939
|
]
|
|
1743
1940
|
}
|
|
1744
1941
|
)
|
|
@@ -1751,7 +1948,7 @@ function GroupView({
|
|
|
1751
1948
|
}
|
|
1752
1949
|
|
|
1753
1950
|
// src/inspector/viewer/role-display.tsx
|
|
1754
|
-
import { jsxs as
|
|
1951
|
+
import { jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1755
1952
|
function RoleDisplay({
|
|
1756
1953
|
node,
|
|
1757
1954
|
value
|
|
@@ -1770,7 +1967,7 @@ function RoleDisplay({
|
|
|
1770
1967
|
} else {
|
|
1771
1968
|
role = "unauthorized";
|
|
1772
1969
|
}
|
|
1773
|
-
return /* @__PURE__ */
|
|
1970
|
+
return /* @__PURE__ */ jsxs15(Text, { children: [
|
|
1774
1971
|
"Role: ",
|
|
1775
1972
|
role
|
|
1776
1973
|
] });
|
|
@@ -1778,8 +1975,8 @@ function RoleDisplay({
|
|
|
1778
1975
|
|
|
1779
1976
|
// src/inspector/viewer/table-viewer.tsx
|
|
1780
1977
|
import { styled as styled15 } from "goober";
|
|
1781
|
-
import { useMemo, useState as
|
|
1782
|
-
import { Fragment as
|
|
1978
|
+
import { useMemo as useMemo2, useState as useState8 } from "react";
|
|
1979
|
+
import { Fragment as Fragment9, jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1783
1980
|
var PaginationContainer = styled15("div")`
|
|
1784
1981
|
padding: 1rem 0;
|
|
1785
1982
|
display: flex;
|
|
@@ -1824,8 +2021,8 @@ function CoValuesTableView({
|
|
|
1824
2021
|
onNavigate,
|
|
1825
2022
|
onRemove
|
|
1826
2023
|
}) {
|
|
1827
|
-
const [visibleRowsCount, setVisibleRowsCount] =
|
|
1828
|
-
const [coIdArray, visibleRows] =
|
|
2024
|
+
const [visibleRowsCount, setVisibleRowsCount] = useState8(10);
|
|
2025
|
+
const [coIdArray, visibleRows] = useMemo2(() => {
|
|
1829
2026
|
const coIdArray2 = Array.isArray(data) ? data : Object.values(data).every((k) => typeof k === "string" && isCoId(k)) ? Object.values(data).map((k) => k) : [];
|
|
1830
2027
|
const visibleRows2 = coIdArray2.slice(0, visibleRowsCount);
|
|
1831
2028
|
return [coIdArray2, visibleRows2];
|
|
@@ -1833,10 +2030,10 @@ function CoValuesTableView({
|
|
|
1833
2030
|
const resolvedRows = useResolvedCoValues(visibleRows, node);
|
|
1834
2031
|
const hasMore = visibleRowsCount < coIdArray.length;
|
|
1835
2032
|
if (!coIdArray.length) {
|
|
1836
|
-
return /* @__PURE__ */
|
|
2033
|
+
return /* @__PURE__ */ jsx26("div", { children: "No data to display" });
|
|
1837
2034
|
}
|
|
1838
2035
|
if (resolvedRows.length === 0) {
|
|
1839
|
-
return /* @__PURE__ */
|
|
2036
|
+
return /* @__PURE__ */ jsx26("div", { children: "Loading..." });
|
|
1840
2037
|
}
|
|
1841
2038
|
const keys = Array.from(
|
|
1842
2039
|
new Set(
|
|
@@ -1846,15 +2043,15 @@ function CoValuesTableView({
|
|
|
1846
2043
|
const loadMore = () => {
|
|
1847
2044
|
setVisibleRowsCount((prevVisibleRows) => prevVisibleRows + 10);
|
|
1848
2045
|
};
|
|
1849
|
-
return /* @__PURE__ */
|
|
1850
|
-
/* @__PURE__ */
|
|
1851
|
-
/* @__PURE__ */
|
|
1852
|
-
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */
|
|
1853
|
-
onRemove && /* @__PURE__ */
|
|
2046
|
+
return /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
2047
|
+
/* @__PURE__ */ jsxs16(Table, { children: [
|
|
2048
|
+
/* @__PURE__ */ jsx26(TableHead, { children: /* @__PURE__ */ jsxs16(TableRow, { children: [
|
|
2049
|
+
["ID", ...keys, "Action"].map((key) => /* @__PURE__ */ jsx26(TableHeader, { children: key }, key)),
|
|
2050
|
+
onRemove && /* @__PURE__ */ jsx26(TableHeader, {})
|
|
1854
2051
|
] }) }),
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__PURE__ */
|
|
1857
|
-
/* @__PURE__ */
|
|
2052
|
+
/* @__PURE__ */ jsx26(TableBody, { children: resolvedRows.slice(0, visibleRowsCount).map((item, index) => /* @__PURE__ */ jsxs16(TableRow, { children: [
|
|
2053
|
+
/* @__PURE__ */ jsx26(TableCell, { children: /* @__PURE__ */ jsx26(Text, { mono: true, children: item.snapshot === "unavailable" ? /* @__PURE__ */ jsxs16(RedTooltip, { "data-text": "Unavailable", children: [
|
|
2054
|
+
/* @__PURE__ */ jsx26(
|
|
1858
2055
|
Icon,
|
|
1859
2056
|
{
|
|
1860
2057
|
name: "caution",
|
|
@@ -1867,7 +2064,7 @@ function CoValuesTableView({
|
|
|
1867
2064
|
),
|
|
1868
2065
|
visibleRows[index]
|
|
1869
2066
|
] }) : visibleRows[index] }) }),
|
|
1870
|
-
keys.map((key) => /* @__PURE__ */
|
|
2067
|
+
keys.map((key) => /* @__PURE__ */ jsx26(TableCell, { children: item.snapshot !== "unavailable" && /* @__PURE__ */ jsx26(
|
|
1871
2068
|
ValueRenderer,
|
|
1872
2069
|
{
|
|
1873
2070
|
json: item.snapshot[key],
|
|
@@ -1888,7 +2085,7 @@ function CoValuesTableView({
|
|
|
1888
2085
|
}
|
|
1889
2086
|
}
|
|
1890
2087
|
) }, key)),
|
|
1891
|
-
/* @__PURE__ */
|
|
2088
|
+
/* @__PURE__ */ jsx26(TableCell, { children: /* @__PURE__ */ jsx26(
|
|
1892
2089
|
Button,
|
|
1893
2090
|
{
|
|
1894
2091
|
variant: "secondary",
|
|
@@ -1901,18 +2098,18 @@ function CoValuesTableView({
|
|
|
1901
2098
|
children: "View"
|
|
1902
2099
|
}
|
|
1903
2100
|
) }),
|
|
1904
|
-
onRemove && /* @__PURE__ */
|
|
2101
|
+
onRemove && /* @__PURE__ */ jsx26(TableCell, { children: /* @__PURE__ */ jsx26(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
1905
2102
|
] }, index)) })
|
|
1906
2103
|
] }),
|
|
1907
|
-
/* @__PURE__ */
|
|
1908
|
-
/* @__PURE__ */
|
|
2104
|
+
/* @__PURE__ */ jsxs16(PaginationContainer, { children: [
|
|
2105
|
+
/* @__PURE__ */ jsxs16(Text, { muted: true, small: true, children: [
|
|
1909
2106
|
"Showing ",
|
|
1910
2107
|
Math.min(visibleRowsCount, coIdArray.length),
|
|
1911
2108
|
" of",
|
|
1912
2109
|
" ",
|
|
1913
2110
|
coIdArray.length
|
|
1914
2111
|
] }),
|
|
1915
|
-
hasMore && /* @__PURE__ */
|
|
2112
|
+
hasMore && /* @__PURE__ */ jsx26(Button, { variant: "secondary", onClick: loadMore, children: "Load more" })
|
|
1916
2113
|
] })
|
|
1917
2114
|
] });
|
|
1918
2115
|
}
|
|
@@ -1922,11 +2119,11 @@ function TableView({
|
|
|
1922
2119
|
onNavigate,
|
|
1923
2120
|
onRemove
|
|
1924
2121
|
}) {
|
|
1925
|
-
const isListOfCoValues =
|
|
2122
|
+
const isListOfCoValues = useMemo2(() => {
|
|
1926
2123
|
return Array.isArray(data) && data.every((k) => isCoId(k));
|
|
1927
2124
|
}, [data]);
|
|
1928
2125
|
if (isListOfCoValues) {
|
|
1929
|
-
return /* @__PURE__ */
|
|
2126
|
+
return /* @__PURE__ */ jsx26(
|
|
1930
2127
|
CoValuesTableView,
|
|
1931
2128
|
{
|
|
1932
2129
|
data,
|
|
@@ -1936,26 +2133,271 @@ function TableView({
|
|
|
1936
2133
|
}
|
|
1937
2134
|
);
|
|
1938
2135
|
}
|
|
1939
|
-
return /* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
1941
|
-
/* @__PURE__ */
|
|
1942
|
-
/* @__PURE__ */
|
|
1943
|
-
onRemove && /* @__PURE__ */
|
|
2136
|
+
return /* @__PURE__ */ jsxs16(Table, { children: [
|
|
2137
|
+
/* @__PURE__ */ jsx26(TableHead, { children: /* @__PURE__ */ jsxs16(TableRow, { children: [
|
|
2138
|
+
/* @__PURE__ */ jsx26(TableHeader, { style: { width: "5rem" }, children: "Index" }),
|
|
2139
|
+
/* @__PURE__ */ jsx26(TableHeader, { children: "Value" }),
|
|
2140
|
+
onRemove && /* @__PURE__ */ jsx26(TableHeader, { children: "Action" })
|
|
1944
2141
|
] }) }),
|
|
1945
|
-
/* @__PURE__ */
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
onRemove && /* @__PURE__ */
|
|
2142
|
+
/* @__PURE__ */ jsx26(TableBody, { children: Array.isArray(data) && data?.map((value, index) => /* @__PURE__ */ jsxs16(TableRow, { children: [
|
|
2143
|
+
/* @__PURE__ */ jsx26(TableCell, { children: /* @__PURE__ */ jsx26(Text, { mono: true, children: index }) }),
|
|
2144
|
+
/* @__PURE__ */ jsx26(TableCell, { children: /* @__PURE__ */ jsx26(ValueRenderer, { json: value }) }),
|
|
2145
|
+
onRemove && /* @__PURE__ */ jsx26(TableCell, { children: /* @__PURE__ */ jsx26(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
|
1949
2146
|
] }, index)) })
|
|
1950
2147
|
] });
|
|
1951
2148
|
}
|
|
1952
2149
|
|
|
2150
|
+
// src/inspector/viewer/history-view.tsx
|
|
2151
|
+
import { useMemo as useMemo3 } from "react";
|
|
2152
|
+
import { styled as styled16 } from "goober";
|
|
2153
|
+
import { Fragment as Fragment10, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2154
|
+
function HistoryView({
|
|
2155
|
+
coValue,
|
|
2156
|
+
node
|
|
2157
|
+
}) {
|
|
2158
|
+
const transactions = useMemo3(
|
|
2159
|
+
() => getHistory(coValue),
|
|
2160
|
+
[coValue.core.verifiedTransactions.length]
|
|
2161
|
+
);
|
|
2162
|
+
const columns = [
|
|
2163
|
+
{
|
|
2164
|
+
id: "author",
|
|
2165
|
+
header: "Author",
|
|
2166
|
+
accessor: (row) => /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
2167
|
+
row.isValid || /* @__PURE__ */ jsx27(RedTooltip2, { "data-text": "This transaction is invalid and is not used", children: /* @__PURE__ */ jsx27(
|
|
2168
|
+
Icon,
|
|
2169
|
+
{
|
|
2170
|
+
name: "caution",
|
|
2171
|
+
size: "xs",
|
|
2172
|
+
color: "red",
|
|
2173
|
+
style: {
|
|
2174
|
+
display: "inline-block",
|
|
2175
|
+
verticalAlign: "middle",
|
|
2176
|
+
marginRight: "0.25rem"
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
) }),
|
|
2180
|
+
row.author.startsWith("co_") ? /* @__PURE__ */ jsx27(
|
|
2181
|
+
AccountOrGroupText,
|
|
2182
|
+
{
|
|
2183
|
+
coId: row.author,
|
|
2184
|
+
node,
|
|
2185
|
+
showId: true
|
|
2186
|
+
}
|
|
2187
|
+
) : row.author
|
|
2188
|
+
] }),
|
|
2189
|
+
sortable: false,
|
|
2190
|
+
filterable: true,
|
|
2191
|
+
sortFn: (a, b) => a.author.localeCompare(b.author),
|
|
2192
|
+
filterFn: (row, filterValue) => row.author.toLowerCase().includes(filterValue.toLowerCase())
|
|
2193
|
+
},
|
|
2194
|
+
{
|
|
2195
|
+
id: "action",
|
|
2196
|
+
header: "Action",
|
|
2197
|
+
accessor: (row) => row.action,
|
|
2198
|
+
sortable: false,
|
|
2199
|
+
filterable: true,
|
|
2200
|
+
sortFn: (a, b) => a.action.localeCompare(b.action)
|
|
2201
|
+
},
|
|
2202
|
+
{
|
|
2203
|
+
id: "timestamp",
|
|
2204
|
+
header: "Timestamp",
|
|
2205
|
+
accessor: (row) => row.timestamp.toISOString(),
|
|
2206
|
+
sortable: true,
|
|
2207
|
+
filterable: true,
|
|
2208
|
+
sortFn: (a, b) => a.timestamp.getTime() - b.timestamp.getTime()
|
|
2209
|
+
}
|
|
2210
|
+
];
|
|
2211
|
+
return /* @__PURE__ */ jsxs17("section", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
|
|
2212
|
+
/* @__PURE__ */ jsx27(Heading, { children: "CoValue history" }),
|
|
2213
|
+
/* @__PURE__ */ jsx27(
|
|
2214
|
+
DataTable,
|
|
2215
|
+
{
|
|
2216
|
+
columns,
|
|
2217
|
+
data: transactions,
|
|
2218
|
+
pageSize: 10,
|
|
2219
|
+
initialSort: { columnId: "timestamp", direction: "desc" },
|
|
2220
|
+
getRowKey: (row) => row.id,
|
|
2221
|
+
emptyMessage: "No history available"
|
|
2222
|
+
}
|
|
2223
|
+
)
|
|
2224
|
+
] });
|
|
2225
|
+
}
|
|
2226
|
+
function getTransactionChanges(tx, coValue) {
|
|
2227
|
+
if (tx.isValid === false && tx.tx.privacy === "private") {
|
|
2228
|
+
const readKey = coValue.core.getReadKey(tx.tx.keyUsed);
|
|
2229
|
+
if (!readKey) {
|
|
2230
|
+
throw new Error("Read key not found");
|
|
2231
|
+
}
|
|
2232
|
+
return coValue.core.verified.decryptTransaction(
|
|
2233
|
+
tx.txID.sessionID,
|
|
2234
|
+
tx.txID.txIndex,
|
|
2235
|
+
readKey
|
|
2236
|
+
) ?? [];
|
|
2237
|
+
}
|
|
2238
|
+
return tx.changes ?? tx.tx.changes ?? [];
|
|
2239
|
+
}
|
|
2240
|
+
function getHistory(coValue) {
|
|
2241
|
+
return coValue.core.verifiedTransactions.flatMap((tx, index) => {
|
|
2242
|
+
const changes = getTransactionChanges(tx, coValue);
|
|
2243
|
+
return changes.map((change, changeIndex) => ({
|
|
2244
|
+
id: `${tx.txID.sessionID.toString()}-${tx.txID.txIndex}-${index}-${changeIndex}`,
|
|
2245
|
+
author: tx.author,
|
|
2246
|
+
action: mapTransactionToAction(change, coValue),
|
|
2247
|
+
timestamp: new Date(tx.currentMadeAt),
|
|
2248
|
+
isValid: tx.isValid
|
|
2249
|
+
}));
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
function mapTransactionToAction(change, coValue) {
|
|
2253
|
+
if (isUserPromotion(change)) {
|
|
2254
|
+
if (change.value === "revoked") {
|
|
2255
|
+
return `${change.key} has been revoked`;
|
|
2256
|
+
}
|
|
2257
|
+
return `${change.key} has been promoted to ${change.value}`;
|
|
2258
|
+
}
|
|
2259
|
+
if (isGroupExtension(change)) {
|
|
2260
|
+
const child = change.key.slice(6);
|
|
2261
|
+
return `Group became a member of ${child}`;
|
|
2262
|
+
}
|
|
2263
|
+
if (isGroupExtendRevocation(change)) {
|
|
2264
|
+
const child = change.key.slice(6);
|
|
2265
|
+
return `Group's membership of ${child} has been revoked.`;
|
|
2266
|
+
}
|
|
2267
|
+
if (isGroupPromotion(change)) {
|
|
2268
|
+
const parent = change.key.slice(7);
|
|
2269
|
+
return `Group ${parent} has been promoted to ${change.value}`;
|
|
2270
|
+
}
|
|
2271
|
+
if (isKeyRevelation(change)) {
|
|
2272
|
+
const [key, target] = change.key.split("_for_");
|
|
2273
|
+
return `Key "${key}" has been revealed to "${target}"`;
|
|
2274
|
+
}
|
|
2275
|
+
if (isItemAppend(change)) {
|
|
2276
|
+
if (change.after === "start") {
|
|
2277
|
+
return `"${change.value}" has been appended`;
|
|
2278
|
+
}
|
|
2279
|
+
const after = findListChange(change.after, coValue);
|
|
2280
|
+
if (after === void 0) {
|
|
2281
|
+
return `"${change.value}" has been inserted after undefined item`;
|
|
2282
|
+
}
|
|
2283
|
+
return `"${change.value}" has been inserted after "${after.value}"`;
|
|
2284
|
+
}
|
|
2285
|
+
if (isItemPrepend(change)) {
|
|
2286
|
+
if (change.before === "end") {
|
|
2287
|
+
return `"${change.value}" has been prepended`;
|
|
2288
|
+
}
|
|
2289
|
+
const before = findListChange(change.before, coValue);
|
|
2290
|
+
if (before === void 0) {
|
|
2291
|
+
return `"${change.value}" has been inserted before undefined item`;
|
|
2292
|
+
}
|
|
2293
|
+
return `"${change.value}" has been inserted before "${before.value}"`;
|
|
2294
|
+
}
|
|
2295
|
+
if (isItemDeletion(change)) {
|
|
2296
|
+
const insertion = findListChange(change.insertion, coValue);
|
|
2297
|
+
if (insertion === void 0) {
|
|
2298
|
+
return `An undefined item has been deleted`;
|
|
2299
|
+
}
|
|
2300
|
+
return `"${insertion.value}" has been deleted`;
|
|
2301
|
+
}
|
|
2302
|
+
if (isStreamStart(change)) {
|
|
2303
|
+
return `Stream started with mime type "${change.mimeType}" and file name "${change.fileName}"`;
|
|
2304
|
+
}
|
|
2305
|
+
if (isStreamChunk(change)) {
|
|
2306
|
+
return `Stream chunk added`;
|
|
2307
|
+
}
|
|
2308
|
+
if (isStreamEnd(change)) {
|
|
2309
|
+
return `Stream ended`;
|
|
2310
|
+
}
|
|
2311
|
+
if (isPropertySet(change)) {
|
|
2312
|
+
return `Property "${change.key}" has been set to "${change.value}"`;
|
|
2313
|
+
}
|
|
2314
|
+
if (isPropertyDeletion(change)) {
|
|
2315
|
+
return `Property "${change.key}" has been deleted`;
|
|
2316
|
+
}
|
|
2317
|
+
return "Unknown action: " + JSON.stringify(change);
|
|
2318
|
+
}
|
|
2319
|
+
var findListChange = (opId, coValue) => {
|
|
2320
|
+
return coValue.core.verifiedTransactions.find(
|
|
2321
|
+
(tx) => tx.txID.sessionID === opId.sessionID && tx.txID.txIndex === opId.txIndex
|
|
2322
|
+
)?.changes?.[opId.changeIdx];
|
|
2323
|
+
};
|
|
2324
|
+
var isGroupExtension = (change) => {
|
|
2325
|
+
return change?.op === "set" && change?.value === "extend";
|
|
2326
|
+
};
|
|
2327
|
+
var isGroupExtendRevocation = (change) => {
|
|
2328
|
+
return change?.op === "set" && change?.value === "revoked";
|
|
2329
|
+
};
|
|
2330
|
+
var isGroupPromotion = (change) => {
|
|
2331
|
+
return change?.op === "set" && change?.key.startsWith("parent_co_");
|
|
2332
|
+
};
|
|
2333
|
+
var isUserPromotion = (change) => {
|
|
2334
|
+
return change?.op === "set" && (isCoId(change?.key) || change?.key === "everyone");
|
|
2335
|
+
};
|
|
2336
|
+
var isKeyRevelation = (change) => {
|
|
2337
|
+
return change?.op === "set" && change?.key.includes("_for_");
|
|
2338
|
+
};
|
|
2339
|
+
var isPropertySet = (change) => {
|
|
2340
|
+
return change?.op === "set" && "key" in change && "value" in change;
|
|
2341
|
+
};
|
|
2342
|
+
var isPropertyDeletion = (change) => {
|
|
2343
|
+
return change?.op === "del" && "key" in change;
|
|
2344
|
+
};
|
|
2345
|
+
var isItemAppend = (change) => {
|
|
2346
|
+
return change?.op === "app" && "after" in change && "value" in change;
|
|
2347
|
+
};
|
|
2348
|
+
var isItemPrepend = (change) => {
|
|
2349
|
+
return change?.op === "pre" && "before" in change && "value" in change;
|
|
2350
|
+
};
|
|
2351
|
+
var isItemDeletion = (change) => {
|
|
2352
|
+
return change?.op === "del" && "insertion" in change;
|
|
2353
|
+
};
|
|
2354
|
+
var isStreamStart = (change) => {
|
|
2355
|
+
return change?.type === "start" && "mimeType" in change;
|
|
2356
|
+
};
|
|
2357
|
+
var isStreamChunk = (change) => {
|
|
2358
|
+
return change?.type === "chunk" && "chunk" in change;
|
|
2359
|
+
};
|
|
2360
|
+
var isStreamEnd = (change) => {
|
|
2361
|
+
return change?.type === "end";
|
|
2362
|
+
};
|
|
2363
|
+
var RedTooltip2 = styled16("span")`
|
|
2364
|
+
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
2365
|
+
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
2366
|
+
|
|
2367
|
+
&:before {
|
|
2368
|
+
content: attr(data-text);
|
|
2369
|
+
background-color: red;
|
|
2370
|
+
position:absolute;
|
|
2371
|
+
|
|
2372
|
+
/* vertically center */
|
|
2373
|
+
top:50%;
|
|
2374
|
+
transform:translateY(-50%);
|
|
2375
|
+
|
|
2376
|
+
/* move to right */
|
|
2377
|
+
left:100%;
|
|
2378
|
+
margin-left:15px; /* and add a small left margin */
|
|
2379
|
+
|
|
2380
|
+
/* basic styles */
|
|
2381
|
+
width:200px;
|
|
2382
|
+
padding:10px;
|
|
2383
|
+
border-radius:10px;
|
|
2384
|
+
color: #fff;
|
|
2385
|
+
text-align:center;
|
|
2386
|
+
|
|
2387
|
+
display:none; /* hide by default */
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
&:hover:before {
|
|
2391
|
+
display:block;
|
|
2392
|
+
}
|
|
2393
|
+
`;
|
|
2394
|
+
|
|
1953
2395
|
// src/inspector/viewer/page.tsx
|
|
1954
|
-
import { Fragment as
|
|
2396
|
+
import { Fragment as Fragment11, jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1955
2397
|
var BasePageContainer = React5.forwardRef(
|
|
1956
|
-
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */
|
|
2398
|
+
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ jsx28("div", { ref, ...rest })
|
|
1957
2399
|
);
|
|
1958
|
-
var PageContainer =
|
|
2400
|
+
var PageContainer = styled17(BasePageContainer)`
|
|
1959
2401
|
position: absolute;
|
|
1960
2402
|
z-index: 10;
|
|
1961
2403
|
inset: 0;
|
|
@@ -1963,36 +2405,36 @@ var PageContainer = styled16(BasePageContainer)`
|
|
|
1963
2405
|
height: 100%;
|
|
1964
2406
|
padding: 0 0.75rem;
|
|
1965
2407
|
`;
|
|
1966
|
-
var BackButton =
|
|
2408
|
+
var BackButton = styled17("div")`
|
|
1967
2409
|
position: absolute;
|
|
1968
2410
|
left: 0;
|
|
1969
2411
|
right: 0;
|
|
1970
2412
|
top: 0;
|
|
1971
2413
|
height: 2.5rem;
|
|
1972
2414
|
`;
|
|
1973
|
-
var HeaderContainer =
|
|
2415
|
+
var HeaderContainer = styled17("div")`
|
|
1974
2416
|
display: flex;
|
|
1975
2417
|
justify-content: space-between;
|
|
1976
2418
|
align-items: center;
|
|
1977
2419
|
margin-bottom: 1rem;
|
|
1978
2420
|
`;
|
|
1979
|
-
var TitleContainer =
|
|
2421
|
+
var TitleContainer = styled17("div")`
|
|
1980
2422
|
display: flex;
|
|
1981
2423
|
align-items: center;
|
|
1982
2424
|
gap: 0.75rem;
|
|
1983
2425
|
`;
|
|
1984
|
-
var Title =
|
|
2426
|
+
var Title = styled17(Heading)`
|
|
1985
2427
|
display: flex;
|
|
1986
2428
|
flex-direction: column;
|
|
1987
2429
|
align-items: flex-start;
|
|
1988
2430
|
gap: 0.25rem;
|
|
1989
2431
|
`;
|
|
1990
|
-
var BadgeContainer =
|
|
2432
|
+
var BadgeContainer = styled17("div")`
|
|
1991
2433
|
display: flex;
|
|
1992
2434
|
align-items: center;
|
|
1993
2435
|
gap: 0.75rem;
|
|
1994
2436
|
`;
|
|
1995
|
-
var ContentContainer =
|
|
2437
|
+
var ContentContainer = styled17("div")`
|
|
1996
2438
|
overflow: auto;
|
|
1997
2439
|
display: flex;
|
|
1998
2440
|
flex-direction: column;
|
|
@@ -2013,7 +2455,7 @@ function View(props) {
|
|
|
2013
2455
|
const { node, onNavigate } = props;
|
|
2014
2456
|
if (!snapshot || snapshot === "unavailable") return;
|
|
2015
2457
|
if (type === "costream") {
|
|
2016
|
-
return /* @__PURE__ */
|
|
2458
|
+
return /* @__PURE__ */ jsx28(
|
|
2017
2459
|
CoStreamView,
|
|
2018
2460
|
{
|
|
2019
2461
|
data: snapshot,
|
|
@@ -2024,7 +2466,7 @@ function View(props) {
|
|
|
2024
2466
|
);
|
|
2025
2467
|
}
|
|
2026
2468
|
if (extendedType === "group") {
|
|
2027
|
-
return /* @__PURE__ */
|
|
2469
|
+
return /* @__PURE__ */ jsx28(
|
|
2028
2470
|
GroupView,
|
|
2029
2471
|
{
|
|
2030
2472
|
coValue: value,
|
|
@@ -2035,10 +2477,10 @@ function View(props) {
|
|
|
2035
2477
|
);
|
|
2036
2478
|
}
|
|
2037
2479
|
if (extendedType === "account") {
|
|
2038
|
-
return /* @__PURE__ */
|
|
2480
|
+
return /* @__PURE__ */ jsx28(AccountView, { data: snapshot, node, onNavigate });
|
|
2039
2481
|
}
|
|
2040
2482
|
if (type === "coplaintext") {
|
|
2041
|
-
return /* @__PURE__ */
|
|
2483
|
+
return /* @__PURE__ */ jsx28(CoPlainTextView, { data: snapshot });
|
|
2042
2484
|
}
|
|
2043
2485
|
if (type === "colist") {
|
|
2044
2486
|
const handleRemove = (index) => {
|
|
@@ -2047,7 +2489,7 @@ function View(props) {
|
|
|
2047
2489
|
list.delete(index);
|
|
2048
2490
|
}
|
|
2049
2491
|
};
|
|
2050
|
-
return /* @__PURE__ */
|
|
2492
|
+
return /* @__PURE__ */ jsx28(
|
|
2051
2493
|
TableView,
|
|
2052
2494
|
{
|
|
2053
2495
|
data: snapshot,
|
|
@@ -2058,9 +2500,9 @@ function View(props) {
|
|
|
2058
2500
|
);
|
|
2059
2501
|
}
|
|
2060
2502
|
if (extendedType === "record") {
|
|
2061
|
-
return /* @__PURE__ */
|
|
2503
|
+
return /* @__PURE__ */ jsx28(TableView, { data: snapshot, node, onNavigate });
|
|
2062
2504
|
}
|
|
2063
|
-
return /* @__PURE__ */
|
|
2505
|
+
return /* @__PURE__ */ jsx28(GridView, { data: snapshot, onNavigate, node });
|
|
2064
2506
|
}
|
|
2065
2507
|
function Page(props) {
|
|
2066
2508
|
const {
|
|
@@ -2076,13 +2518,13 @@ function Page(props) {
|
|
|
2076
2518
|
const coValue = useResolvedCoValue(coId, node);
|
|
2077
2519
|
const { value, snapshot, type, extendedType } = coValue;
|
|
2078
2520
|
if (snapshot === "unavailable") {
|
|
2079
|
-
return /* @__PURE__ */
|
|
2521
|
+
return /* @__PURE__ */ jsx28("div", { style, children: "Data unavailable" });
|
|
2080
2522
|
}
|
|
2081
2523
|
if (!snapshot) {
|
|
2082
|
-
return /* @__PURE__ */
|
|
2524
|
+
return /* @__PURE__ */ jsx28("div", { style });
|
|
2083
2525
|
}
|
|
2084
|
-
return /* @__PURE__ */
|
|
2085
|
-
!isTopLevel && /* @__PURE__ */
|
|
2526
|
+
return /* @__PURE__ */ jsxs18(PageContainer, { style, className, isTopLevel, children: [
|
|
2527
|
+
!isTopLevel && /* @__PURE__ */ jsx28(
|
|
2086
2528
|
BackButton,
|
|
2087
2529
|
{
|
|
2088
2530
|
"aria-label": "Back",
|
|
@@ -2092,27 +2534,27 @@ function Page(props) {
|
|
|
2092
2534
|
"aria-hidden": "true"
|
|
2093
2535
|
}
|
|
2094
2536
|
),
|
|
2095
|
-
/* @__PURE__ */
|
|
2096
|
-
/* @__PURE__ */
|
|
2537
|
+
/* @__PURE__ */ jsx28(HeaderContainer, { children: /* @__PURE__ */ jsxs18(TitleContainer, { children: [
|
|
2538
|
+
/* @__PURE__ */ jsx28(Title, { children: /* @__PURE__ */ jsxs18("span", { children: [
|
|
2097
2539
|
name,
|
|
2098
|
-
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */
|
|
2540
|
+
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ jsxs18("span", { style: { color: "#57534e", fontWeight: 500 }, children: [
|
|
2099
2541
|
" ",
|
|
2100
2542
|
snapshot.name
|
|
2101
2543
|
] }) : null
|
|
2102
2544
|
] }) }),
|
|
2103
|
-
/* @__PURE__ */
|
|
2104
|
-
/* @__PURE__ */
|
|
2105
|
-
/* @__PURE__ */
|
|
2545
|
+
/* @__PURE__ */ jsxs18(BadgeContainer, { children: [
|
|
2546
|
+
/* @__PURE__ */ jsx28(Badge, { children: type && /* @__PURE__ */ jsx28(TypeIcon, { type, extendedType }) }),
|
|
2547
|
+
/* @__PURE__ */ jsx28(Badge, { children: coId })
|
|
2106
2548
|
] })
|
|
2107
2549
|
] }) }),
|
|
2108
|
-
/* @__PURE__ */
|
|
2109
|
-
/* @__PURE__ */
|
|
2110
|
-
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2550
|
+
/* @__PURE__ */ jsxs18(ContentContainer, { children: [
|
|
2551
|
+
/* @__PURE__ */ jsx28(View, { ...props, coValue }),
|
|
2552
|
+
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
2553
|
+
/* @__PURE__ */ jsx28(RoleDisplay, { node, value }),
|
|
2554
|
+
/* @__PURE__ */ jsxs18(Text, { muted: true, children: [
|
|
2113
2555
|
"Owned by",
|
|
2114
2556
|
" ",
|
|
2115
|
-
/* @__PURE__ */
|
|
2557
|
+
/* @__PURE__ */ jsx28(
|
|
2116
2558
|
AccountOrGroupText,
|
|
2117
2559
|
{
|
|
2118
2560
|
coId: value.group.id,
|
|
@@ -2124,14 +2566,15 @@ function Page(props) {
|
|
|
2124
2566
|
}
|
|
2125
2567
|
)
|
|
2126
2568
|
] })
|
|
2127
|
-
] })
|
|
2569
|
+
] }),
|
|
2570
|
+
value && /* @__PURE__ */ jsx28(HistoryView, { coValue: value, node })
|
|
2128
2571
|
] })
|
|
2129
2572
|
] });
|
|
2130
2573
|
}
|
|
2131
2574
|
|
|
2132
2575
|
// src/inspector/viewer/page-stack.tsx
|
|
2133
|
-
import { Fragment as
|
|
2134
|
-
var PageStackContainer =
|
|
2576
|
+
import { Fragment as Fragment12, jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2577
|
+
var PageStackContainer = styled18("div")`
|
|
2135
2578
|
position: relative;
|
|
2136
2579
|
padding: 0 0.75rem;
|
|
2137
2580
|
overflow-y: auto;
|
|
@@ -2148,9 +2591,9 @@ function PageStack({
|
|
|
2148
2591
|
}) {
|
|
2149
2592
|
const page = path[path.length - 1];
|
|
2150
2593
|
const index = path.length - 1;
|
|
2151
|
-
return /* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ jsx29(Fragment12, { children: /* @__PURE__ */ jsxs19(PageStackContainer, { children: [
|
|
2152
2595
|
children,
|
|
2153
|
-
node && page && /* @__PURE__ */
|
|
2596
|
+
node && page && /* @__PURE__ */ jsx29(
|
|
2154
2597
|
Page,
|
|
2155
2598
|
{
|
|
2156
2599
|
coId: page.coId,
|
|
@@ -2165,10 +2608,10 @@ function PageStack({
|
|
|
2165
2608
|
}
|
|
2166
2609
|
|
|
2167
2610
|
// src/inspector/viewer/use-page-path.ts
|
|
2168
|
-
import { useCallback, useEffect as
|
|
2611
|
+
import { useCallback, useEffect as useEffect7, useState as useState9 } from "react";
|
|
2169
2612
|
var STORAGE_KEY = "jazz-inspector-paths";
|
|
2170
2613
|
function usePagePath(defaultPath) {
|
|
2171
|
-
const [path, setPath] =
|
|
2614
|
+
const [path, setPath] = useState9(() => {
|
|
2172
2615
|
if (typeof window === "undefined") return [];
|
|
2173
2616
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
2174
2617
|
if (stored) {
|
|
@@ -2184,7 +2627,7 @@ function usePagePath(defaultPath) {
|
|
|
2184
2627
|
setPath(newPath);
|
|
2185
2628
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(newPath));
|
|
2186
2629
|
}, []);
|
|
2187
|
-
|
|
2630
|
+
useEffect7(() => {
|
|
2188
2631
|
if (defaultPath && JSON.stringify(path) !== JSON.stringify(defaultPath)) {
|
|
2189
2632
|
updatePath(defaultPath);
|
|
2190
2633
|
}
|
|
@@ -2222,8 +2665,8 @@ function usePagePath(defaultPath) {
|
|
|
2222
2665
|
}
|
|
2223
2666
|
|
|
2224
2667
|
// src/inspector/ui/global-styles.tsx
|
|
2225
|
-
import { styled as
|
|
2226
|
-
var GlobalStyles =
|
|
2668
|
+
import { styled as styled19 } from "goober";
|
|
2669
|
+
var GlobalStyles = styled19("div")`
|
|
2227
2670
|
/* Colors */
|
|
2228
2671
|
--j-primary-color: #146AFF;
|
|
2229
2672
|
--j-link-color: var(--j-primary-color);
|
|
@@ -2297,9 +2740,9 @@ var GlobalStyles = styled18("div")`
|
|
|
2297
2740
|
`;
|
|
2298
2741
|
|
|
2299
2742
|
// src/inspector/viewer/inspector-button.tsx
|
|
2300
|
-
import { styled as
|
|
2301
|
-
import { jsx as
|
|
2302
|
-
var StyledInspectorButton =
|
|
2743
|
+
import { styled as styled20 } from "goober";
|
|
2744
|
+
import { jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2745
|
+
var StyledInspectorButton = styled20("button")`
|
|
2303
2746
|
position: fixed;
|
|
2304
2747
|
width: 2.5rem;
|
|
2305
2748
|
height: 2.5rem;
|
|
@@ -2330,7 +2773,7 @@ var StyledInspectorButton = styled19("button")`
|
|
|
2330
2773
|
}
|
|
2331
2774
|
}}
|
|
2332
2775
|
`;
|
|
2333
|
-
var JazzIcon =
|
|
2776
|
+
var JazzIcon = styled20("svg")`
|
|
2334
2777
|
width: 100%;
|
|
2335
2778
|
height: auto;
|
|
2336
2779
|
position: relative;
|
|
@@ -2341,8 +2784,8 @@ function InspectorButton({
|
|
|
2341
2784
|
position = "right",
|
|
2342
2785
|
...buttonProps
|
|
2343
2786
|
}) {
|
|
2344
|
-
return /* @__PURE__ */
|
|
2345
|
-
/* @__PURE__ */
|
|
2787
|
+
return /* @__PURE__ */ jsxs20(StyledInspectorButton, { position, ...buttonProps, children: [
|
|
2788
|
+
/* @__PURE__ */ jsx30(
|
|
2346
2789
|
JazzIcon,
|
|
2347
2790
|
{
|
|
2348
2791
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2350,7 +2793,7 @@ function InspectorButton({
|
|
|
2350
2793
|
height: "115",
|
|
2351
2794
|
viewBox: "0 0 119 115",
|
|
2352
2795
|
fill: "none",
|
|
2353
|
-
children: /* @__PURE__ */
|
|
2796
|
+
children: /* @__PURE__ */ jsx30(
|
|
2354
2797
|
"path",
|
|
2355
2798
|
{
|
|
2356
2799
|
fillRule: "evenodd",
|
|
@@ -2361,7 +2804,7 @@ function InspectorButton({
|
|
|
2361
2804
|
)
|
|
2362
2805
|
}
|
|
2363
2806
|
),
|
|
2364
|
-
/* @__PURE__ */
|
|
2807
|
+
/* @__PURE__ */ jsx30(
|
|
2365
2808
|
"span",
|
|
2366
2809
|
{
|
|
2367
2810
|
style: {
|
|
@@ -2382,30 +2825,30 @@ function InspectorButton({
|
|
|
2382
2825
|
}
|
|
2383
2826
|
|
|
2384
2827
|
// src/inspector/viewer/use-open-inspector.ts
|
|
2385
|
-
import { useEffect as
|
|
2828
|
+
import { useEffect as useEffect8, useState as useState10 } from "react";
|
|
2386
2829
|
var STORAGE_KEY2 = "jazz-inspector-open";
|
|
2387
2830
|
function useOpenInspector() {
|
|
2388
|
-
const [open, setOpen] =
|
|
2831
|
+
const [open, setOpen] = useState10(() => {
|
|
2389
2832
|
if (typeof window === "undefined") return false;
|
|
2390
2833
|
const stored = localStorage.getItem(STORAGE_KEY2);
|
|
2391
2834
|
return stored ? JSON.parse(stored) : false;
|
|
2392
2835
|
});
|
|
2393
|
-
|
|
2836
|
+
useEffect8(() => {
|
|
2394
2837
|
localStorage.setItem(STORAGE_KEY2, JSON.stringify(open));
|
|
2395
2838
|
}, [open]);
|
|
2396
2839
|
return [open, setOpen];
|
|
2397
2840
|
}
|
|
2398
2841
|
|
|
2399
2842
|
// src/inspector/viewer/delete-local-data.tsx
|
|
2400
|
-
import { useState as
|
|
2401
|
-
import { Fragment as
|
|
2843
|
+
import { useState as useState11 } from "react";
|
|
2844
|
+
import { Fragment as Fragment13, jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2402
2845
|
var DELETE_LOCAL_DATA_STRING = "delete my local data";
|
|
2403
2846
|
function DeleteLocalData() {
|
|
2404
|
-
const [showDeleteModal, setShowDeleteModal] =
|
|
2405
|
-
const [confirmDeleteString, setConfirmDeleteString] =
|
|
2406
|
-
return /* @__PURE__ */
|
|
2407
|
-
/* @__PURE__ */
|
|
2408
|
-
/* @__PURE__ */
|
|
2847
|
+
const [showDeleteModal, setShowDeleteModal] = useState11(false);
|
|
2848
|
+
const [confirmDeleteString, setConfirmDeleteString] = useState11("");
|
|
2849
|
+
return /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
2850
|
+
/* @__PURE__ */ jsx31(Button, { variant: "destructive", onClick: () => setShowDeleteModal(true), children: "Delete my local data" }),
|
|
2851
|
+
/* @__PURE__ */ jsxs21(
|
|
2409
2852
|
Modal,
|
|
2410
2853
|
{
|
|
2411
2854
|
isOpen: showDeleteModal,
|
|
@@ -2413,7 +2856,7 @@ function DeleteLocalData() {
|
|
|
2413
2856
|
heading: "Delete Local Data",
|
|
2414
2857
|
showButtons: false,
|
|
2415
2858
|
children: [
|
|
2416
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ jsxs21(
|
|
2417
2860
|
"div",
|
|
2418
2861
|
{
|
|
2419
2862
|
style: {
|
|
@@ -2424,33 +2867,33 @@ function DeleteLocalData() {
|
|
|
2424
2867
|
gap: "0.5rem"
|
|
2425
2868
|
},
|
|
2426
2869
|
children: [
|
|
2427
|
-
/* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ jsxs21("p", { children: [
|
|
2428
2871
|
"This action ",
|
|
2429
|
-
/* @__PURE__ */
|
|
2872
|
+
/* @__PURE__ */ jsx31("strong", { children: "cannot" }),
|
|
2430
2873
|
" be undone."
|
|
2431
2874
|
] }),
|
|
2432
|
-
/* @__PURE__ */
|
|
2875
|
+
/* @__PURE__ */ jsxs21("p", { children: [
|
|
2433
2876
|
"Be aware that the following data will be",
|
|
2434
2877
|
" ",
|
|
2435
|
-
/* @__PURE__ */
|
|
2878
|
+
/* @__PURE__ */ jsx31("strong", { children: "permanently" }),
|
|
2436
2879
|
" deleted:"
|
|
2437
2880
|
] }),
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2881
|
+
/* @__PURE__ */ jsxs21("ul", { style: { listStyleType: "disc", paddingLeft: "1rem" }, children: [
|
|
2882
|
+
/* @__PURE__ */ jsxs21("li", { children: [
|
|
2440
2883
|
"Unsynced data for ",
|
|
2441
|
-
/* @__PURE__ */
|
|
2884
|
+
/* @__PURE__ */ jsx31("strong", { children: "all apps" }),
|
|
2442
2885
|
" on",
|
|
2443
2886
|
" ",
|
|
2444
|
-
/* @__PURE__ */
|
|
2887
|
+
/* @__PURE__ */ jsx31("code", { children: window.location.origin })
|
|
2445
2888
|
] }),
|
|
2446
|
-
/* @__PURE__ */
|
|
2447
|
-
/* @__PURE__ */
|
|
2889
|
+
/* @__PURE__ */ jsx31("li", { children: "Accounts" }),
|
|
2890
|
+
/* @__PURE__ */ jsx31("li", { children: "Logged in sessions" })
|
|
2448
2891
|
] }),
|
|
2449
|
-
/* @__PURE__ */
|
|
2892
|
+
/* @__PURE__ */ jsx31("p", {})
|
|
2450
2893
|
]
|
|
2451
2894
|
}
|
|
2452
2895
|
),
|
|
2453
|
-
/* @__PURE__ */
|
|
2896
|
+
/* @__PURE__ */ jsx31(
|
|
2454
2897
|
Input,
|
|
2455
2898
|
{
|
|
2456
2899
|
label: `Type "${DELETE_LOCAL_DATA_STRING}" to confirm`,
|
|
@@ -2461,7 +2904,7 @@ function DeleteLocalData() {
|
|
|
2461
2904
|
}
|
|
2462
2905
|
}
|
|
2463
2906
|
),
|
|
2464
|
-
/* @__PURE__ */
|
|
2907
|
+
/* @__PURE__ */ jsx31(
|
|
2465
2908
|
"p",
|
|
2466
2909
|
{
|
|
2467
2910
|
style: {
|
|
@@ -2471,14 +2914,14 @@ function DeleteLocalData() {
|
|
|
2471
2914
|
flexDirection: "column",
|
|
2472
2915
|
gap: "0.5rem"
|
|
2473
2916
|
},
|
|
2474
|
-
children: /* @__PURE__ */
|
|
2917
|
+
children: /* @__PURE__ */ jsxs21("small", { children: [
|
|
2475
2918
|
"Data synced to a sync server will ",
|
|
2476
|
-
/* @__PURE__ */
|
|
2919
|
+
/* @__PURE__ */ jsx31("strong", { children: "not" }),
|
|
2477
2920
|
" be deleted, and will be synced when you log in again."
|
|
2478
2921
|
] })
|
|
2479
2922
|
}
|
|
2480
2923
|
),
|
|
2481
|
-
/* @__PURE__ */
|
|
2924
|
+
/* @__PURE__ */ jsxs21(
|
|
2482
2925
|
"div",
|
|
2483
2926
|
{
|
|
2484
2927
|
style: {
|
|
@@ -2488,8 +2931,8 @@ function DeleteLocalData() {
|
|
|
2488
2931
|
gap: "0.5rem"
|
|
2489
2932
|
},
|
|
2490
2933
|
children: [
|
|
2491
|
-
/* @__PURE__ */
|
|
2492
|
-
/* @__PURE__ */
|
|
2934
|
+
/* @__PURE__ */ jsx31(Button, { variant: "secondary", onClick: () => setShowDeleteModal(false), children: "Cancel" }),
|
|
2935
|
+
/* @__PURE__ */ jsx31(
|
|
2493
2936
|
Button,
|
|
2494
2937
|
{
|
|
2495
2938
|
variant: "destructive",
|
|
@@ -2516,8 +2959,8 @@ function DeleteLocalData() {
|
|
|
2516
2959
|
}
|
|
2517
2960
|
|
|
2518
2961
|
// src/inspector/viewer/new-app.tsx
|
|
2519
|
-
import { Fragment as
|
|
2520
|
-
var InspectorContainer =
|
|
2962
|
+
import { Fragment as Fragment14, jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2963
|
+
var InspectorContainer = styled21("div")`
|
|
2521
2964
|
position: fixed;
|
|
2522
2965
|
height: 50vh;
|
|
2523
2966
|
max-height: 800px;
|
|
@@ -2534,17 +2977,17 @@ var InspectorContainer = styled20("div")`
|
|
|
2534
2977
|
background-color: var(--j-background);
|
|
2535
2978
|
}
|
|
2536
2979
|
`;
|
|
2537
|
-
var HeaderContainer2 =
|
|
2980
|
+
var HeaderContainer2 = styled21("div")`
|
|
2538
2981
|
display: flex;
|
|
2539
2982
|
align-items: center;
|
|
2540
2983
|
gap: 1rem;
|
|
2541
2984
|
padding: 0 0.75rem;
|
|
2542
2985
|
margin: 0.75rem 0;
|
|
2543
2986
|
`;
|
|
2544
|
-
var Form =
|
|
2987
|
+
var Form = styled21("form")`
|
|
2545
2988
|
width: 24rem;
|
|
2546
2989
|
`;
|
|
2547
|
-
var InitialForm =
|
|
2990
|
+
var InitialForm = styled21("form")`
|
|
2548
2991
|
display: flex;
|
|
2549
2992
|
flex-direction: column;
|
|
2550
2993
|
position: relative;
|
|
@@ -2556,7 +2999,7 @@ var InitialForm = styled20("form")`
|
|
|
2556
2999
|
max-width: 24rem;
|
|
2557
3000
|
margin: 0 auto;
|
|
2558
3001
|
`;
|
|
2559
|
-
var OrText =
|
|
3002
|
+
var OrText = styled21("p")`
|
|
2560
3003
|
text-align: center;
|
|
2561
3004
|
`;
|
|
2562
3005
|
function JazzInspectorInternal({
|
|
@@ -2565,7 +3008,7 @@ function JazzInspectorInternal({
|
|
|
2565
3008
|
accountId
|
|
2566
3009
|
}) {
|
|
2567
3010
|
const [open, setOpen] = useOpenInspector();
|
|
2568
|
-
const [coValueId, setCoValueId] =
|
|
3011
|
+
const [coValueId, setCoValueId] = useState12("");
|
|
2569
3012
|
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
|
2570
3013
|
const handleCoValueIdSubmit = (e) => {
|
|
2571
3014
|
e.preventDefault();
|
|
@@ -2575,12 +3018,12 @@ function JazzInspectorInternal({
|
|
|
2575
3018
|
setCoValueId("");
|
|
2576
3019
|
};
|
|
2577
3020
|
if (!open) {
|
|
2578
|
-
return /* @__PURE__ */
|
|
3021
|
+
return /* @__PURE__ */ jsx32(InspectorButton, { position, onClick: () => setOpen(true) });
|
|
2579
3022
|
}
|
|
2580
|
-
return /* @__PURE__ */
|
|
2581
|
-
/* @__PURE__ */
|
|
2582
|
-
/* @__PURE__ */
|
|
2583
|
-
path.length !== 0 && /* @__PURE__ */
|
|
3023
|
+
return /* @__PURE__ */ jsxs22(InspectorContainer, { as: GlobalStyles, style: { zIndex: 999 }, children: [
|
|
3024
|
+
/* @__PURE__ */ jsxs22(HeaderContainer2, { children: [
|
|
3025
|
+
/* @__PURE__ */ jsx32(Breadcrumbs, { path, onBreadcrumbClick: goToIndex }),
|
|
3026
|
+
path.length !== 0 && /* @__PURE__ */ jsx32(Form, { onSubmit: handleCoValueIdSubmit, children: /* @__PURE__ */ jsx32(
|
|
2584
3027
|
Input,
|
|
2585
3028
|
{
|
|
2586
3029
|
label: "CoValue ID",
|
|
@@ -2591,24 +3034,24 @@ function JazzInspectorInternal({
|
|
|
2591
3034
|
onChange: (e) => setCoValueId(e.target.value)
|
|
2592
3035
|
}
|
|
2593
3036
|
) }),
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
3037
|
+
/* @__PURE__ */ jsx32(DeleteLocalData, {}),
|
|
3038
|
+
/* @__PURE__ */ jsx32(Button, { variant: "plain", type: "button", onClick: () => setOpen(false), children: "Close" })
|
|
2596
3039
|
] }),
|
|
2597
|
-
/* @__PURE__ */
|
|
3040
|
+
/* @__PURE__ */ jsx32(
|
|
2598
3041
|
PageStack,
|
|
2599
3042
|
{
|
|
2600
3043
|
path,
|
|
2601
3044
|
node: localNode,
|
|
2602
3045
|
goBack,
|
|
2603
3046
|
addPages,
|
|
2604
|
-
children: path.length <= 0 && /* @__PURE__ */
|
|
3047
|
+
children: path.length <= 0 && /* @__PURE__ */ jsxs22(
|
|
2605
3048
|
InitialForm,
|
|
2606
3049
|
{
|
|
2607
3050
|
onSubmit: handleCoValueIdSubmit,
|
|
2608
3051
|
"aria-hidden": path.length !== 0,
|
|
2609
3052
|
children: [
|
|
2610
|
-
/* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */
|
|
3053
|
+
/* @__PURE__ */ jsx32(Heading, { children: "Jazz CoValue Inspector" }),
|
|
3054
|
+
/* @__PURE__ */ jsx32(
|
|
2612
3055
|
Input,
|
|
2613
3056
|
{
|
|
2614
3057
|
label: "CoValue ID",
|
|
@@ -2619,10 +3062,10 @@ function JazzInspectorInternal({
|
|
|
2619
3062
|
onChange: (e) => setCoValueId(e.target.value)
|
|
2620
3063
|
}
|
|
2621
3064
|
),
|
|
2622
|
-
/* @__PURE__ */
|
|
2623
|
-
accountId && /* @__PURE__ */
|
|
2624
|
-
/* @__PURE__ */
|
|
2625
|
-
/* @__PURE__ */
|
|
3065
|
+
/* @__PURE__ */ jsx32(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
|
|
3066
|
+
accountId && /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
3067
|
+
/* @__PURE__ */ jsx32(OrText, { children: "or" }),
|
|
3068
|
+
/* @__PURE__ */ jsx32(
|
|
2626
3069
|
Button,
|
|
2627
3070
|
{
|
|
2628
3071
|
variant: "secondary",
|
|
@@ -2645,12 +3088,12 @@ function JazzInspectorInternal({
|
|
|
2645
3088
|
// src/inspector/index.tsx
|
|
2646
3089
|
import { setup } from "goober";
|
|
2647
3090
|
import { useJazzContext } from "jazz-tools/react-core";
|
|
2648
|
-
import { jsx as
|
|
3091
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
2649
3092
|
function JazzInspector({ position = "right" }) {
|
|
2650
3093
|
const context = useJazzContext();
|
|
2651
3094
|
const localNode = context.node;
|
|
2652
3095
|
const me = "me" in context ? context.me : void 0;
|
|
2653
|
-
return /* @__PURE__ */
|
|
3096
|
+
return /* @__PURE__ */ jsx33(
|
|
2654
3097
|
JazzInspectorInternal,
|
|
2655
3098
|
{
|
|
2656
3099
|
position,
|