jazz-tools 0.19.2 → 0.19.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.svelte-kit/__package__/jazz.class.svelte.d.ts +2 -2
- package/.svelte-kit/__package__/jazz.class.svelte.d.ts.map +1 -1
- package/.svelte-kit/__package__/jazz.class.svelte.js +15 -17
- package/.turbo/turbo-build.log +54 -54
- package/CHANGELOG.md +24 -0
- package/dist/{chunk-NCNM6UDZ.js → chunk-PT7FCV26.js} +148 -78
- package/dist/chunk-PT7FCV26.js.map +1 -0
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/inspector/{custom-element-ABVPHX53.js → custom-element-P76EIWEV.js} +322 -146
- package/dist/inspector/custom-element-P76EIWEV.js.map +1 -0
- package/dist/inspector/index.js +302 -126
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/register-custom-element.js +1 -1
- package/dist/inspector/tests/viewer/co-plain-text-view.test.d.ts +2 -0
- package/dist/inspector/tests/viewer/co-plain-text-view.test.d.ts.map +1 -0
- package/dist/inspector/utils/history.d.ts +5 -1
- package/dist/inspector/utils/history.d.ts.map +1 -1
- package/dist/inspector/utils/permissions.d.ts +3 -0
- package/dist/inspector/utils/permissions.d.ts.map +1 -0
- package/dist/inspector/viewer/co-map-view.d.ts.map +1 -1
- package/dist/inspector/viewer/co-plain-text-view.d.ts +4 -2
- package/dist/inspector/viewer/co-plain-text-view.d.ts.map +1 -1
- package/dist/inspector/viewer/grid-view.d.ts.map +1 -1
- package/dist/inspector/viewer/page.d.ts.map +1 -1
- package/dist/inspector/viewer/use-resolve-covalue.d.ts +0 -1
- package/dist/inspector/viewer/use-resolve-covalue.d.ts.map +1 -1
- package/dist/react-core/hooks.d.ts.map +1 -1
- package/dist/react-core/index.js +4 -17
- package/dist/react-core/index.js.map +1 -1
- package/dist/svelte/jazz.class.svelte.d.ts +2 -2
- package/dist/svelte/jazz.class.svelte.d.ts.map +1 -1
- package/dist/svelte/jazz.class.svelte.js +15 -17
- package/dist/testing.js +1 -1
- package/dist/tools/coValues/coFeed.d.ts.map +1 -1
- package/dist/tools/coValues/group.d.ts.map +1 -1
- package/dist/tools/coValues/interfaces.d.ts +7 -6
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/coValues/promise.d.ts +9 -0
- package/dist/tools/coValues/promise.d.ts.map +1 -0
- package/dist/tools/coValues/request.d.ts.map +1 -1
- package/dist/tools/exports.d.ts +1 -1
- package/dist/tools/exports.d.ts.map +1 -1
- package/dist/tools/implementation/refs.d.ts +1 -1
- package/dist/tools/implementation/refs.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/schemaFieldToCoFieldDef.d.ts +3 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/schemaFieldToCoFieldDef.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/unionUtils.d.ts.map +1 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts +5 -2
- package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/dist/tools/subscribe/index.d.ts +1 -1
- package/dist/tools/subscribe/index.d.ts.map +1 -1
- package/dist/tools/subscribe/types.d.ts +2 -1
- package/dist/tools/subscribe/types.d.ts.map +1 -1
- package/dist/tools/tests/SubscriptionScope.test.d.ts +2 -0
- package/dist/tools/tests/SubscriptionScope.test.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/inspector/tests/utils/history.test.ts +233 -2
- package/src/inspector/tests/viewer/co-plain-text-view.test.tsx +125 -0
- package/src/inspector/tests/viewer/comap-view.test.tsx +309 -1
- package/src/inspector/tests/viewer/history-view.test.tsx +134 -2
- package/src/inspector/utils/history.ts +168 -1
- package/src/inspector/utils/permissions.ts +10 -0
- package/src/inspector/viewer/co-map-view.tsx +27 -15
- package/src/inspector/viewer/co-plain-text-view.tsx +102 -3
- package/src/inspector/viewer/grid-view.tsx +2 -1
- package/src/inspector/viewer/history-view.tsx +5 -23
- package/src/inspector/viewer/page.tsx +8 -1
- package/src/inspector/viewer/use-resolve-covalue.ts +2 -6
- package/src/react-core/hooks.ts +5 -29
- package/src/svelte/jazz.class.svelte.ts +16 -34
- package/src/tools/coValues/coFeed.ts +10 -7
- package/src/tools/coValues/coMap.ts +10 -7
- package/src/tools/coValues/group.ts +6 -2
- package/src/tools/coValues/interfaces.ts +48 -28
- package/src/tools/coValues/promise.ts +34 -0
- package/src/tools/coValues/request.ts +12 -8
- package/src/tools/exports.ts +1 -0
- package/src/tools/implementation/refs.ts +9 -17
- package/src/tools/implementation/zodSchema/runtimeConverters/schemaFieldToCoFieldDef.ts +62 -30
- package/src/tools/implementation/zodSchema/unionUtils.ts +3 -4
- package/src/tools/subscribe/SubscriptionScope.ts +45 -2
- package/src/tools/subscribe/index.ts +28 -13
- package/src/tools/subscribe/types.ts +5 -2
- package/src/tools/tests/SubscriptionScope.test.ts +397 -0
- package/src/tools/tests/deepLoading.test.ts +22 -0
- package/src/tools/tests/subscribe.test.ts +69 -0
- package/dist/chunk-NCNM6UDZ.js.map +0 -1
- package/dist/inspector/custom-element-ABVPHX53.js.map +0 -1
|
@@ -31782,14 +31782,14 @@ var require_jsx_runtime = __commonJS({
|
|
|
31782
31782
|
});
|
|
31783
31783
|
|
|
31784
31784
|
// src/inspector/custom-element.tsx
|
|
31785
|
-
var
|
|
31785
|
+
var import_react28 = __toESM(require_react(), 1);
|
|
31786
31786
|
var import_client = __toESM(require_client(), 1);
|
|
31787
31787
|
import { setup } from "goober";
|
|
31788
31788
|
import { Account } from "jazz-tools";
|
|
31789
31789
|
|
|
31790
31790
|
// src/inspector/viewer/new-app.tsx
|
|
31791
|
-
var
|
|
31792
|
-
import { styled as
|
|
31791
|
+
var import_react27 = __toESM(require_react(), 1);
|
|
31792
|
+
import { styled as styled27 } from "goober";
|
|
31793
31793
|
|
|
31794
31794
|
// src/inspector/ui/button.tsx
|
|
31795
31795
|
var import_react = __toESM(require_react(), 1);
|
|
@@ -31964,11 +31964,11 @@ var Breadcrumbs = ({
|
|
|
31964
31964
|
};
|
|
31965
31965
|
|
|
31966
31966
|
// src/inspector/viewer/page-stack.tsx
|
|
31967
|
-
import { styled as
|
|
31967
|
+
import { styled as styled24 } from "goober";
|
|
31968
31968
|
|
|
31969
31969
|
// src/inspector/viewer/page.tsx
|
|
31970
|
-
var
|
|
31971
|
-
import { styled as
|
|
31970
|
+
var import_react22 = __toESM(require_react(), 1);
|
|
31971
|
+
import { styled as styled22 } from "goober";
|
|
31972
31972
|
|
|
31973
31973
|
// src/inspector/ui/badge.tsx
|
|
31974
31974
|
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -32316,12 +32316,6 @@ function RenderBlobImage({ blob }) {
|
|
|
32316
32316
|
var isBrowserImage = (coValue) => {
|
|
32317
32317
|
return "originalSize" in coValue && "placeholderDataURL" in coValue;
|
|
32318
32318
|
};
|
|
32319
|
-
var isGroup = (coValue) => {
|
|
32320
|
-
return "readKey" in coValue;
|
|
32321
|
-
};
|
|
32322
|
-
var isAccount = (coValue) => {
|
|
32323
|
-
return isGroup(coValue) && "profile" in coValue;
|
|
32324
|
-
};
|
|
32325
32319
|
async function resolveCoValue(coValueId, node) {
|
|
32326
32320
|
const value = await node.load(coValueId);
|
|
32327
32321
|
if (value === "unavailable") {
|
|
@@ -32338,7 +32332,7 @@ async function resolveCoValue(coValueId, node) {
|
|
|
32338
32332
|
if (type === "comap") {
|
|
32339
32333
|
if (isBrowserImage(snapshot)) {
|
|
32340
32334
|
extendedType = "image";
|
|
32341
|
-
} else if (
|
|
32335
|
+
} else if (value.headerMeta?.type === "account") {
|
|
32342
32336
|
extendedType = "account";
|
|
32343
32337
|
} else if (value.core.isGroup()) {
|
|
32344
32338
|
extendedType = "group";
|
|
@@ -32367,7 +32361,7 @@ function subscribeToCoValue(coValueId, node, callback) {
|
|
|
32367
32361
|
if (type === "comap") {
|
|
32368
32362
|
if (isBrowserImage(snapshot)) {
|
|
32369
32363
|
extendedType = "image";
|
|
32370
|
-
} else if (
|
|
32364
|
+
} else if (value.headerMeta?.type === "account") {
|
|
32371
32365
|
extendedType = "account";
|
|
32372
32366
|
} else if (value.core.isGroup()) {
|
|
32373
32367
|
extendedType = "group";
|
|
@@ -33212,6 +33206,11 @@ function Grid(props) {
|
|
|
33212
33206
|
}
|
|
33213
33207
|
}
|
|
33214
33208
|
|
|
33209
|
+
// src/inspector/utils/permissions.ts
|
|
33210
|
+
function isWriter(role) {
|
|
33211
|
+
return role === "writer" || role === "admin" || role === "manager" || role === "writeOnly";
|
|
33212
|
+
}
|
|
33213
|
+
|
|
33215
33214
|
// src/inspector/viewer/grid-view.tsx
|
|
33216
33215
|
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
|
|
33217
33216
|
function GridItem({
|
|
@@ -33286,7 +33285,7 @@ function GridItem({
|
|
|
33286
33285
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { strong: true, children: key }),
|
|
33287
33286
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Badge, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ResolveIcon, { coId: value, node }) })
|
|
33288
33287
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { strong: true, children: key }) }),
|
|
33289
|
-
coValue && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ActionButtons, { children: [
|
|
33288
|
+
coValue && isWriter(coValue.group.myRole()) && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ActionButtons, { children: [
|
|
33290
33289
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
33291
33290
|
EditButton,
|
|
33292
33291
|
{
|
|
@@ -33838,17 +33837,90 @@ function AccountView({
|
|
|
33838
33837
|
}
|
|
33839
33838
|
|
|
33840
33839
|
// src/inspector/viewer/co-plain-text-view.tsx
|
|
33840
|
+
var import_react17 = __toESM(require_react(), 1);
|
|
33841
|
+
import { styled as styled18 } from "goober";
|
|
33842
|
+
import { CoPlainText } from "jazz-tools";
|
|
33841
33843
|
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
33842
|
-
function CoPlainTextView({
|
|
33844
|
+
function CoPlainTextView({
|
|
33845
|
+
data,
|
|
33846
|
+
coValue
|
|
33847
|
+
}) {
|
|
33848
|
+
const currentText = Object.values(data).join("");
|
|
33849
|
+
const [isEditing, setIsEditing] = (0, import_react17.useState)(false);
|
|
33850
|
+
const [editValue, setEditValue] = (0, import_react17.useState)("");
|
|
33851
|
+
const canEdit2 = isWriter(coValue.group.myRole());
|
|
33852
|
+
const handleEditClick = () => {
|
|
33853
|
+
setIsEditing(true);
|
|
33854
|
+
setEditValue(currentText);
|
|
33855
|
+
};
|
|
33856
|
+
const handleCancel = () => {
|
|
33857
|
+
setIsEditing(false);
|
|
33858
|
+
setEditValue(currentText);
|
|
33859
|
+
};
|
|
33860
|
+
const handleSave = (e) => {
|
|
33861
|
+
e.preventDefault();
|
|
33862
|
+
e.stopPropagation();
|
|
33863
|
+
const coPlainText = CoPlainText.fromRaw(coValue);
|
|
33864
|
+
coPlainText.$jazz.applyDiff(editValue);
|
|
33865
|
+
setIsEditing(false);
|
|
33866
|
+
};
|
|
33843
33867
|
if (!data) return;
|
|
33868
|
+
if (isEditing) {
|
|
33869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
33870
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(EditForm2, { onSubmit: handleSave, children: [
|
|
33871
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
33872
|
+
StyledTextarea2,
|
|
33873
|
+
{
|
|
33874
|
+
value: editValue,
|
|
33875
|
+
onChange: (e) => setEditValue(e.target.value),
|
|
33876
|
+
onClick: (e) => e.stopPropagation()
|
|
33877
|
+
}
|
|
33878
|
+
),
|
|
33879
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(FormActions2, { children: [
|
|
33880
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { type: "button", variant: "secondary", onClick: handleCancel, children: "Cancel" }),
|
|
33881
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { type: "submit", variant: "primary", children: "Save" })
|
|
33882
|
+
] })
|
|
33883
|
+
] }),
|
|
33884
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RawDataCard, { data })
|
|
33885
|
+
] });
|
|
33886
|
+
}
|
|
33844
33887
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
33845
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { children:
|
|
33888
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { children: currentText }),
|
|
33889
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: canEdit2 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { variant: "secondary", onClick: handleEditClick, title: "Edit", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "edit" }) }) }),
|
|
33846
33890
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RawDataCard, { data })
|
|
33847
33891
|
] });
|
|
33848
33892
|
}
|
|
33893
|
+
var EditForm2 = styled18("form")`
|
|
33894
|
+
display: flex;
|
|
33895
|
+
flex-direction: column;
|
|
33896
|
+
gap: 0.75rem;
|
|
33897
|
+
margin-bottom: 1rem;
|
|
33898
|
+
`;
|
|
33899
|
+
var StyledTextarea2 = styled18("textarea")`
|
|
33900
|
+
width: 100%;
|
|
33901
|
+
min-height: 120px;
|
|
33902
|
+
border-radius: var(--j-radius-md);
|
|
33903
|
+
border: 1px solid var(--j-border-color);
|
|
33904
|
+
padding: 0.5rem 0.875rem;
|
|
33905
|
+
box-shadow: var(--j-shadow-sm);
|
|
33906
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
33907
|
+
font-size: 0.875rem;
|
|
33908
|
+
background-color: white;
|
|
33909
|
+
color: var(--j-text-color-strong);
|
|
33910
|
+
resize: vertical;
|
|
33911
|
+
|
|
33912
|
+
@media (prefers-color-scheme: dark) {
|
|
33913
|
+
background-color: var(--j-foreground);
|
|
33914
|
+
}
|
|
33915
|
+
`;
|
|
33916
|
+
var FormActions2 = styled18("div")`
|
|
33917
|
+
display: flex;
|
|
33918
|
+
gap: 0.5rem;
|
|
33919
|
+
justify-content: flex-end;
|
|
33920
|
+
`;
|
|
33849
33921
|
|
|
33850
33922
|
// src/inspector/viewer/group-view.tsx
|
|
33851
|
-
var
|
|
33923
|
+
var import_react18 = __toESM(require_react(), 1);
|
|
33852
33924
|
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
|
|
33853
33925
|
function partitionMembers(data) {
|
|
33854
33926
|
const everyone = Object.entries(data).filter(([key]) => key === "everyone").map(([key, value]) => ({
|
|
@@ -33877,7 +33949,7 @@ function GroupView({
|
|
|
33877
33949
|
onNavigate,
|
|
33878
33950
|
node
|
|
33879
33951
|
}) {
|
|
33880
|
-
const [addMemberType, setAddMemberType] = (0,
|
|
33952
|
+
const [addMemberType, setAddMemberType] = (0, import_react18.useState)(null);
|
|
33881
33953
|
const { everyone, members, parentGroups, childGroups } = partitionMembers(
|
|
33882
33954
|
data
|
|
33883
33955
|
);
|
|
@@ -34137,17 +34209,17 @@ function RoleDisplay({
|
|
|
34137
34209
|
}
|
|
34138
34210
|
|
|
34139
34211
|
// src/inspector/viewer/table-viewer.tsx
|
|
34140
|
-
var
|
|
34141
|
-
import { styled as
|
|
34212
|
+
var import_react19 = __toESM(require_react(), 1);
|
|
34213
|
+
import { styled as styled19 } from "goober";
|
|
34142
34214
|
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
|
|
34143
|
-
var PaginationContainer =
|
|
34215
|
+
var PaginationContainer = styled19("div")`
|
|
34144
34216
|
padding: 1rem 0;
|
|
34145
34217
|
display: flex;
|
|
34146
34218
|
align-items: center;
|
|
34147
34219
|
justify-content: space-between;
|
|
34148
34220
|
gap: 0.5rem;
|
|
34149
34221
|
`;
|
|
34150
|
-
var RedTooltip =
|
|
34222
|
+
var RedTooltip = styled19("span")`
|
|
34151
34223
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
34152
34224
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
34153
34225
|
|
|
@@ -34184,8 +34256,8 @@ function CoValuesTableView({
|
|
|
34184
34256
|
onNavigate,
|
|
34185
34257
|
onRemove
|
|
34186
34258
|
}) {
|
|
34187
|
-
const [visibleRowsCount, setVisibleRowsCount] = (0,
|
|
34188
|
-
const [coIdArray, visibleRows] = (0,
|
|
34259
|
+
const [visibleRowsCount, setVisibleRowsCount] = (0, import_react19.useState)(10);
|
|
34260
|
+
const [coIdArray, visibleRows] = (0, import_react19.useMemo)(() => {
|
|
34189
34261
|
const coIdArray2 = Array.isArray(data) ? data : Object.values(data).every((k) => typeof k === "string" && isCoId(k)) ? Object.values(data).map((k) => k) : [];
|
|
34190
34262
|
const visibleRows2 = coIdArray2.slice(0, visibleRowsCount);
|
|
34191
34263
|
return [coIdArray2, visibleRows2];
|
|
@@ -34282,7 +34354,7 @@ function TableView({
|
|
|
34282
34354
|
onNavigate,
|
|
34283
34355
|
onRemove
|
|
34284
34356
|
}) {
|
|
34285
|
-
const isListOfCoValues = (0,
|
|
34357
|
+
const isListOfCoValues = (0, import_react19.useMemo)(() => {
|
|
34286
34358
|
return Array.isArray(data) && data.every((k) => isCoId(k));
|
|
34287
34359
|
}, [data]);
|
|
34288
34360
|
if (isListOfCoValues) {
|
|
@@ -34311,8 +34383,8 @@ function TableView({
|
|
|
34311
34383
|
}
|
|
34312
34384
|
|
|
34313
34385
|
// src/inspector/viewer/history-view.tsx
|
|
34314
|
-
var
|
|
34315
|
-
import { styled as
|
|
34386
|
+
var import_react20 = __toESM(require_react(), 1);
|
|
34387
|
+
import { styled as styled20 } from "goober";
|
|
34316
34388
|
|
|
34317
34389
|
// src/inspector/utils/transactions-changes.ts
|
|
34318
34390
|
var isGroupExtension = (change) => {
|
|
@@ -34355,13 +34427,147 @@ var isStreamEnd = (change) => {
|
|
|
34355
34427
|
return change?.type === "end";
|
|
34356
34428
|
};
|
|
34357
34429
|
|
|
34430
|
+
// src/inspector/utils/history.ts
|
|
34431
|
+
import { stringifyOpID } from "cojson";
|
|
34432
|
+
function areSameOpIds(opId1, opId2) {
|
|
34433
|
+
if (typeof opId1 === "string" || typeof opId2 === "string") {
|
|
34434
|
+
return opId1 === opId2;
|
|
34435
|
+
}
|
|
34436
|
+
return opId1.sessionID === opId2.sessionID && opId1.txIndex === opId2.txIndex && opId1.changeIdx === opId2.changeIdx;
|
|
34437
|
+
}
|
|
34438
|
+
function isCoPlainText(coValue) {
|
|
34439
|
+
return coValue.type === "coplaintext";
|
|
34440
|
+
}
|
|
34441
|
+
function getTransactionChanges(tx, coValue) {
|
|
34442
|
+
if (tx.isValid === false && tx.tx.privacy === "private") {
|
|
34443
|
+
const readKey = coValue.core.getReadKey(tx.tx.keyUsed);
|
|
34444
|
+
if (!readKey) {
|
|
34445
|
+
return [
|
|
34446
|
+
`Unable to decrypt transaction: read key ${tx.tx.keyUsed} not found.`
|
|
34447
|
+
];
|
|
34448
|
+
}
|
|
34449
|
+
return coValue.core.verified.decryptTransaction(
|
|
34450
|
+
tx.txID.sessionID,
|
|
34451
|
+
tx.txID.txIndex,
|
|
34452
|
+
readKey
|
|
34453
|
+
) ?? [];
|
|
34454
|
+
}
|
|
34455
|
+
if (isCoPlainText(coValue)) {
|
|
34456
|
+
if (tx.changes === void 0 || tx.changes.length === 0) return [];
|
|
34457
|
+
const firstChange = tx.changes[0];
|
|
34458
|
+
if (isItemAppend(firstChange) && tx.changes.every(
|
|
34459
|
+
(c) => isItemAppend(c) && areSameOpIds(c.after, firstChange.after)
|
|
34460
|
+
)) {
|
|
34461
|
+
const changes = tx.changes;
|
|
34462
|
+
if (firstChange.after !== "start") {
|
|
34463
|
+
changes.reverse();
|
|
34464
|
+
}
|
|
34465
|
+
return [
|
|
34466
|
+
{
|
|
34467
|
+
op: "app",
|
|
34468
|
+
value: changes.map((c) => c.value).join(""),
|
|
34469
|
+
after: firstChange.after
|
|
34470
|
+
}
|
|
34471
|
+
];
|
|
34472
|
+
}
|
|
34473
|
+
if (isItemPrepend(firstChange) && tx.changes.every(
|
|
34474
|
+
(c) => isItemPrepend(c) && areSameOpIds(c.before, firstChange.before)
|
|
34475
|
+
)) {
|
|
34476
|
+
const changes = tx.changes;
|
|
34477
|
+
if (firstChange.before !== "end") {
|
|
34478
|
+
changes.reverse();
|
|
34479
|
+
}
|
|
34480
|
+
return [
|
|
34481
|
+
{
|
|
34482
|
+
op: "pre",
|
|
34483
|
+
value: changes.map((c) => c.value).join(""),
|
|
34484
|
+
before: firstChange.before
|
|
34485
|
+
}
|
|
34486
|
+
];
|
|
34487
|
+
}
|
|
34488
|
+
if (isItemDeletion(firstChange) && tx.changes.every((c) => isItemDeletion(c))) {
|
|
34489
|
+
let changesAreConsecutive2 = function(changes) {
|
|
34490
|
+
if (changes.length < 2) return false;
|
|
34491
|
+
const mapping = coValueBeforeDeletions.mapping.idxAfterOpID;
|
|
34492
|
+
for (let i = 1; i < changes.length; ++i) {
|
|
34493
|
+
const prevIdx = mapping[stringifyOpID(changes[i - 1].insertion)];
|
|
34494
|
+
const currIdx = mapping[stringifyOpID(changes[i].insertion)];
|
|
34495
|
+
if (currIdx !== prevIdx && currIdx !== (prevIdx ?? -2) + 1) {
|
|
34496
|
+
return false;
|
|
34497
|
+
}
|
|
34498
|
+
}
|
|
34499
|
+
return true;
|
|
34500
|
+
};
|
|
34501
|
+
var changesAreConsecutive = changesAreConsecutive2;
|
|
34502
|
+
const coValueBeforeDeletions = coValue.atTime(tx.madeAt - 1);
|
|
34503
|
+
if (changesAreConsecutive2(tx.changes)) {
|
|
34504
|
+
const groupedBySession = /* @__PURE__ */ new Map();
|
|
34505
|
+
for (const change of tx.changes) {
|
|
34506
|
+
const group = `${change.insertion.sessionID}-${change.insertion.txIndex}`;
|
|
34507
|
+
if (!groupedBySession.has(group)) groupedBySession.set(group, []);
|
|
34508
|
+
groupedBySession.get(group).push(change);
|
|
34509
|
+
}
|
|
34510
|
+
return Array.from(groupedBySession.values()).map((changes) => {
|
|
34511
|
+
const stringDeleted = changes.toSorted((a, b) => {
|
|
34512
|
+
if (a.insertion.txIndex === b.insertion.txIndex) {
|
|
34513
|
+
return a.insertion.changeIdx - b.insertion.changeIdx;
|
|
34514
|
+
}
|
|
34515
|
+
return a.insertion.txIndex - b.insertion.txIndex;
|
|
34516
|
+
}).map(
|
|
34517
|
+
(c) => coValueBeforeDeletions.get(
|
|
34518
|
+
coValueBeforeDeletions.mapping.idxAfterOpID[stringifyOpID(c.insertion)]
|
|
34519
|
+
)
|
|
34520
|
+
).join("");
|
|
34521
|
+
return {
|
|
34522
|
+
op: "custom",
|
|
34523
|
+
action: `"${stringDeleted}" has been deleted`
|
|
34524
|
+
};
|
|
34525
|
+
});
|
|
34526
|
+
}
|
|
34527
|
+
}
|
|
34528
|
+
}
|
|
34529
|
+
return tx.changes ?? tx.tx.changes ?? [];
|
|
34530
|
+
}
|
|
34531
|
+
function restoreCoMapToTimestamp(coValue, timestamp, removeUnknownProperties) {
|
|
34532
|
+
const myRole = coValue.group.myRole();
|
|
34533
|
+
if (myRole === void 0 || !["admin", "manager", "writer", "writerOnly"].includes(myRole)) {
|
|
34534
|
+
return;
|
|
34535
|
+
}
|
|
34536
|
+
const newCoValue = coValue.atTime(timestamp).toJSON();
|
|
34537
|
+
const oldCoValue = coValue.toJSON();
|
|
34538
|
+
if (newCoValue === null) return;
|
|
34539
|
+
let changes = [];
|
|
34540
|
+
if (removeUnknownProperties) {
|
|
34541
|
+
for (const key in oldCoValue) {
|
|
34542
|
+
if (!(key in newCoValue)) {
|
|
34543
|
+
changes.push({
|
|
34544
|
+
op: "del",
|
|
34545
|
+
key
|
|
34546
|
+
});
|
|
34547
|
+
}
|
|
34548
|
+
}
|
|
34549
|
+
}
|
|
34550
|
+
for (const key in newCoValue) {
|
|
34551
|
+
if (newCoValue[key] !== oldCoValue[key]) {
|
|
34552
|
+
changes.push({
|
|
34553
|
+
op: "set",
|
|
34554
|
+
key,
|
|
34555
|
+
value: newCoValue[key]
|
|
34556
|
+
});
|
|
34557
|
+
}
|
|
34558
|
+
}
|
|
34559
|
+
if (changes.length > 0) {
|
|
34560
|
+
coValue.core.makeTransaction(changes, "private");
|
|
34561
|
+
}
|
|
34562
|
+
}
|
|
34563
|
+
|
|
34358
34564
|
// src/inspector/viewer/history-view.tsx
|
|
34359
34565
|
var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
|
|
34360
34566
|
function HistoryView({
|
|
34361
34567
|
coValue,
|
|
34362
34568
|
node
|
|
34363
34569
|
}) {
|
|
34364
|
-
const transactions = (0,
|
|
34570
|
+
const transactions = (0, import_react20.useMemo)(
|
|
34365
34571
|
() => getHistory(coValue),
|
|
34366
34572
|
[coValue.core.verifiedTransactions.length]
|
|
34367
34573
|
);
|
|
@@ -34435,20 +34641,6 @@ function HistoryView({
|
|
|
34435
34641
|
}
|
|
34436
34642
|
) });
|
|
34437
34643
|
}
|
|
34438
|
-
function getTransactionChanges(tx, coValue) {
|
|
34439
|
-
if (tx.isValid === false && tx.tx.privacy === "private") {
|
|
34440
|
-
const readKey = coValue.core.getReadKey(tx.tx.keyUsed);
|
|
34441
|
-
if (!readKey) {
|
|
34442
|
-
throw new Error("Read key not found");
|
|
34443
|
-
}
|
|
34444
|
-
return coValue.core.verified.decryptTransaction(
|
|
34445
|
-
tx.txID.sessionID,
|
|
34446
|
-
tx.txID.txIndex,
|
|
34447
|
-
readKey
|
|
34448
|
-
) ?? [];
|
|
34449
|
-
}
|
|
34450
|
-
return tx.changes ?? tx.tx.changes ?? [];
|
|
34451
|
-
}
|
|
34452
34644
|
function getHistory(coValue) {
|
|
34453
34645
|
return coValue.core.verifiedTransactions.flatMap((tx, index) => {
|
|
34454
34646
|
const changes = getTransactionChanges(tx, coValue);
|
|
@@ -34527,6 +34719,9 @@ function mapTransactionToAction(change, coValue) {
|
|
|
34527
34719
|
if (isPropertyDeletion(change)) {
|
|
34528
34720
|
return `Property "${change.key}" has been deleted`;
|
|
34529
34721
|
}
|
|
34722
|
+
if (change.op === "custom") {
|
|
34723
|
+
return change.action;
|
|
34724
|
+
}
|
|
34530
34725
|
return "Unknown action: " + JSON.stringify(change);
|
|
34531
34726
|
}
|
|
34532
34727
|
var findListChange = (opId, coValue) => {
|
|
@@ -34534,7 +34729,7 @@ var findListChange = (opId, coValue) => {
|
|
|
34534
34729
|
(tx) => tx.txID.sessionID === opId.sessionID && tx.txID.txIndex === opId.txIndex
|
|
34535
34730
|
)?.changes?.[opId.changeIdx];
|
|
34536
34731
|
};
|
|
34537
|
-
var RedTooltip2 =
|
|
34732
|
+
var RedTooltip2 = styled20("span")`
|
|
34538
34733
|
position:relative; /* making the .tooltip span a container for the tooltip text */
|
|
34539
34734
|
border-bottom:1px dashed #000; /* little indicater to indicate it's hoverable */
|
|
34540
34735
|
|
|
@@ -34567,44 +34762,8 @@ var RedTooltip2 = styled19("span")`
|
|
|
34567
34762
|
`;
|
|
34568
34763
|
|
|
34569
34764
|
// src/inspector/viewer/co-map-view.tsx
|
|
34570
|
-
var
|
|
34571
|
-
import { styled as
|
|
34572
|
-
|
|
34573
|
-
// src/inspector/utils/history.ts
|
|
34574
|
-
function restoreCoMapToTimestamp(coValue, timestamp, removeUnknownProperties) {
|
|
34575
|
-
const myRole = coValue.group.myRole();
|
|
34576
|
-
if (myRole === void 0 || !["admin", "manager", "writer", "writerOnly"].includes(myRole)) {
|
|
34577
|
-
return;
|
|
34578
|
-
}
|
|
34579
|
-
const newCoValue = coValue.atTime(timestamp).toJSON();
|
|
34580
|
-
const oldCoValue = coValue.toJSON();
|
|
34581
|
-
if (newCoValue === null) return;
|
|
34582
|
-
let changes = [];
|
|
34583
|
-
if (removeUnknownProperties) {
|
|
34584
|
-
for (const key in oldCoValue) {
|
|
34585
|
-
if (!(key in newCoValue)) {
|
|
34586
|
-
changes.push({
|
|
34587
|
-
op: "del",
|
|
34588
|
-
key
|
|
34589
|
-
});
|
|
34590
|
-
}
|
|
34591
|
-
}
|
|
34592
|
-
}
|
|
34593
|
-
for (const key in newCoValue) {
|
|
34594
|
-
if (newCoValue[key] !== oldCoValue[key]) {
|
|
34595
|
-
changes.push({
|
|
34596
|
-
op: "set",
|
|
34597
|
-
key,
|
|
34598
|
-
value: newCoValue[key]
|
|
34599
|
-
});
|
|
34600
|
-
}
|
|
34601
|
-
}
|
|
34602
|
-
if (changes.length > 0) {
|
|
34603
|
-
coValue.core.makeTransaction(changes, "private");
|
|
34604
|
-
}
|
|
34605
|
-
}
|
|
34606
|
-
|
|
34607
|
-
// src/inspector/viewer/co-map-view.tsx
|
|
34765
|
+
var import_react21 = __toESM(require_react(), 1);
|
|
34766
|
+
import { styled as styled21 } from "goober";
|
|
34608
34767
|
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
|
|
34609
34768
|
function CoMapView({
|
|
34610
34769
|
coValue,
|
|
@@ -34623,7 +34782,14 @@ function CoMapView({
|
|
|
34623
34782
|
}
|
|
34624
34783
|
),
|
|
34625
34784
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
34626
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34785
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34786
|
+
AddPropertyModal,
|
|
34787
|
+
{
|
|
34788
|
+
disabled: !isWriter(coValue.group.myRole()),
|
|
34789
|
+
coValue,
|
|
34790
|
+
node
|
|
34791
|
+
}
|
|
34792
|
+
),
|
|
34627
34793
|
" ",
|
|
34628
34794
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RestoreSnapshotModal, { coValue })
|
|
34629
34795
|
] })
|
|
@@ -34631,10 +34797,11 @@ function CoMapView({
|
|
|
34631
34797
|
}
|
|
34632
34798
|
function AddPropertyModal({
|
|
34633
34799
|
coValue,
|
|
34634
|
-
node
|
|
34800
|
+
node,
|
|
34801
|
+
disabled
|
|
34635
34802
|
}) {
|
|
34636
|
-
const [isAddPropertyModalOpen, setIsAddPropertyModalOpen] = (0,
|
|
34637
|
-
const [propertyName, setPropertyName] = (0,
|
|
34803
|
+
const [isAddPropertyModalOpen, setIsAddPropertyModalOpen] = (0, import_react21.useState)(false);
|
|
34804
|
+
const [propertyName, setPropertyName] = (0, import_react21.useState)("");
|
|
34638
34805
|
const openAddPropertyModal = () => {
|
|
34639
34806
|
setIsAddPropertyModalOpen(true);
|
|
34640
34807
|
setPropertyName("");
|
|
@@ -34649,8 +34816,9 @@ function AddPropertyModal({
|
|
|
34649
34816
|
{
|
|
34650
34817
|
title: "Add Property",
|
|
34651
34818
|
variant: "secondary",
|
|
34819
|
+
disabled,
|
|
34652
34820
|
onClick: openAddPropertyModal,
|
|
34653
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: "
|
|
34821
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: "add" })
|
|
34654
34822
|
}
|
|
34655
34823
|
),
|
|
34656
34824
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
@@ -34686,14 +34854,14 @@ function AddPropertyModal({
|
|
|
34686
34854
|
] });
|
|
34687
34855
|
}
|
|
34688
34856
|
function RestoreSnapshotModal({ coValue }) {
|
|
34689
|
-
const [isRestoreModalOpen, setIsRestoreModalOpen] = (0,
|
|
34690
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
34691
|
-
const [removeUnknownProperties, setRemoveUnknownProperties] = (0,
|
|
34692
|
-
const timestamps = (0,
|
|
34857
|
+
const [isRestoreModalOpen, setIsRestoreModalOpen] = (0, import_react21.useState)(false);
|
|
34858
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react21.useState)(-1);
|
|
34859
|
+
const [removeUnknownProperties, setRemoveUnknownProperties] = (0, import_react21.useState)(false);
|
|
34860
|
+
const timestamps = (0, import_react21.useMemo)(
|
|
34693
34861
|
() => coValue.core.verifiedTransactions.map((tx) => tx.madeAt),
|
|
34694
34862
|
[coValue.core.verifiedTransactions.length]
|
|
34695
34863
|
);
|
|
34696
|
-
const coMapAtSelectedIndex = (0,
|
|
34864
|
+
const coMapAtSelectedIndex = (0, import_react21.useMemo)(() => {
|
|
34697
34865
|
if (selectedIndex === -1) return null;
|
|
34698
34866
|
return coValue.atTime(timestamps[selectedIndex]).toJSON();
|
|
34699
34867
|
}, [coValue, timestamps, selectedIndex]);
|
|
@@ -34716,6 +34884,7 @@ function RestoreSnapshotModal({ coValue }) {
|
|
|
34716
34884
|
const handleClose = () => {
|
|
34717
34885
|
setIsRestoreModalOpen(false);
|
|
34718
34886
|
};
|
|
34887
|
+
const canRestore = isWriter(coValue.group.myRole());
|
|
34719
34888
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
34720
34889
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button, { title: "Timeline", variant: "secondary", onClick: openRestoreModal, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: "history" }) }),
|
|
34721
34890
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
@@ -34728,7 +34897,7 @@ function RestoreSnapshotModal({ coValue }) {
|
|
|
34728
34897
|
cancelText: "Cancel",
|
|
34729
34898
|
onConfirm: handleRestore,
|
|
34730
34899
|
onCancel: handleClose,
|
|
34731
|
-
showButtons: timestamps.length > 1,
|
|
34900
|
+
showButtons: timestamps.length > 1 && canRestore,
|
|
34732
34901
|
children: [
|
|
34733
34902
|
timestamps.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
34734
34903
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(RangeContainer, { children: [
|
|
@@ -34746,7 +34915,7 @@ function RestoreSnapshotModal({ coValue }) {
|
|
|
34746
34915
|
),
|
|
34747
34916
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TimestampDisplay, { children: timestamps[selectedIndex] !== void 0 ? new Date(timestamps[selectedIndex]).toISOString() : "No timestamps available" })
|
|
34748
34917
|
] }),
|
|
34749
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(CheckboxContainer, { children: [
|
|
34918
|
+
canRestore && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(CheckboxContainer, { children: [
|
|
34750
34919
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
34751
34920
|
CheckboxInput,
|
|
34752
34921
|
{
|
|
@@ -34769,15 +34938,15 @@ function RestoreSnapshotModal({ coValue }) {
|
|
|
34769
34938
|
)
|
|
34770
34939
|
] });
|
|
34771
34940
|
}
|
|
34772
|
-
var PreviewSection =
|
|
34941
|
+
var PreviewSection = styled21("div")`
|
|
34773
34942
|
margin-top: 1.5rem;
|
|
34774
34943
|
`;
|
|
34775
|
-
var PreviewLabel =
|
|
34944
|
+
var PreviewLabel = styled21("div")`
|
|
34776
34945
|
font-weight: 500;
|
|
34777
34946
|
margin-bottom: 0.5rem;
|
|
34778
34947
|
color: var(--j-text-color-strong);
|
|
34779
34948
|
`;
|
|
34780
|
-
var PreviewPre =
|
|
34949
|
+
var PreviewPre = styled21("pre")`
|
|
34781
34950
|
background-color: var(--j-foreground);
|
|
34782
34951
|
border: 1px solid var(--j-border-color);
|
|
34783
34952
|
border-radius: var(--j-radius-md);
|
|
@@ -34789,17 +34958,17 @@ var PreviewPre = styled20("pre")`
|
|
|
34789
34958
|
color: var(--j-text-color);
|
|
34790
34959
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
34791
34960
|
`;
|
|
34792
|
-
var RangeContainer =
|
|
34961
|
+
var RangeContainer = styled21("div")`
|
|
34793
34962
|
display: flex;
|
|
34794
34963
|
flex-direction: column;
|
|
34795
34964
|
gap: 0.75rem;
|
|
34796
34965
|
`;
|
|
34797
|
-
var RangeLabel =
|
|
34966
|
+
var RangeLabel = styled21("label")`
|
|
34798
34967
|
font-weight: 500;
|
|
34799
34968
|
color: var(--j-text-color-strong);
|
|
34800
34969
|
font-size: 0.875rem;
|
|
34801
34970
|
`;
|
|
34802
|
-
var RangeInput =
|
|
34971
|
+
var RangeInput = styled21("input")`
|
|
34803
34972
|
width: 100%;
|
|
34804
34973
|
height: 0.5rem;
|
|
34805
34974
|
border-radius: var(--j-radius-sm);
|
|
@@ -34836,7 +35005,7 @@ var RangeInput = styled20("input")`
|
|
|
34836
35005
|
cursor: not-allowed;
|
|
34837
35006
|
}
|
|
34838
35007
|
`;
|
|
34839
|
-
var TimestampDisplay =
|
|
35008
|
+
var TimestampDisplay = styled21("div")`
|
|
34840
35009
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
34841
35010
|
font-size: 0.875rem;
|
|
34842
35011
|
color: var(--j-text-color);
|
|
@@ -34846,35 +35015,35 @@ var TimestampDisplay = styled20("div")`
|
|
|
34846
35015
|
border-radius: var(--j-radius-md);
|
|
34847
35016
|
text-align: center;
|
|
34848
35017
|
`;
|
|
34849
|
-
var CheckboxContainer =
|
|
35018
|
+
var CheckboxContainer = styled21("div")`
|
|
34850
35019
|
display: flex;
|
|
34851
35020
|
align-items: flex-start;
|
|
34852
35021
|
gap: 0.5rem;
|
|
34853
35022
|
margin-top: 1rem;
|
|
34854
35023
|
`;
|
|
34855
|
-
var CheckboxInput =
|
|
35024
|
+
var CheckboxInput = styled21("input")`
|
|
34856
35025
|
width: 1rem;
|
|
34857
35026
|
height: 1rem;
|
|
34858
35027
|
margin-top: 0.125rem;
|
|
34859
35028
|
cursor: pointer;
|
|
34860
35029
|
accent-color: var(--j-primary-color);
|
|
34861
35030
|
`;
|
|
34862
|
-
var CheckboxLabel =
|
|
35031
|
+
var CheckboxLabel = styled21("label")`
|
|
34863
35032
|
font-size: 0.875rem;
|
|
34864
35033
|
color: var(--j-text-color);
|
|
34865
35034
|
cursor: pointer;
|
|
34866
35035
|
line-height: 1.25rem;
|
|
34867
35036
|
`;
|
|
34868
|
-
var EditorContainer =
|
|
35037
|
+
var EditorContainer = styled21("div")`
|
|
34869
35038
|
margin-top: 1rem;
|
|
34870
35039
|
`;
|
|
34871
35040
|
|
|
34872
35041
|
// src/inspector/viewer/page.tsx
|
|
34873
35042
|
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
|
|
34874
|
-
var BasePageContainer =
|
|
35043
|
+
var BasePageContainer = import_react22.default.forwardRef(
|
|
34875
35044
|
({ isTopLevel, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { ref, ...rest })
|
|
34876
35045
|
);
|
|
34877
|
-
var PageContainer =
|
|
35046
|
+
var PageContainer = styled22(BasePageContainer)`
|
|
34878
35047
|
position: absolute;
|
|
34879
35048
|
z-index: 10;
|
|
34880
35049
|
inset: 0;
|
|
@@ -34882,36 +35051,36 @@ var PageContainer = styled21(BasePageContainer)`
|
|
|
34882
35051
|
height: 100%;
|
|
34883
35052
|
padding: 0 0.75rem;
|
|
34884
35053
|
`;
|
|
34885
|
-
var BackButton =
|
|
35054
|
+
var BackButton = styled22("div")`
|
|
34886
35055
|
position: absolute;
|
|
34887
35056
|
left: 0;
|
|
34888
35057
|
right: 0;
|
|
34889
35058
|
top: 0;
|
|
34890
35059
|
height: 2.5rem;
|
|
34891
35060
|
`;
|
|
34892
|
-
var HeaderContainer =
|
|
35061
|
+
var HeaderContainer = styled22("div")`
|
|
34893
35062
|
display: flex;
|
|
34894
35063
|
justify-content: space-between;
|
|
34895
35064
|
align-items: center;
|
|
34896
35065
|
margin-bottom: 1rem;
|
|
34897
35066
|
`;
|
|
34898
|
-
var TitleContainer =
|
|
35067
|
+
var TitleContainer = styled22("div")`
|
|
34899
35068
|
display: flex;
|
|
34900
35069
|
align-items: center;
|
|
34901
35070
|
gap: 0.75rem;
|
|
34902
35071
|
`;
|
|
34903
|
-
var Title =
|
|
35072
|
+
var Title = styled22(Heading)`
|
|
34904
35073
|
display: flex;
|
|
34905
35074
|
flex-direction: column;
|
|
34906
35075
|
align-items: flex-start;
|
|
34907
35076
|
gap: 0.25rem;
|
|
34908
35077
|
`;
|
|
34909
|
-
var BadgeContainer =
|
|
35078
|
+
var BadgeContainer = styled22("div")`
|
|
34910
35079
|
display: flex;
|
|
34911
35080
|
align-items: center;
|
|
34912
35081
|
gap: 0.75rem;
|
|
34913
35082
|
`;
|
|
34914
|
-
var ContentContainer =
|
|
35083
|
+
var ContentContainer = styled22("div")`
|
|
34915
35084
|
overflow: auto;
|
|
34916
35085
|
display: flex;
|
|
34917
35086
|
flex-direction: column;
|
|
@@ -34957,7 +35126,14 @@ function View(props) {
|
|
|
34957
35126
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AccountView, { data: snapshot, node, onNavigate });
|
|
34958
35127
|
}
|
|
34959
35128
|
if (type === "coplaintext") {
|
|
34960
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
35129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
35130
|
+
CoPlainTextView,
|
|
35131
|
+
{
|
|
35132
|
+
data: snapshot,
|
|
35133
|
+
coValue: value,
|
|
35134
|
+
node
|
|
35135
|
+
}
|
|
35136
|
+
);
|
|
34961
35137
|
}
|
|
34962
35138
|
if (type === "colist") {
|
|
34963
35139
|
const handleRemove = (index) => {
|
|
@@ -35061,10 +35237,10 @@ function Page(props) {
|
|
|
35061
35237
|
}
|
|
35062
35238
|
|
|
35063
35239
|
// src/inspector/ui/error-boundary.tsx
|
|
35064
|
-
var
|
|
35240
|
+
var import_react23 = __toESM(require_react(), 1);
|
|
35065
35241
|
var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
|
|
35066
|
-
import { styled as
|
|
35067
|
-
var ErrorBoundary = class extends
|
|
35242
|
+
import { styled as styled23 } from "goober";
|
|
35243
|
+
var ErrorBoundary = class extends import_react23.default.Component {
|
|
35068
35244
|
constructor(props) {
|
|
35069
35245
|
super(props);
|
|
35070
35246
|
this.state = { hasError: false };
|
|
@@ -35086,7 +35262,7 @@ var ErrorBoundary = class extends import_react22.default.Component {
|
|
|
35086
35262
|
return this.props.children;
|
|
35087
35263
|
}
|
|
35088
35264
|
};
|
|
35089
|
-
var StyledHeading2 =
|
|
35265
|
+
var StyledHeading2 = styled23("h1")`
|
|
35090
35266
|
font-size: 1.125rem;
|
|
35091
35267
|
font-weight: 500;
|
|
35092
35268
|
color: var(--j-text-color-strong);
|
|
@@ -35094,7 +35270,7 @@ var StyledHeading2 = styled22("h1")`
|
|
|
35094
35270
|
|
|
35095
35271
|
// src/inspector/viewer/page-stack.tsx
|
|
35096
35272
|
var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
|
|
35097
|
-
var PageStackContainer =
|
|
35273
|
+
var PageStackContainer = styled24("div")`
|
|
35098
35274
|
position: relative;
|
|
35099
35275
|
padding: 0 0.75rem;
|
|
35100
35276
|
overflow-y: auto;
|
|
@@ -35128,10 +35304,10 @@ function PageStack({
|
|
|
35128
35304
|
}
|
|
35129
35305
|
|
|
35130
35306
|
// src/inspector/viewer/use-page-path.ts
|
|
35131
|
-
var
|
|
35307
|
+
var import_react24 = __toESM(require_react(), 1);
|
|
35132
35308
|
var STORAGE_KEY = "jazz-inspector-paths";
|
|
35133
35309
|
function usePagePath(defaultPath) {
|
|
35134
|
-
const [path, setPath] = (0,
|
|
35310
|
+
const [path, setPath] = (0, import_react24.useState)(() => {
|
|
35135
35311
|
if (typeof window === "undefined") return [];
|
|
35136
35312
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
35137
35313
|
if (stored) {
|
|
@@ -35143,34 +35319,34 @@ function usePagePath(defaultPath) {
|
|
|
35143
35319
|
}
|
|
35144
35320
|
return defaultPath || [];
|
|
35145
35321
|
});
|
|
35146
|
-
const updatePath = (0,
|
|
35322
|
+
const updatePath = (0, import_react24.useCallback)((newPath) => {
|
|
35147
35323
|
setPath(newPath);
|
|
35148
35324
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(newPath));
|
|
35149
35325
|
}, []);
|
|
35150
|
-
(0,
|
|
35326
|
+
(0, import_react24.useEffect)(() => {
|
|
35151
35327
|
if (defaultPath && JSON.stringify(path) !== JSON.stringify(defaultPath)) {
|
|
35152
35328
|
updatePath(defaultPath);
|
|
35153
35329
|
}
|
|
35154
35330
|
}, [defaultPath, path, updatePath]);
|
|
35155
|
-
const addPages = (0,
|
|
35331
|
+
const addPages = (0, import_react24.useCallback)(
|
|
35156
35332
|
(newPages) => {
|
|
35157
35333
|
updatePath([...path, ...newPages]);
|
|
35158
35334
|
},
|
|
35159
35335
|
[path, updatePath]
|
|
35160
35336
|
);
|
|
35161
|
-
const goToIndex = (0,
|
|
35337
|
+
const goToIndex = (0, import_react24.useCallback)(
|
|
35162
35338
|
(index) => {
|
|
35163
35339
|
updatePath(path.slice(0, index + 1));
|
|
35164
35340
|
},
|
|
35165
35341
|
[path, updatePath]
|
|
35166
35342
|
);
|
|
35167
|
-
const setPage = (0,
|
|
35343
|
+
const setPage = (0, import_react24.useCallback)(
|
|
35168
35344
|
(coId) => {
|
|
35169
35345
|
updatePath([{ coId, name: "Root" }]);
|
|
35170
35346
|
},
|
|
35171
35347
|
[updatePath]
|
|
35172
35348
|
);
|
|
35173
|
-
const goBack = (0,
|
|
35349
|
+
const goBack = (0, import_react24.useCallback)(() => {
|
|
35174
35350
|
if (path.length > 1) {
|
|
35175
35351
|
updatePath(path.slice(0, path.length - 1));
|
|
35176
35352
|
}
|
|
@@ -35185,8 +35361,8 @@ function usePagePath(defaultPath) {
|
|
|
35185
35361
|
}
|
|
35186
35362
|
|
|
35187
35363
|
// src/inspector/ui/global-styles.tsx
|
|
35188
|
-
import { styled as
|
|
35189
|
-
var GlobalStyles =
|
|
35364
|
+
import { styled as styled25 } from "goober";
|
|
35365
|
+
var GlobalStyles = styled25("div")`
|
|
35190
35366
|
/* Colors */
|
|
35191
35367
|
--j-primary-color: #146AFF;
|
|
35192
35368
|
--j-link-color: var(--j-primary-color);
|
|
@@ -35261,8 +35437,8 @@ var GlobalStyles = styled24("div")`
|
|
|
35261
35437
|
|
|
35262
35438
|
// src/inspector/viewer/inspector-button.tsx
|
|
35263
35439
|
var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
|
|
35264
|
-
import { styled as
|
|
35265
|
-
var StyledInspectorButton =
|
|
35440
|
+
import { styled as styled26 } from "goober";
|
|
35441
|
+
var StyledInspectorButton = styled26("button")`
|
|
35266
35442
|
position: fixed;
|
|
35267
35443
|
width: 2.5rem;
|
|
35268
35444
|
height: 2.5rem;
|
|
@@ -35293,7 +35469,7 @@ var StyledInspectorButton = styled25("button")`
|
|
|
35293
35469
|
}
|
|
35294
35470
|
}}
|
|
35295
35471
|
`;
|
|
35296
|
-
var JazzIcon =
|
|
35472
|
+
var JazzIcon = styled26("svg")`
|
|
35297
35473
|
width: 100%;
|
|
35298
35474
|
height: auto;
|
|
35299
35475
|
position: relative;
|
|
@@ -35345,27 +35521,27 @@ function InspectorButton({
|
|
|
35345
35521
|
}
|
|
35346
35522
|
|
|
35347
35523
|
// src/inspector/viewer/use-open-inspector.ts
|
|
35348
|
-
var
|
|
35524
|
+
var import_react25 = __toESM(require_react(), 1);
|
|
35349
35525
|
var STORAGE_KEY2 = "jazz-inspector-open";
|
|
35350
35526
|
function useOpenInspector() {
|
|
35351
|
-
const [open, setOpen] = (0,
|
|
35527
|
+
const [open, setOpen] = (0, import_react25.useState)(() => {
|
|
35352
35528
|
if (typeof window === "undefined") return false;
|
|
35353
35529
|
const stored = localStorage.getItem(STORAGE_KEY2);
|
|
35354
35530
|
return stored ? JSON.parse(stored) : false;
|
|
35355
35531
|
});
|
|
35356
|
-
(0,
|
|
35532
|
+
(0, import_react25.useEffect)(() => {
|
|
35357
35533
|
localStorage.setItem(STORAGE_KEY2, JSON.stringify(open));
|
|
35358
35534
|
}, [open]);
|
|
35359
35535
|
return [open, setOpen];
|
|
35360
35536
|
}
|
|
35361
35537
|
|
|
35362
35538
|
// src/inspector/viewer/delete-local-data.tsx
|
|
35363
|
-
var
|
|
35539
|
+
var import_react26 = __toESM(require_react(), 1);
|
|
35364
35540
|
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
|
|
35365
35541
|
var DELETE_LOCAL_DATA_STRING = "delete my local data";
|
|
35366
35542
|
function DeleteLocalData() {
|
|
35367
|
-
const [showDeleteModal, setShowDeleteModal] = (0,
|
|
35368
|
-
const [confirmDeleteString, setConfirmDeleteString] = (0,
|
|
35543
|
+
const [showDeleteModal, setShowDeleteModal] = (0, import_react26.useState)(false);
|
|
35544
|
+
const [confirmDeleteString, setConfirmDeleteString] = (0, import_react26.useState)("");
|
|
35369
35545
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
35370
35546
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { variant: "destructive", onClick: () => setShowDeleteModal(true), children: "Delete my local data" }),
|
|
35371
35547
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
@@ -35480,7 +35656,7 @@ function DeleteLocalData() {
|
|
|
35480
35656
|
|
|
35481
35657
|
// src/inspector/viewer/new-app.tsx
|
|
35482
35658
|
var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
|
|
35483
|
-
var InspectorContainer =
|
|
35659
|
+
var InspectorContainer = styled27("div")`
|
|
35484
35660
|
position: fixed;
|
|
35485
35661
|
height: 50vh;
|
|
35486
35662
|
max-height: 800px;
|
|
@@ -35497,17 +35673,17 @@ var InspectorContainer = styled26("div")`
|
|
|
35497
35673
|
background-color: var(--j-background);
|
|
35498
35674
|
}
|
|
35499
35675
|
`;
|
|
35500
|
-
var HeaderContainer2 =
|
|
35676
|
+
var HeaderContainer2 = styled27("div")`
|
|
35501
35677
|
display: flex;
|
|
35502
35678
|
align-items: center;
|
|
35503
35679
|
gap: 1rem;
|
|
35504
35680
|
padding: 0 0.75rem;
|
|
35505
35681
|
margin: 0.75rem 0;
|
|
35506
35682
|
`;
|
|
35507
|
-
var Form =
|
|
35683
|
+
var Form = styled27("form")`
|
|
35508
35684
|
width: 24rem;
|
|
35509
35685
|
`;
|
|
35510
|
-
var InitialForm =
|
|
35686
|
+
var InitialForm = styled27("form")`
|
|
35511
35687
|
display: flex;
|
|
35512
35688
|
flex-direction: column;
|
|
35513
35689
|
position: relative;
|
|
@@ -35519,7 +35695,7 @@ var InitialForm = styled26("form")`
|
|
|
35519
35695
|
max-width: 24rem;
|
|
35520
35696
|
margin: 0 auto;
|
|
35521
35697
|
`;
|
|
35522
|
-
var OrText =
|
|
35698
|
+
var OrText = styled27("p")`
|
|
35523
35699
|
text-align: center;
|
|
35524
35700
|
`;
|
|
35525
35701
|
function JazzInspectorInternal({
|
|
@@ -35528,7 +35704,7 @@ function JazzInspectorInternal({
|
|
|
35528
35704
|
accountId
|
|
35529
35705
|
}) {
|
|
35530
35706
|
const [open, setOpen] = useOpenInspector();
|
|
35531
|
-
const [coValueId, setCoValueId] = (0,
|
|
35707
|
+
const [coValueId, setCoValueId] = (0, import_react27.useState)("");
|
|
35532
35708
|
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
|
35533
35709
|
const handleCoValueIdSubmit = (e) => {
|
|
35534
35710
|
e.preventDefault();
|
|
@@ -35607,7 +35783,7 @@ function JazzInspectorInternal({
|
|
|
35607
35783
|
|
|
35608
35784
|
// src/inspector/custom-element.tsx
|
|
35609
35785
|
var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
|
|
35610
|
-
setup(
|
|
35786
|
+
setup(import_react28.default.createElement);
|
|
35611
35787
|
var JazzInspectorElement = class extends HTMLElement {
|
|
35612
35788
|
constructor() {
|
|
35613
35789
|
super(...arguments);
|
|
@@ -35775,4 +35951,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
35775
35951
|
* LICENSE file in the root directory of this source tree.
|
|
35776
35952
|
*)
|
|
35777
35953
|
*/
|
|
35778
|
-
//# sourceMappingURL=custom-element-
|
|
35954
|
+
//# sourceMappingURL=custom-element-P76EIWEV.js.map
|