jazz-tools 0.15.0 → 0.15.2
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 +47 -47
- package/CHANGELOG.md +23 -0
- package/dist/{chunk-FSIM7N33.js → chunk-VBDJM6Z5.js} +142 -31
- package/dist/chunk-VBDJM6Z5.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspector/index.js +147 -102
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/viewer/co-plain-text-view.d.ts +5 -0
- package/dist/inspector/viewer/co-plain-text-view.d.ts.map +1 -0
- package/dist/inspector/viewer/new-app.d.ts.map +1 -1
- package/dist/inspector/viewer/page.d.ts.map +1 -1
- package/dist/inspector/viewer/type-icon.d.ts.map +1 -1
- package/dist/inspector/viewer/use-open-inspector.d.ts +2 -0
- package/dist/inspector/viewer/use-open-inspector.d.ts.map +1 -0
- package/dist/inspector/viewer/use-page-path.d.ts.map +1 -1
- package/dist/inspector/viewer/use-resolve-covalue.d.ts +1 -1
- package/dist/inspector/viewer/use-resolve-covalue.d.ts.map +1 -1
- package/dist/inspector/viewer/value-renderer.d.ts.map +1 -1
- package/dist/react-native-core/index.js +2 -18
- package/dist/react-native-core/index.js.map +1 -1
- package/dist/react-native-core/media.d.ts.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/tools/coValues/coFeed.d.ts +9 -0
- package/dist/tools/coValues/coFeed.d.ts.map +1 -1
- package/dist/tools/coValues/coMap.d.ts +98 -2
- package/dist/tools/coValues/coMap.d.ts.map +1 -1
- package/dist/tools/coValues/interfaces.d.ts +3 -0
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +12 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/tools/subscribe/CoValueCoreSubscription.d.ts +2 -1
- package/dist/tools/subscribe/CoValueCoreSubscription.d.ts.map +1 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts +2 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/inspector/viewer/co-plain-text-view.tsx +17 -0
- package/src/inspector/viewer/new-app.tsx +2 -1
- package/src/inspector/viewer/page.tsx +5 -0
- package/src/inspector/viewer/type-icon.tsx +1 -0
- package/src/inspector/viewer/use-open-inspector.ts +18 -0
- package/src/inspector/viewer/use-page-path.ts +14 -1
- package/src/inspector/viewer/use-resolve-covalue.ts +1 -1
- package/src/inspector/viewer/value-renderer.tsx +4 -0
- package/src/react-native-core/media.tsx +2 -22
- package/src/tools/coValues/coFeed.ts +38 -0
- package/src/tools/coValues/coMap.ts +118 -14
- package/src/tools/coValues/interfaces.ts +14 -4
- package/src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts +38 -0
- package/src/tools/implementation/zodSchema/zodCo.ts +6 -0
- package/src/tools/subscribe/CoValueCoreSubscription.ts +12 -9
- package/src/tools/subscribe/SubscriptionScope.ts +31 -19
- package/src/tools/tests/coFeed.test.ts +69 -0
- package/src/tools/tests/coMap.test.ts +480 -4
- package/src/tools/tests/load.test.ts +2 -1
- package/dist/chunk-FSIM7N33.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/inspector/index.js
CHANGED
@@ -6,7 +6,7 @@ import React7 from "react";
|
|
6
6
|
// src/inspector/viewer/new-app.tsx
|
7
7
|
import { styled as styled18 } from "goober";
|
8
8
|
import { useJazzContext } from "jazz-tools/react-core";
|
9
|
-
import { useState as
|
9
|
+
import { useState as useState9 } from "react";
|
10
10
|
|
11
11
|
// src/inspector/ui/button.tsx
|
12
12
|
import { styled } from "goober";
|
@@ -685,7 +685,8 @@ var TypeIcon = ({
|
|
685
685
|
colist: "\u2630 CoList",
|
686
686
|
account: "\u{1F464} Account",
|
687
687
|
group: "\u{1F465} Group",
|
688
|
-
file: "\u{1F4C3} FileStream"
|
688
|
+
file: "\u{1F4C3} FileStream",
|
689
|
+
coplaintext: "\u{1F4C4} CoPlainText"
|
689
690
|
};
|
690
691
|
const iconKey = extendedType || type;
|
691
692
|
const icon2 = iconMap[iconKey];
|
@@ -982,6 +983,9 @@ var CoMapPreview = ({
|
|
982
983
|
if (snapshot === "unavailable" && !value) {
|
983
984
|
return /* @__PURE__ */ jsx14(Text, { inline: true, muted: true, children: "Unavailable" });
|
984
985
|
}
|
986
|
+
if (type === "coplaintext") {
|
987
|
+
return /* @__PURE__ */ jsx14(Fragment3, { children: value.toString() });
|
988
|
+
}
|
985
989
|
if (extendedType === "image" && isBrowserImage(snapshot)) {
|
986
990
|
return /* @__PURE__ */ jsxs5(ImagePreviewContainer2, { children: [
|
987
991
|
/* @__PURE__ */ jsx14(PreviewImage, { src: snapshot.placeholderDataURL }),
|
@@ -1213,10 +1217,22 @@ function AccountView({
|
|
1213
1217
|
] });
|
1214
1218
|
}
|
1215
1219
|
|
1220
|
+
// src/inspector/viewer/co-plain-text-view.tsx
|
1221
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
|
1222
|
+
function CoPlainTextView({
|
1223
|
+
data
|
1224
|
+
}) {
|
1225
|
+
if (!data) return;
|
1226
|
+
return /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
1227
|
+
/* @__PURE__ */ jsx19("p", { children: Object.values(data).join("") }),
|
1228
|
+
/* @__PURE__ */ jsx19(RawDataCard, { data })
|
1229
|
+
] });
|
1230
|
+
}
|
1231
|
+
|
1216
1232
|
// src/inspector/ui/table.tsx
|
1217
1233
|
import { styled as styled12 } from "goober";
|
1218
1234
|
import React4 from "react";
|
1219
|
-
import { jsx as
|
1235
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
1220
1236
|
var StyledTable = styled12("table")`
|
1221
1237
|
width: 100%;
|
1222
1238
|
`;
|
@@ -1246,35 +1262,35 @@ var StyledTh = styled12("th")`
|
|
1246
1262
|
var StyledTd = styled12("td")`
|
1247
1263
|
padding: 0.5rem 0.75rem;
|
1248
1264
|
`;
|
1249
|
-
var Table = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
1250
|
-
var TableHead = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
1251
|
-
var TableBody = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
1252
|
-
var TableRow = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
1253
|
-
var TableHeader = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
1254
|
-
var TableCell = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */
|
1265
|
+
var Table = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx20(StyledTable, { ref, ...props, children }));
|
1266
|
+
var TableHead = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx20(StyledThead, { ref, ...props, children }));
|
1267
|
+
var TableBody = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx20(StyledTbody, { ref, ...props, children }));
|
1268
|
+
var TableRow = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx20("tr", { ref, ...props, children }));
|
1269
|
+
var TableHeader = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx20(StyledTh, { ref, ...props, children }));
|
1270
|
+
var TableCell = React4.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx20(StyledTd, { ref, ...props, children }));
|
1255
1271
|
|
1256
1272
|
// src/inspector/viewer/group-view.tsx
|
1257
|
-
import { Fragment as
|
1273
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
1258
1274
|
function GroupView({
|
1259
1275
|
data,
|
1260
1276
|
onNavigate,
|
1261
1277
|
node
|
1262
1278
|
}) {
|
1263
|
-
return /* @__PURE__ */
|
1264
|
-
/* @__PURE__ */
|
1265
|
-
/* @__PURE__ */
|
1266
|
-
/* @__PURE__ */
|
1267
|
-
/* @__PURE__ */
|
1268
|
-
/* @__PURE__ */
|
1279
|
+
return /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
1280
|
+
/* @__PURE__ */ jsx21(Text, { strong: true, children: "Members" }),
|
1281
|
+
/* @__PURE__ */ jsxs10(Table, { children: [
|
1282
|
+
/* @__PURE__ */ jsx21(TableHead, { children: /* @__PURE__ */ jsxs10(TableRow, { children: [
|
1283
|
+
/* @__PURE__ */ jsx21(TableHeader, { children: "Account" }),
|
1284
|
+
/* @__PURE__ */ jsx21(TableHeader, { children: "Permission" })
|
1269
1285
|
] }) }),
|
1270
|
-
/* @__PURE__ */
|
1271
|
-
"everyone" in data && typeof data.everyone === "string" ? /* @__PURE__ */
|
1272
|
-
/* @__PURE__ */
|
1273
|
-
/* @__PURE__ */
|
1286
|
+
/* @__PURE__ */ jsxs10(TableBody, { children: [
|
1287
|
+
"everyone" in data && typeof data.everyone === "string" ? /* @__PURE__ */ jsxs10(TableRow, { children: [
|
1288
|
+
/* @__PURE__ */ jsx21(TableCell, { children: "everyone" }),
|
1289
|
+
/* @__PURE__ */ jsx21(TableCell, { children: data.everyone })
|
1274
1290
|
] }) : null,
|
1275
1291
|
Object.entries(data).map(
|
1276
|
-
([key, value]) => isCoId(key) ? /* @__PURE__ */
|
1277
|
-
/* @__PURE__ */
|
1292
|
+
([key, value]) => isCoId(key) ? /* @__PURE__ */ jsxs10(TableRow, { children: [
|
1293
|
+
/* @__PURE__ */ jsx21(TableCell, { children: /* @__PURE__ */ jsx21(
|
1278
1294
|
AccountOrGroupText,
|
1279
1295
|
{
|
1280
1296
|
coId: key,
|
@@ -1285,17 +1301,17 @@ function GroupView({
|
|
1285
1301
|
}
|
1286
1302
|
}
|
1287
1303
|
) }),
|
1288
|
-
/* @__PURE__ */
|
1304
|
+
/* @__PURE__ */ jsx21(TableCell, { children: value })
|
1289
1305
|
] }, key) : null
|
1290
1306
|
)
|
1291
1307
|
] })
|
1292
1308
|
] }),
|
1293
|
-
/* @__PURE__ */
|
1309
|
+
/* @__PURE__ */ jsx21(RawDataCard, { data })
|
1294
1310
|
] });
|
1295
1311
|
}
|
1296
1312
|
|
1297
1313
|
// src/inspector/viewer/role-display.tsx
|
1298
|
-
import { jsxs as
|
1314
|
+
import { jsxs as jsxs11 } from "react/jsx-runtime";
|
1299
1315
|
function RoleDisplay({
|
1300
1316
|
node,
|
1301
1317
|
value
|
@@ -1314,7 +1330,7 @@ function RoleDisplay({
|
|
1314
1330
|
} else {
|
1315
1331
|
role = "unauthorized";
|
1316
1332
|
}
|
1317
|
-
return /* @__PURE__ */
|
1333
|
+
return /* @__PURE__ */ jsxs11(Text, { children: [
|
1318
1334
|
"Role: ",
|
1319
1335
|
role
|
1320
1336
|
] });
|
@@ -1323,7 +1339,7 @@ function RoleDisplay({
|
|
1323
1339
|
// src/inspector/viewer/table-viewer.tsx
|
1324
1340
|
import { styled as styled13 } from "goober";
|
1325
1341
|
import { useMemo, useState as useState6 } from "react";
|
1326
|
-
import { Fragment as
|
1342
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
1327
1343
|
var PaginationContainer = styled13("div")`
|
1328
1344
|
padding: 1rem 0;
|
1329
1345
|
display: flex;
|
@@ -1345,10 +1361,10 @@ function CoValuesTableView({
|
|
1345
1361
|
const resolvedRows = useResolvedCoValues(visibleRows, node);
|
1346
1362
|
const hasMore = visibleRowsCount < coIdArray.length;
|
1347
1363
|
if (!coIdArray.length) {
|
1348
|
-
return /* @__PURE__ */
|
1364
|
+
return /* @__PURE__ */ jsx22("div", { children: "No data to display" });
|
1349
1365
|
}
|
1350
1366
|
if (resolvedRows.length === 0) {
|
1351
|
-
return /* @__PURE__ */
|
1367
|
+
return /* @__PURE__ */ jsx22("div", { children: "Loading..." });
|
1352
1368
|
}
|
1353
1369
|
const keys = Array.from(
|
1354
1370
|
new Set(resolvedRows.flatMap((item) => Object.keys(item.snapshot || {})))
|
@@ -1356,11 +1372,11 @@ function CoValuesTableView({
|
|
1356
1372
|
const loadMore = () => {
|
1357
1373
|
setVisibleRowsCount((prevVisibleRows) => prevVisibleRows + 10);
|
1358
1374
|
};
|
1359
|
-
return /* @__PURE__ */
|
1360
|
-
/* @__PURE__ */
|
1361
|
-
/* @__PURE__ */
|
1362
|
-
/* @__PURE__ */
|
1363
|
-
keys.map((key) => /* @__PURE__ */
|
1375
|
+
return /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
1376
|
+
/* @__PURE__ */ jsxs12(Table, { children: [
|
1377
|
+
/* @__PURE__ */ jsx22(TableHead, { children: /* @__PURE__ */ jsx22(TableRow, { children: [...keys, "Action"].map((key) => /* @__PURE__ */ jsx22(TableHeader, { children: key }, key)) }) }),
|
1378
|
+
/* @__PURE__ */ jsx22(TableBody, { children: resolvedRows.slice(0, visibleRowsCount).map((item, index) => /* @__PURE__ */ jsxs12(TableRow, { children: [
|
1379
|
+
keys.map((key) => /* @__PURE__ */ jsx22(TableCell, { children: /* @__PURE__ */ jsx22(
|
1364
1380
|
ValueRenderer,
|
1365
1381
|
{
|
1366
1382
|
json: item.snapshot[key],
|
@@ -1381,7 +1397,7 @@ function CoValuesTableView({
|
|
1381
1397
|
}
|
1382
1398
|
}
|
1383
1399
|
) }, key)),
|
1384
|
-
/* @__PURE__ */
|
1400
|
+
/* @__PURE__ */ jsx22(TableCell, { children: /* @__PURE__ */ jsx22(
|
1385
1401
|
Button,
|
1386
1402
|
{
|
1387
1403
|
variant: "secondary",
|
@@ -1396,15 +1412,15 @@ function CoValuesTableView({
|
|
1396
1412
|
) })
|
1397
1413
|
] }, index)) })
|
1398
1414
|
] }),
|
1399
|
-
/* @__PURE__ */
|
1400
|
-
/* @__PURE__ */
|
1415
|
+
/* @__PURE__ */ jsxs12(PaginationContainer, { children: [
|
1416
|
+
/* @__PURE__ */ jsxs12(Text, { muted: true, small: true, children: [
|
1401
1417
|
"Showing ",
|
1402
1418
|
Math.min(visibleRowsCount, coIdArray.length),
|
1403
1419
|
" of",
|
1404
1420
|
" ",
|
1405
1421
|
coIdArray.length
|
1406
1422
|
] }),
|
1407
|
-
hasMore && /* @__PURE__ */
|
1423
|
+
hasMore && /* @__PURE__ */ jsx22(Button, { variant: "secondary", onClick: loadMore, children: "Load more" })
|
1408
1424
|
] })
|
1409
1425
|
] });
|
1410
1426
|
}
|
@@ -1417,24 +1433,24 @@ function TableView({
|
|
1417
1433
|
return Array.isArray(data) && data.every((k) => isCoId(k));
|
1418
1434
|
}, [data]);
|
1419
1435
|
if (isListOfCoValues) {
|
1420
|
-
return /* @__PURE__ */
|
1436
|
+
return /* @__PURE__ */ jsx22(CoValuesTableView, { data, node, onNavigate });
|
1421
1437
|
}
|
1422
|
-
return /* @__PURE__ */
|
1423
|
-
/* @__PURE__ */
|
1424
|
-
/* @__PURE__ */
|
1425
|
-
/* @__PURE__ */
|
1438
|
+
return /* @__PURE__ */ jsxs12(Table, { children: [
|
1439
|
+
/* @__PURE__ */ jsx22(TableHead, { children: /* @__PURE__ */ jsxs12(TableRow, { children: [
|
1440
|
+
/* @__PURE__ */ jsx22(TableHeader, { style: { width: "5rem" }, children: "Index" }),
|
1441
|
+
/* @__PURE__ */ jsx22(TableHeader, { children: "Value" })
|
1426
1442
|
] }) }),
|
1427
|
-
/* @__PURE__ */
|
1428
|
-
/* @__PURE__ */
|
1429
|
-
/* @__PURE__ */
|
1443
|
+
/* @__PURE__ */ jsx22(TableBody, { children: Array.isArray(data) && data?.map((value, index) => /* @__PURE__ */ jsxs12(TableRow, { children: [
|
1444
|
+
/* @__PURE__ */ jsx22(TableCell, { children: /* @__PURE__ */ jsx22(Text, { mono: true, children: index }) }),
|
1445
|
+
/* @__PURE__ */ jsx22(TableCell, { children: /* @__PURE__ */ jsx22(ValueRenderer, { json: value }) })
|
1430
1446
|
] }, index)) })
|
1431
1447
|
] });
|
1432
1448
|
}
|
1433
1449
|
|
1434
1450
|
// src/inspector/viewer/page.tsx
|
1435
|
-
import { Fragment as
|
1451
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
1436
1452
|
var BasePageContainer = React5.forwardRef(
|
1437
|
-
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */
|
1453
|
+
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ jsx23("div", { ref, ...rest })
|
1438
1454
|
);
|
1439
1455
|
var PageContainer = styled14(BasePageContainer)`
|
1440
1456
|
position: absolute;
|
@@ -1486,7 +1502,7 @@ function View(props) {
|
|
1486
1502
|
const { node, onNavigate } = props;
|
1487
1503
|
if (!snapshot || snapshot === "unavailable") return;
|
1488
1504
|
if (type === "costream") {
|
1489
|
-
return /* @__PURE__ */
|
1505
|
+
return /* @__PURE__ */ jsx23(
|
1490
1506
|
CoStreamView,
|
1491
1507
|
{
|
1492
1508
|
data: snapshot,
|
@@ -1497,15 +1513,18 @@ function View(props) {
|
|
1497
1513
|
);
|
1498
1514
|
}
|
1499
1515
|
if (extendedType === "group") {
|
1500
|
-
return /* @__PURE__ */
|
1516
|
+
return /* @__PURE__ */ jsx23(GroupView, { data: snapshot, node, onNavigate });
|
1501
1517
|
}
|
1502
1518
|
if (extendedType === "account") {
|
1503
|
-
return /* @__PURE__ */
|
1519
|
+
return /* @__PURE__ */ jsx23(AccountView, { data: snapshot, node, onNavigate });
|
1520
|
+
}
|
1521
|
+
if (type === "coplaintext") {
|
1522
|
+
return /* @__PURE__ */ jsx23(CoPlainTextView, { data: snapshot });
|
1504
1523
|
}
|
1505
1524
|
if (type === "colist" || extendedType === "record") {
|
1506
|
-
return /* @__PURE__ */
|
1525
|
+
return /* @__PURE__ */ jsx23(TableView, { data: snapshot, node, onNavigate });
|
1507
1526
|
}
|
1508
|
-
return /* @__PURE__ */
|
1527
|
+
return /* @__PURE__ */ jsx23(GridView, { data: snapshot, onNavigate, node });
|
1509
1528
|
}
|
1510
1529
|
function Page(props) {
|
1511
1530
|
const {
|
@@ -1521,13 +1540,13 @@ function Page(props) {
|
|
1521
1540
|
const coValue = useResolvedCoValue(coId, node);
|
1522
1541
|
const { value, snapshot, type, extendedType } = coValue;
|
1523
1542
|
if (snapshot === "unavailable") {
|
1524
|
-
return /* @__PURE__ */
|
1543
|
+
return /* @__PURE__ */ jsx23("div", { style, children: "Data unavailable" });
|
1525
1544
|
}
|
1526
1545
|
if (!snapshot) {
|
1527
|
-
return /* @__PURE__ */
|
1546
|
+
return /* @__PURE__ */ jsx23("div", { style });
|
1528
1547
|
}
|
1529
|
-
return /* @__PURE__ */
|
1530
|
-
!isTopLevel && /* @__PURE__ */
|
1548
|
+
return /* @__PURE__ */ jsxs13(PageContainer, { style, className, isTopLevel, children: [
|
1549
|
+
!isTopLevel && /* @__PURE__ */ jsx23(
|
1531
1550
|
BackButton,
|
1532
1551
|
{
|
1533
1552
|
"aria-label": "Back",
|
@@ -1537,27 +1556,27 @@ function Page(props) {
|
|
1537
1556
|
"aria-hidden": "true"
|
1538
1557
|
}
|
1539
1558
|
),
|
1540
|
-
/* @__PURE__ */
|
1541
|
-
/* @__PURE__ */
|
1559
|
+
/* @__PURE__ */ jsx23(HeaderContainer, { children: /* @__PURE__ */ jsxs13(TitleContainer, { children: [
|
1560
|
+
/* @__PURE__ */ jsx23(Title, { children: /* @__PURE__ */ jsxs13("span", { children: [
|
1542
1561
|
name,
|
1543
|
-
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */
|
1562
|
+
typeof snapshot === "object" && "name" in snapshot ? /* @__PURE__ */ jsxs13("span", { style: { color: "#57534e", fontWeight: 500 }, children: [
|
1544
1563
|
" ",
|
1545
1564
|
snapshot.name
|
1546
1565
|
] }) : null
|
1547
1566
|
] }) }),
|
1548
|
-
/* @__PURE__ */
|
1549
|
-
/* @__PURE__ */
|
1550
|
-
/* @__PURE__ */
|
1567
|
+
/* @__PURE__ */ jsxs13(BadgeContainer, { children: [
|
1568
|
+
/* @__PURE__ */ jsx23(Badge, { children: type && /* @__PURE__ */ jsx23(TypeIcon, { type, extendedType }) }),
|
1569
|
+
/* @__PURE__ */ jsx23(Badge, { children: coId })
|
1551
1570
|
] })
|
1552
1571
|
] }) }),
|
1553
|
-
/* @__PURE__ */
|
1554
|
-
/* @__PURE__ */
|
1555
|
-
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */
|
1556
|
-
/* @__PURE__ */
|
1557
|
-
/* @__PURE__ */
|
1572
|
+
/* @__PURE__ */ jsxs13(ContentContainer, { children: [
|
1573
|
+
/* @__PURE__ */ jsx23(View, { ...props, coValue }),
|
1574
|
+
extendedType !== "account" && extendedType !== "group" && /* @__PURE__ */ jsxs13(Fragment9, { children: [
|
1575
|
+
/* @__PURE__ */ jsx23(RoleDisplay, { node, value }),
|
1576
|
+
/* @__PURE__ */ jsxs13(Text, { muted: true, children: [
|
1558
1577
|
"Owned by",
|
1559
1578
|
" ",
|
1560
|
-
/* @__PURE__ */
|
1579
|
+
/* @__PURE__ */ jsx23(
|
1561
1580
|
AccountOrGroupText,
|
1562
1581
|
{
|
1563
1582
|
coId: value.group.id,
|
@@ -1575,7 +1594,7 @@ function Page(props) {
|
|
1575
1594
|
}
|
1576
1595
|
|
1577
1596
|
// src/inspector/viewer/page-stack.tsx
|
1578
|
-
import { Fragment as
|
1597
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
1579
1598
|
var PageStackContainer = styled15("div")`
|
1580
1599
|
position: relative;
|
1581
1600
|
padding: 0 0.75rem;
|
@@ -1593,9 +1612,9 @@ function PageStack({
|
|
1593
1612
|
}) {
|
1594
1613
|
const page = path[path.length - 1];
|
1595
1614
|
const index = path.length - 1;
|
1596
|
-
return /* @__PURE__ */
|
1615
|
+
return /* @__PURE__ */ jsx24(Fragment10, { children: /* @__PURE__ */ jsxs14(PageStackContainer, { children: [
|
1597
1616
|
children,
|
1598
|
-
node && page && /* @__PURE__ */
|
1617
|
+
node && page && /* @__PURE__ */ jsx24(
|
1599
1618
|
Page,
|
1600
1619
|
{
|
1601
1620
|
coId: page.coId,
|
@@ -1611,10 +1630,22 @@ function PageStack({
|
|
1611
1630
|
|
1612
1631
|
// src/inspector/viewer/use-page-path.ts
|
1613
1632
|
import { useCallback, useEffect as useEffect5, useState as useState7 } from "react";
|
1633
|
+
var STORAGE_KEY = "jazz-inspector-paths";
|
1614
1634
|
function usePagePath(defaultPath) {
|
1615
|
-
const [path, setPath] = useState7(
|
1635
|
+
const [path, setPath] = useState7(() => {
|
1636
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
1637
|
+
if (stored) {
|
1638
|
+
try {
|
1639
|
+
return JSON.parse(stored);
|
1640
|
+
} catch (e) {
|
1641
|
+
console.warn("Failed to parse stored path:", e);
|
1642
|
+
}
|
1643
|
+
}
|
1644
|
+
return defaultPath || [];
|
1645
|
+
});
|
1616
1646
|
const updatePath = useCallback((newPath) => {
|
1617
1647
|
setPath(newPath);
|
1648
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(newPath));
|
1618
1649
|
}, []);
|
1619
1650
|
useEffect5(() => {
|
1620
1651
|
if (defaultPath && JSON.stringify(path) !== JSON.stringify(defaultPath)) {
|
@@ -1730,7 +1761,7 @@ var GlobalStyles = styled16("div")`
|
|
1730
1761
|
|
1731
1762
|
// src/inspector/viewer/inpsector-button.tsx
|
1732
1763
|
import { styled as styled17 } from "goober";
|
1733
|
-
import { jsx as
|
1764
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
1734
1765
|
var StyledInspectorButton = styled17("button")`
|
1735
1766
|
position: fixed;
|
1736
1767
|
width: 2.5rem;
|
@@ -1773,8 +1804,8 @@ function InspectorButton({
|
|
1773
1804
|
position = "right",
|
1774
1805
|
...buttonProps
|
1775
1806
|
}) {
|
1776
|
-
return /* @__PURE__ */
|
1777
|
-
/* @__PURE__ */
|
1807
|
+
return /* @__PURE__ */ jsxs15(StyledInspectorButton, { position, ...buttonProps, children: [
|
1808
|
+
/* @__PURE__ */ jsx25(
|
1778
1809
|
JazzIcon,
|
1779
1810
|
{
|
1780
1811
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -1782,7 +1813,7 @@ function InspectorButton({
|
|
1782
1813
|
height: "115",
|
1783
1814
|
viewBox: "0 0 119 115",
|
1784
1815
|
fill: "none",
|
1785
|
-
children: /* @__PURE__ */
|
1816
|
+
children: /* @__PURE__ */ jsx25(
|
1786
1817
|
"path",
|
1787
1818
|
{
|
1788
1819
|
fillRule: "evenodd",
|
@@ -1793,7 +1824,7 @@ function InspectorButton({
|
|
1793
1824
|
)
|
1794
1825
|
}
|
1795
1826
|
),
|
1796
|
-
/* @__PURE__ */
|
1827
|
+
/* @__PURE__ */ jsx25(
|
1797
1828
|
"span",
|
1798
1829
|
{
|
1799
1830
|
style: {
|
@@ -1813,8 +1844,22 @@ function InspectorButton({
|
|
1813
1844
|
] });
|
1814
1845
|
}
|
1815
1846
|
|
1847
|
+
// src/inspector/viewer/use-open-inspector.ts
|
1848
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
1849
|
+
var STORAGE_KEY2 = "jazz-inspector-open";
|
1850
|
+
function useOpenInspector() {
|
1851
|
+
const [open, setOpen] = useState8(() => {
|
1852
|
+
const stored = localStorage.getItem(STORAGE_KEY2);
|
1853
|
+
return stored ? JSON.parse(stored) : false;
|
1854
|
+
});
|
1855
|
+
useEffect6(() => {
|
1856
|
+
localStorage.setItem(STORAGE_KEY2, JSON.stringify(open));
|
1857
|
+
}, [open]);
|
1858
|
+
return [open, setOpen];
|
1859
|
+
}
|
1860
|
+
|
1816
1861
|
// src/inspector/viewer/new-app.tsx
|
1817
|
-
import { Fragment as
|
1862
|
+
import { Fragment as Fragment11, jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
1818
1863
|
var InspectorContainer = styled18("div")`
|
1819
1864
|
position: fixed;
|
1820
1865
|
height: 50vh;
|
@@ -1862,7 +1907,7 @@ function JazzInspector({ position = "right" }) {
|
|
1862
1907
|
const localNode = context.node;
|
1863
1908
|
const me = "me" in context ? context.me : void 0;
|
1864
1909
|
if (process.env.NODE_ENV !== "development") return null;
|
1865
|
-
return /* @__PURE__ */
|
1910
|
+
return /* @__PURE__ */ jsx26(
|
1866
1911
|
JazzInspectorInternal,
|
1867
1912
|
{
|
1868
1913
|
position,
|
@@ -1876,8 +1921,8 @@ function JazzInspectorInternal({
|
|
1876
1921
|
localNode,
|
1877
1922
|
accountId
|
1878
1923
|
}) {
|
1879
|
-
const [open, setOpen] =
|
1880
|
-
const [coValueId, setCoValueId] =
|
1924
|
+
const [open, setOpen] = useOpenInspector();
|
1925
|
+
const [coValueId, setCoValueId] = useState9("");
|
1881
1926
|
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
1882
1927
|
const handleCoValueIdSubmit = (e) => {
|
1883
1928
|
e.preventDefault();
|
@@ -1887,12 +1932,12 @@ function JazzInspectorInternal({
|
|
1887
1932
|
setCoValueId("");
|
1888
1933
|
};
|
1889
1934
|
if (!open) {
|
1890
|
-
return /* @__PURE__ */
|
1935
|
+
return /* @__PURE__ */ jsx26(InspectorButton, { position, onClick: () => setOpen(true) });
|
1891
1936
|
}
|
1892
|
-
return /* @__PURE__ */
|
1893
|
-
/* @__PURE__ */
|
1894
|
-
/* @__PURE__ */
|
1895
|
-
/* @__PURE__ */
|
1937
|
+
return /* @__PURE__ */ jsxs16(InspectorContainer, { as: GlobalStyles, style: { zIndex: 999 }, children: [
|
1938
|
+
/* @__PURE__ */ jsxs16(HeaderContainer2, { children: [
|
1939
|
+
/* @__PURE__ */ jsx26(Breadcrumbs, { path, onBreadcrumbClick: goToIndex }),
|
1940
|
+
/* @__PURE__ */ jsx26(Form, { onSubmit: handleCoValueIdSubmit, children: path.length !== 0 && /* @__PURE__ */ jsx26(
|
1896
1941
|
Input,
|
1897
1942
|
{
|
1898
1943
|
label: "CoValue ID",
|
@@ -1903,23 +1948,23 @@ function JazzInspectorInternal({
|
|
1903
1948
|
onChange: (e) => setCoValueId(e.target.value)
|
1904
1949
|
}
|
1905
1950
|
) }),
|
1906
|
-
/* @__PURE__ */
|
1951
|
+
/* @__PURE__ */ jsx26(Button, { variant: "plain", type: "button", onClick: () => setOpen(false), children: "Close" })
|
1907
1952
|
] }),
|
1908
|
-
/* @__PURE__ */
|
1953
|
+
/* @__PURE__ */ jsx26(
|
1909
1954
|
PageStack,
|
1910
1955
|
{
|
1911
1956
|
path,
|
1912
1957
|
node: localNode,
|
1913
1958
|
goBack,
|
1914
1959
|
addPages,
|
1915
|
-
children: path.length <= 0 && /* @__PURE__ */
|
1960
|
+
children: path.length <= 0 && /* @__PURE__ */ jsxs16(
|
1916
1961
|
InitialForm,
|
1917
1962
|
{
|
1918
1963
|
onSubmit: handleCoValueIdSubmit,
|
1919
1964
|
"aria-hidden": path.length !== 0,
|
1920
1965
|
children: [
|
1921
|
-
/* @__PURE__ */
|
1922
|
-
/* @__PURE__ */
|
1966
|
+
/* @__PURE__ */ jsx26(Heading, { children: "Jazz CoValue Inspector" }),
|
1967
|
+
/* @__PURE__ */ jsx26(
|
1923
1968
|
Input,
|
1924
1969
|
{
|
1925
1970
|
label: "CoValue ID",
|
@@ -1930,10 +1975,10 @@ function JazzInspectorInternal({
|
|
1930
1975
|
onChange: (e) => setCoValueId(e.target.value)
|
1931
1976
|
}
|
1932
1977
|
),
|
1933
|
-
/* @__PURE__ */
|
1934
|
-
accountId && /* @__PURE__ */
|
1935
|
-
/* @__PURE__ */
|
1936
|
-
/* @__PURE__ */
|
1978
|
+
/* @__PURE__ */ jsx26(Button, { type: "submit", variant: "primary", children: "Inspect CoValue" }),
|
1979
|
+
accountId && /* @__PURE__ */ jsxs16(Fragment11, { children: [
|
1980
|
+
/* @__PURE__ */ jsx26(OrText, { children: "or" }),
|
1981
|
+
/* @__PURE__ */ jsx26(
|
1937
1982
|
Button,
|
1938
1983
|
{
|
1939
1984
|
variant: "secondary",
|
@@ -1956,7 +2001,7 @@ function JazzInspectorInternal({
|
|
1956
2001
|
// src/inspector/ui/select.tsx
|
1957
2002
|
import { styled as styled19 } from "goober";
|
1958
2003
|
import { useId as useId2 } from "react";
|
1959
|
-
import { jsx as
|
2004
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
1960
2005
|
var SelectContainer = styled19("div")`
|
1961
2006
|
display: grid;
|
1962
2007
|
gap: 0.25rem;
|
@@ -1998,11 +2043,11 @@ function Select(props) {
|
|
1998
2043
|
const { label, hideLabel, id: customId, className, ...selectProps } = props;
|
1999
2044
|
const generatedId = useId2();
|
2000
2045
|
const id = customId || generatedId;
|
2001
|
-
return /* @__PURE__ */
|
2002
|
-
/* @__PURE__ */
|
2003
|
-
/* @__PURE__ */
|
2004
|
-
/* @__PURE__ */
|
2005
|
-
/* @__PURE__ */
|
2046
|
+
return /* @__PURE__ */ jsxs17(SelectContainer, { className, children: [
|
2047
|
+
/* @__PURE__ */ jsx27("label", { htmlFor: id, className: hideLabel ? "j-sr-only" : "", children: label }),
|
2048
|
+
/* @__PURE__ */ jsxs17(SelectWrapper, { children: [
|
2049
|
+
/* @__PURE__ */ jsx27(StyledSelect, { ...selectProps, id, children: props.children }),
|
2050
|
+
/* @__PURE__ */ jsx27(SelectIcon, { children: /* @__PURE__ */ jsx27(Icon, { name: "chevronDown", size: "sm" }) })
|
2006
2051
|
] })
|
2007
2052
|
] });
|
2008
2053
|
}
|