jazz-tools 0.17.11 → 0.17.13
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 +38 -38
- package/CHANGELOG.md +24 -0
- package/dist/expo/auth/clerk/index.d.ts.map +1 -1
- package/dist/expo/index.js +6 -2
- package/dist/expo/index.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/inspector/{custom-element-I7L56H6B.js → custom-element-ZSNTCECD.js} +50 -9
- package/dist/inspector/{custom-element-I7L56H6B.js.map → custom-element-ZSNTCECD.js.map} +1 -1
- package/dist/inspector/index.js +49 -8
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/register-custom-element.js +1 -1
- package/dist/inspector/viewer/page.d.ts.map +1 -1
- package/dist/inspector/viewer/table-viewer.d.ts +2 -1
- package/dist/inspector/viewer/table-viewer.d.ts.map +1 -1
- package/dist/react/auth/Clerk.d.ts.map +1 -1
- package/dist/react/index.js +6 -2
- package/dist/react/index.js.map +1 -1
- package/dist/tools/auth/clerk/index.d.ts +2 -1
- package/dist/tools/auth/clerk/index.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/expo/auth/clerk/index.tsx +6 -2
- package/src/inspector/viewer/page.tsx +30 -2
- package/src/inspector/viewer/table-viewer.tsx +26 -1
- package/src/react/auth/Clerk.tsx +6 -2
- package/src/react-core/tests/useCoState.test.ts +1 -1
- package/src/tools/auth/clerk/index.ts +2 -0
- package/src/tools/auth/clerk/tests/JazzClerkAuth.test.ts +56 -6
- package/src/tools/tests/coMap.test.ts +10 -6
- package/src/tools/tests/exportImport.test.ts +6 -6
- package/src/tools/tests/load.test.ts +6 -4
- package/src/tools/tests/subscribe.test.ts +10 -6
package/dist/inspector/index.js
CHANGED
@@ -1348,7 +1348,8 @@ var PaginationContainer = styled13("div")`
|
|
1348
1348
|
function CoValuesTableView({
|
1349
1349
|
data,
|
1350
1350
|
node,
|
1351
|
-
onNavigate
|
1351
|
+
onNavigate,
|
1352
|
+
onRemove
|
1352
1353
|
}) {
|
1353
1354
|
const [visibleRowsCount, setVisibleRowsCount] = useState6(10);
|
1354
1355
|
const [coIdArray, visibleRows] = useMemo(() => {
|
@@ -1372,7 +1373,10 @@ function CoValuesTableView({
|
|
1372
1373
|
};
|
1373
1374
|
return /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
1374
1375
|
/* @__PURE__ */ jsxs12(Table, { children: [
|
1375
|
-
/* @__PURE__ */ jsx22(TableHead, { children: /* @__PURE__ */
|
1376
|
+
/* @__PURE__ */ jsx22(TableHead, { children: /* @__PURE__ */ jsxs12(TableRow, { children: [
|
1377
|
+
[...keys, "Action"].map((key) => /* @__PURE__ */ jsx22(TableHeader, { children: key }, key)),
|
1378
|
+
onRemove && /* @__PURE__ */ jsx22(TableHeader, {})
|
1379
|
+
] }) }),
|
1376
1380
|
/* @__PURE__ */ jsx22(TableBody, { children: resolvedRows.slice(0, visibleRowsCount).map((item, index) => /* @__PURE__ */ jsxs12(TableRow, { children: [
|
1377
1381
|
keys.map((key) => /* @__PURE__ */ jsx22(TableCell, { children: /* @__PURE__ */ jsx22(
|
1378
1382
|
ValueRenderer,
|
@@ -1407,7 +1411,8 @@ function CoValuesTableView({
|
|
1407
1411
|
]),
|
1408
1412
|
children: "View"
|
1409
1413
|
}
|
1410
|
-
) })
|
1414
|
+
) }),
|
1415
|
+
onRemove && /* @__PURE__ */ jsx22(TableCell, { children: /* @__PURE__ */ jsx22(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
1411
1416
|
] }, index)) })
|
1412
1417
|
] }),
|
1413
1418
|
/* @__PURE__ */ jsxs12(PaginationContainer, { children: [
|
@@ -1425,22 +1430,33 @@ function CoValuesTableView({
|
|
1425
1430
|
function TableView({
|
1426
1431
|
data,
|
1427
1432
|
node,
|
1428
|
-
onNavigate
|
1433
|
+
onNavigate,
|
1434
|
+
onRemove
|
1429
1435
|
}) {
|
1430
1436
|
const isListOfCoValues = useMemo(() => {
|
1431
1437
|
return Array.isArray(data) && data.every((k) => isCoId(k));
|
1432
1438
|
}, [data]);
|
1433
1439
|
if (isListOfCoValues) {
|
1434
|
-
return /* @__PURE__ */ jsx22(
|
1440
|
+
return /* @__PURE__ */ jsx22(
|
1441
|
+
CoValuesTableView,
|
1442
|
+
{
|
1443
|
+
data,
|
1444
|
+
node,
|
1445
|
+
onNavigate,
|
1446
|
+
onRemove
|
1447
|
+
}
|
1448
|
+
);
|
1435
1449
|
}
|
1436
1450
|
return /* @__PURE__ */ jsxs12(Table, { children: [
|
1437
1451
|
/* @__PURE__ */ jsx22(TableHead, { children: /* @__PURE__ */ jsxs12(TableRow, { children: [
|
1438
1452
|
/* @__PURE__ */ jsx22(TableHeader, { style: { width: "5rem" }, children: "Index" }),
|
1439
|
-
/* @__PURE__ */ jsx22(TableHeader, { children: "Value" })
|
1453
|
+
/* @__PURE__ */ jsx22(TableHeader, { children: "Value" }),
|
1454
|
+
onRemove && /* @__PURE__ */ jsx22(TableHeader, { children: "Action" })
|
1440
1455
|
] }) }),
|
1441
1456
|
/* @__PURE__ */ jsx22(TableBody, { children: Array.isArray(data) && data?.map((value, index) => /* @__PURE__ */ jsxs12(TableRow, { children: [
|
1442
1457
|
/* @__PURE__ */ jsx22(TableCell, { children: /* @__PURE__ */ jsx22(Text, { mono: true, children: index }) }),
|
1443
|
-
/* @__PURE__ */ jsx22(TableCell, { children: /* @__PURE__ */ jsx22(ValueRenderer, { json: value }) })
|
1458
|
+
/* @__PURE__ */ jsx22(TableCell, { children: /* @__PURE__ */ jsx22(ValueRenderer, { json: value }) }),
|
1459
|
+
onRemove && /* @__PURE__ */ jsx22(TableCell, { children: /* @__PURE__ */ jsx22(Button, { variant: "secondary", onClick: () => onRemove(index), children: "Remove" }) })
|
1444
1460
|
] }, index)) })
|
1445
1461
|
] });
|
1446
1462
|
}
|
@@ -1494,6 +1510,14 @@ var ContentContainer = styled14("div")`
|
|
1494
1510
|
gap: 1rem;
|
1495
1511
|
padding-bottom: 2rem;
|
1496
1512
|
`;
|
1513
|
+
function canEdit(value) {
|
1514
|
+
try {
|
1515
|
+
const myRole = value.group.myRole();
|
1516
|
+
return myRole === "writer" || myRole === "admin";
|
1517
|
+
} catch (e) {
|
1518
|
+
return false;
|
1519
|
+
}
|
1520
|
+
}
|
1497
1521
|
function View(props) {
|
1498
1522
|
const { type, extendedType } = props.coValue;
|
1499
1523
|
const { snapshot, value } = props.coValue;
|
@@ -1519,7 +1543,24 @@ function View(props) {
|
|
1519
1543
|
if (type === "coplaintext") {
|
1520
1544
|
return /* @__PURE__ */ jsx23(CoPlainTextView, { data: snapshot });
|
1521
1545
|
}
|
1522
|
-
if (type === "colist"
|
1546
|
+
if (type === "colist") {
|
1547
|
+
const handleRemove = (index) => {
|
1548
|
+
if (confirm("Are you sure you want to remove this item?")) {
|
1549
|
+
const list = value;
|
1550
|
+
list.delete(index);
|
1551
|
+
}
|
1552
|
+
};
|
1553
|
+
return /* @__PURE__ */ jsx23(
|
1554
|
+
TableView,
|
1555
|
+
{
|
1556
|
+
data: snapshot,
|
1557
|
+
node,
|
1558
|
+
onNavigate,
|
1559
|
+
onRemove: canEdit(value) ? handleRemove : void 0
|
1560
|
+
}
|
1561
|
+
);
|
1562
|
+
}
|
1563
|
+
if (extendedType === "record") {
|
1523
1564
|
return /* @__PURE__ */ jsx23(TableView, { data: snapshot, node, onNavigate });
|
1524
1565
|
}
|
1525
1566
|
return /* @__PURE__ */ jsx23(GridView, { data: snapshot, onNavigate, node });
|