@powerhousedao/design-system 6.2.3-dev.60 → 6.2.3-dev.62
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/dist/PinFilled-cSbUqZCA.js +41 -0
- package/dist/PinFilled-cSbUqZCA.js.map +1 -0
- package/dist/add-local-drive-form.impl-B5rVul7f.js +75 -0
- package/dist/add-local-drive-form.impl-B5rVul7f.js.map +1 -0
- package/dist/add-remote-drive-form.impl-D7zuqHJC.js +114 -0
- package/dist/add-remote-drive-form.impl-D7zuqHJC.js.map +1 -0
- package/dist/address-DsZy0bjk.js +92 -0
- package/dist/address-DsZy0bjk.js.map +1 -0
- package/dist/{checkbox-BmTXBcCE.d.ts → checkbox-DmRYkN10.d.ts} +2 -2
- package/dist/{checkbox-BmTXBcCE.d.ts.map → checkbox-DmRYkN10.d.ts.map} +1 -1
- package/dist/combobox.impl-C2oszOl2.js +144 -0
- package/dist/combobox.impl-C2oszOl2.js.map +1 -0
- package/dist/connect/components/toast/toast.js +2 -2
- package/dist/connect/index.d.ts +81 -33
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +184 -1608
- package/dist/connect/index.js.map +1 -1
- package/dist/{content-BMXLcwWY.d.ts → content-L3OINRSY.d.ts} +2 -2
- package/dist/{content-BMXLcwWY.d.ts.map → content-L3OINRSY.d.ts.map} +1 -1
- package/dist/default-editor.impl-a6EOuEme.js +30 -0
- package/dist/default-editor.impl-a6EOuEme.js.map +1 -0
- package/dist/document-timeline.impl-DRmIHFaI.js +254 -0
- package/dist/document-timeline.impl-DRmIHFaI.js.map +1 -0
- package/dist/drive-settings-form.impl-4yBGaTxe.js +171 -0
- package/dist/drive-settings-form.impl-4yBGaTxe.js.map +1 -0
- package/dist/{enum-field-qgV9wsyI.d.ts → enum-field-CSeQE4Ss.d.ts} +3 -3
- package/dist/{enum-field-qgV9wsyI.d.ts.map → enum-field-CSeQE4Ss.d.ts.map} +1 -1
- package/dist/formatted-json-viewer.impl-C198BZt5.js +58 -0
- package/dist/formatted-json-viewer.impl-C198BZt5.js.map +1 -0
- package/dist/icon-CR_tC1gc.js +358 -0
- package/dist/icon-CR_tC1gc.js.map +1 -0
- package/dist/{icon-01W_S_9A.js → icon-components-BZ_bQZmJ.js} +5 -479
- package/dist/icon-components-BZ_bQZmJ.js.map +1 -0
- package/dist/{id-autocomplete-CHvGhffo.d.ts → id-autocomplete-0bhU6VQG.d.ts} +2 -2
- package/dist/id-autocomplete-0bhU6VQG.d.ts.map +1 -0
- package/dist/{id-autocomplete-input-container-BqRQGpcs.d.ts → id-autocomplete-input-container-xg9lrpSK.d.ts} +2 -2
- package/dist/{id-autocomplete-input-container-BqRQGpcs.d.ts.map → id-autocomplete-input-container-xg9lrpSK.d.ts.map} +1 -1
- package/dist/{id-autocomplete-list-ChQsiJDg.d.ts → id-autocomplete-list-Da3FbpJ1.d.ts} +2 -2
- package/dist/{id-autocomplete-list-ChQsiJDg.d.ts.map → id-autocomplete-list-Da3FbpJ1.d.ts.map} +1 -1
- package/dist/{id-autocomplete-list-option-MsqKeLXD.d.ts → id-autocomplete-list-option-D7JgEK6E.d.ts} +3 -2
- package/dist/id-autocomplete-list-option-D7JgEK6E.d.ts.map +1 -0
- package/dist/index-C-Tup7Br.d.ts +4 -0
- package/dist/{index-C05uhexJ.d.ts → index-D99twPFI.d.ts} +6 -15
- package/dist/index-D99twPFI.d.ts.map +1 -0
- package/dist/index-D9nAoDks.d.ts +30 -0
- package/dist/index-FfMAMBu7.d.ts +3 -0
- package/dist/index-jfVVOU-H.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/label-nH2HoKfI.js +15 -0
- package/dist/label-nH2HoKfI.js.map +1 -0
- package/dist/location-info-C3YbSsV0.js +47 -0
- package/dist/location-info-C3YbSsV0.js.map +1 -0
- package/dist/{radio-group-field-CjX_Zt0C.d.ts → radio-group-field-Bsf4waat.d.ts} +2 -2
- package/dist/{radio-group-field-CjX_Zt0C.d.ts.map → radio-group-field-Bsf4waat.d.ts.map} +1 -1
- package/dist/revision-history.impl-uogo6xDI.js +638 -0
- package/dist/revision-history.impl-uogo6xDI.js.map +1 -0
- package/dist/{select-field-BuXjM43L.d.ts → select-field-DbFd1YiC.d.ts} +2 -2
- package/dist/{select-field-BuXjM43L.d.ts.map → select-field-DbFd1YiC.d.ts.map} +1 -1
- package/dist/{selected-content-C49jmTLU.d.ts → selected-content-VMVPoru4.d.ts} +2 -2
- package/dist/{selected-content-C49jmTLU.d.ts.map → selected-content-VMVPoru4.d.ts.map} +1 -1
- package/dist/{sidebar-4juLhREX.d.ts → sidebar-DFqreKf1.d.ts} +2 -2
- package/dist/{sidebar-4juLhREX.d.ts.map → sidebar-DFqreKf1.d.ts.map} +1 -1
- package/dist/{sidebar-provider-CMG6WQWo.d.ts → sidebar-provider-CZHhqW5n.d.ts} +2 -2
- package/dist/{sidebar-provider-CMG6WQWo.d.ts.map → sidebar-provider-CZHhqW5n.d.ts.map} +1 -1
- package/dist/{splitted-input-diff-DBkgDh9Q.d.ts → splitted-input-diff-BKRMH7vI.d.ts} +2 -2
- package/dist/{splitted-input-diff-DBkgDh9Q.d.ts.map → splitted-input-diff-BKRMH7vI.d.ts.map} +1 -1
- package/dist/{src-CrUksCLW.js → src-B2s8MAp7.js} +148 -5
- package/dist/src-B2s8MAp7.js.map +1 -0
- package/dist/{text-field-3j4fLJ-7.d.ts → text-field-CtatgqNu.d.ts} +3 -3
- package/dist/{text-field-3j4fLJ-7.d.ts.map → text-field-CtatgqNu.d.ts.map} +1 -1
- package/dist/{text-input-tkqggbWx.d.ts → text-input-BSxhvnyx.d.ts} +2 -2
- package/dist/{text-input-tkqggbWx.d.ts.map → text-input-BSxhvnyx.d.ts.map} +1 -1
- package/dist/{text-input-diff-B7iFyzTK.d.ts → text-input-diff-CaZoFDjA.d.ts} +2 -2
- package/dist/{text-input-diff-B7iFyzTK.d.ts.map → text-input-diff-CaZoFDjA.d.ts.map} +1 -1
- package/dist/{types-DDSmPhHp.d.ts → types-FTqFl5du.d.ts} +2 -2
- package/dist/{types-DDSmPhHp.d.ts.map → types-FTqFl5du.d.ts.map} +1 -1
- package/dist/types-TZijOYrE.d.ts +17 -0
- package/dist/types-TZijOYrE.d.ts.map +1 -0
- package/dist/ui/components/checkbox/checkbox.d.ts +1 -1
- package/dist/ui/components/command/command.js +1 -1
- package/dist/ui/components/enum-field/enum-field.d.ts +1 -1
- package/dist/ui/components/enum-field/types.d.ts +1 -1
- package/dist/ui/components/form-label/form-label.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/types.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/use-id-autocomplete.d.ts +1 -1
- package/dist/ui/components/index.d.ts +20 -20
- package/dist/ui/components/input/splitted-input-diff.d.ts +1 -1
- package/dist/ui/components/input/splitted-input-diff.js +1 -1
- package/dist/ui/components/input/subcomponent/text-diff.d.ts +1 -1
- package/dist/ui/components/radio-group-field/radio-group-field.d.ts +1 -1
- package/dist/ui/components/select-field/content.d.ts +1 -1
- package/dist/ui/components/select-field/content.js +1 -1
- package/dist/ui/components/select-field/select-field.d.ts +1 -1
- package/dist/ui/components/select-field/selected-content.d.ts +1 -1
- package/dist/ui/components/select-field/selected-content.js +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.d.ts +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.js +1 -1
- package/dist/ui/components/select-field/use-select-field.d.ts +1 -1
- package/dist/ui/components/sidebar/index.d.ts +4 -4
- package/dist/ui/components/sidebar/sidebar.d.ts +1 -1
- package/dist/ui/components/sidebar/sidebar.js +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-content-area.js +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-item.d.ts +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-item.js +2 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-item.js.map +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-provider/index.d.ts +2 -2
- package/dist/ui/components/sidebar/subcomponents/sidebar-provider/sidebar-provider.d.ts +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-provider/sidebar-reducer.d.ts +1 -1
- package/dist/ui/components/sidebar/subcomponents/sidebar-search/sidebar-search.js +1 -1
- package/dist/ui/components/sidebar/subcomponents/status-icon.d.ts +1 -1
- package/dist/ui/components/sidebar/subcomponents/status-icon.js +1 -1
- package/dist/ui/components/sidebar/types.d.ts +1 -1
- package/dist/ui/components/sidebar/utils.d.ts +1 -1
- package/dist/ui/components/text-field/text-field.d.ts +1 -1
- package/dist/ui/components/text-input/text-input-diff.d.ts +1 -1
- package/dist/ui/components/text-input/text-input.d.ts +1 -1
- package/dist/ui/components/types.d.ts +1 -1
- package/dist/ui/components/value-transformer/value-transformer.d.ts +1 -1
- package/dist/ui/components/with-field-validation/with-field-validation.d.ts +1 -1
- package/dist/ui/index.d.ts +21 -21
- package/dist/ui/types.d.ts +1 -1
- package/dist/{use-id-autocomplete-wdw3CfYc.d.ts → use-id-autocomplete-DSRXA4Wt.d.ts} +2 -2
- package/dist/{use-id-autocomplete-wdw3CfYc.d.ts.map → use-id-autocomplete-DSRXA4Wt.d.ts.map} +1 -1
- package/dist/{value-transformer-BAD6r8Ol.d.ts → value-transformer-Dv-10UyC.d.ts} +2 -2
- package/dist/{value-transformer-BAD6r8Ol.d.ts.map → value-transformer-Dv-10UyC.d.ts.map} +1 -1
- package/dist/{with-field-validation-Bt02MQn2.d.ts → with-field-validation-WiD_NFDk.d.ts} +2 -2
- package/dist/{with-field-validation-Bt02MQn2.d.ts.map → with-field-validation-WiD_NFDk.d.ts.map} +1 -1
- package/package.json +4 -4
- package/dist/icon-01W_S_9A.js.map +0 -1
- package/dist/id-autocomplete-CHvGhffo.d.ts.map +0 -1
- package/dist/id-autocomplete-list-option-MsqKeLXD.d.ts.map +0 -1
- package/dist/index-C05uhexJ.d.ts.map +0 -1
- package/dist/index-CpSqVZKp.d.ts +0 -2
- package/dist/index-DSknqh8u.d.ts +0 -30
- package/dist/index-DU-WgcAh.d.ts +0 -4
- package/dist/index-DaRBrjZI.d.ts +0 -3
- package/dist/src-CrUksCLW.js.map +0 -1
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
import { n as usePagination, u as Pagination } from "./src-B2s8MAp7.js";
|
|
2
|
+
import { t as Icon } from "./icon-CR_tC1gc.js";
|
|
3
|
+
import { i as ENSAvatar, n as useEns, r as FormattedJsonViewer, t as formatEthAddress } from "./address-DsZy0bjk.js";
|
|
4
|
+
import { ConnectSelect, ConnectTooltipProvider } from "./connect/index.js";
|
|
5
|
+
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Anchor, Content, Portal, Root, Trigger } from "@radix-ui/react-popover";
|
|
9
|
+
import { format } from "date-fns";
|
|
10
|
+
import { useCopyToClipboard } from "usehooks-ts";
|
|
11
|
+
import { funnel } from "remeda";
|
|
12
|
+
import { garbageCollect, sortOperations } from "@powerhousedao/shared/document-model";
|
|
13
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
14
|
+
//#region src/connect/components/revision-history/header/branch.tsx
|
|
15
|
+
function Branch(props) {
|
|
16
|
+
const { branch = "main" } = props;
|
|
17
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
18
|
+
className: "flex h-8 w-fit items-center gap-1 rounded-lg bg-background pr-2 pl-1 text-xs text-foreground",
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Icon, { name: "Branch" }),
|
|
21
|
+
/* @__PURE__ */ jsx("span", { children: "BRANCH" }),
|
|
22
|
+
/* @__PURE__ */ jsx("span", {
|
|
23
|
+
className: "text-foreground",
|
|
24
|
+
children: branch
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/connect/components/revision-history/header/doc-id.tsx
|
|
31
|
+
function DocId(props) {
|
|
32
|
+
const { docId, onCopy } = props;
|
|
33
|
+
const [, copy] = useCopyToClipboard();
|
|
34
|
+
function handleCopy(text) {
|
|
35
|
+
return () => {
|
|
36
|
+
copy(text).then(() => {
|
|
37
|
+
onCopy?.();
|
|
38
|
+
}).catch((error) => {
|
|
39
|
+
console.error("Failed to copy!", error);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
44
|
+
className: "flex h-8 w-fit items-center gap-1 rounded-lg bg-background pr-2 pl-1 text-xs text-foreground",
|
|
45
|
+
onClick: handleCopy(docId),
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Icon, { name: "Link" }),
|
|
48
|
+
"DOC ID",
|
|
49
|
+
/* @__PURE__ */ jsx("span", {
|
|
50
|
+
className: "text-foreground",
|
|
51
|
+
children: docId
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/connect/components/revision-history/header/document-state.tsx
|
|
58
|
+
const DocumentState = (props) => {
|
|
59
|
+
const { documentState, onCopyState } = props;
|
|
60
|
+
const [, copy] = useCopyToClipboard();
|
|
61
|
+
function handleCopy() {
|
|
62
|
+
const jsonState = JSON.stringify(documentState, null, 2);
|
|
63
|
+
copy(jsonState).then(() => {
|
|
64
|
+
onCopyState?.();
|
|
65
|
+
}).catch((error) => {
|
|
66
|
+
console.error("Failed to copy document state!", error);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return /* @__PURE__ */ jsx("button", {
|
|
70
|
+
className: "rounded-lg bg-background p-1 text-foreground",
|
|
71
|
+
onClick: handleCopy,
|
|
72
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "CurlyBrackets" })
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/connect/components/revision-history/header/scope.tsx
|
|
77
|
+
function labelFor(scope) {
|
|
78
|
+
return `${scope.charAt(0).toUpperCase()}${scope.slice(1)} scope`;
|
|
79
|
+
}
|
|
80
|
+
function Scope(props) {
|
|
81
|
+
const { scopes, value, onChange } = props;
|
|
82
|
+
const items = scopes.map((scope) => ({
|
|
83
|
+
displayValue: labelFor(scope),
|
|
84
|
+
value: scope
|
|
85
|
+
}));
|
|
86
|
+
return /* @__PURE__ */ jsx(ConnectSelect, {
|
|
87
|
+
absolutePositionMenu: true,
|
|
88
|
+
containerClassName: "z-10 w-fit rounded-lg bg-background text-xs text-muted-foreground",
|
|
89
|
+
id: "scope select",
|
|
90
|
+
itemClassName: "grid grid-cols-[auto,auto] gap-1 py-2 text-muted-foreground",
|
|
91
|
+
items,
|
|
92
|
+
menuClassName: "min-w-0 text-muted-foreground",
|
|
93
|
+
onChange,
|
|
94
|
+
value
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/connect/components/revision-history/header/header.tsx
|
|
99
|
+
function Header(props) {
|
|
100
|
+
const { title, docId, scope, scopes, onChangeScope, onClose, className, documentState, onCopyState, onCopyDocId, ...divProps } = props;
|
|
101
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
102
|
+
className: twMerge("flex items-center justify-between bg-transparent", className),
|
|
103
|
+
...divProps,
|
|
104
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
105
|
+
className: "flex items-center gap-3",
|
|
106
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
107
|
+
name: "close-revision-history",
|
|
108
|
+
className: "rounded-lg bg-background p-1 text-foreground shadow-button",
|
|
109
|
+
onClick: onClose,
|
|
110
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "VariantArrowLeft" })
|
|
111
|
+
}), /* @__PURE__ */ jsx("h1", {
|
|
112
|
+
className: "text-xs text-foreground",
|
|
113
|
+
children: title
|
|
114
|
+
})]
|
|
115
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
116
|
+
className: "flex items-center gap-2",
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsx(DocId, {
|
|
119
|
+
docId,
|
|
120
|
+
onCopy: onCopyDocId
|
|
121
|
+
}),
|
|
122
|
+
documentState && /* @__PURE__ */ jsx(DocumentState, {
|
|
123
|
+
documentState,
|
|
124
|
+
onCopyState
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ jsx(Branch, {}),
|
|
127
|
+
/* @__PURE__ */ jsx(Scope, {
|
|
128
|
+
onChange: onChangeScope,
|
|
129
|
+
scopes,
|
|
130
|
+
value: scope
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/connect/components/code-popover.tsx
|
|
138
|
+
function CodePopover(props) {
|
|
139
|
+
const { content, trigger, anchor } = props;
|
|
140
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
141
|
+
const opener = funnel(() => setIsOpen(true), {
|
|
142
|
+
triggerAt: "start",
|
|
143
|
+
minQuietPeriodMs: 300
|
|
144
|
+
});
|
|
145
|
+
const closer = funnel(() => setIsOpen(false), {
|
|
146
|
+
triggerAt: "start",
|
|
147
|
+
minQuietPeriodMs: 100
|
|
148
|
+
});
|
|
149
|
+
function open() {
|
|
150
|
+
closer.cancel();
|
|
151
|
+
opener.call();
|
|
152
|
+
}
|
|
153
|
+
function close() {
|
|
154
|
+
opener.cancel();
|
|
155
|
+
closer.call();
|
|
156
|
+
}
|
|
157
|
+
return /* @__PURE__ */ jsxs(Root, {
|
|
158
|
+
open: isOpen,
|
|
159
|
+
onOpenChange: (changedIsOpen) => changedIsOpen ? open() : close(),
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ jsx(Trigger, {
|
|
162
|
+
onMouseEnter: open,
|
|
163
|
+
children: trigger
|
|
164
|
+
}),
|
|
165
|
+
!!anchor && /* @__PURE__ */ jsx(Anchor, {
|
|
166
|
+
asChild: true,
|
|
167
|
+
children: anchor
|
|
168
|
+
}),
|
|
169
|
+
/* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, {
|
|
170
|
+
forceMount: true,
|
|
171
|
+
onMouseLeave: close,
|
|
172
|
+
sideOffset: -28,
|
|
173
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
174
|
+
collisionPadding: {
|
|
175
|
+
top: 24,
|
|
176
|
+
right: 24,
|
|
177
|
+
bottom: -1e4,
|
|
178
|
+
left: 24
|
|
179
|
+
},
|
|
180
|
+
className: "z-50 rounded-lg border border-border bg-popover p-2 text-xs text-popover-foreground shadow-tooltip outline-none",
|
|
181
|
+
children: content
|
|
182
|
+
}) })
|
|
183
|
+
]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/connect/components/revision-history/revision/address.tsx
|
|
188
|
+
function Address(props) {
|
|
189
|
+
const { address, chainId } = props;
|
|
190
|
+
const { data: ensData } = useEns(address);
|
|
191
|
+
if (!address) return null;
|
|
192
|
+
const shortenedAddress = formatEthAddress(address);
|
|
193
|
+
return /* @__PURE__ */ jsx(CodePopover, {
|
|
194
|
+
content: /* @__PURE__ */ jsx(FormattedJsonViewer, { value: { address } }),
|
|
195
|
+
trigger: /* @__PURE__ */ jsxs("span", {
|
|
196
|
+
className: "flex w-fit cursor-pointer items-center gap-1 rounded-lg bg-muted p-1 text-xs text-muted-foreground",
|
|
197
|
+
children: [/* @__PURE__ */ jsx(ENSAvatar, {
|
|
198
|
+
address,
|
|
199
|
+
chainId,
|
|
200
|
+
avatarUrl: ensData?.avatar_url ?? void 0
|
|
201
|
+
}), shortenedAddress]
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/connect/components/revision-history/revision/errors.tsx
|
|
207
|
+
function Errors(props) {
|
|
208
|
+
const { errors } = props;
|
|
209
|
+
const hasErrors = !!errors?.length;
|
|
210
|
+
const color = hasErrors ? "text-destructive" : "text-success";
|
|
211
|
+
const icon = hasErrors ? /* @__PURE__ */ jsx(Icon, {
|
|
212
|
+
name: "Exclamation",
|
|
213
|
+
size: 16
|
|
214
|
+
}) : /* @__PURE__ */ jsx(Icon, {
|
|
215
|
+
name: "Check",
|
|
216
|
+
size: 16
|
|
217
|
+
});
|
|
218
|
+
const text = hasErrors ? `Error: ${errors[0]}` : "No errors";
|
|
219
|
+
const content = /* @__PURE__ */ jsxs("span", {
|
|
220
|
+
className: twMerge("flex w-fit items-center rounded-lg border border-border bg-background px-2 py-1 text-xs", color, hasErrors && "cursor-pointer"),
|
|
221
|
+
children: [icon, /* @__PURE__ */ jsx("span", {
|
|
222
|
+
className: twMerge("inline-block max-w-36 truncate"),
|
|
223
|
+
children: text
|
|
224
|
+
})]
|
|
225
|
+
});
|
|
226
|
+
if (hasErrors) return /* @__PURE__ */ jsx(CodePopover, {
|
|
227
|
+
content: /* @__PURE__ */ jsx(FormattedJsonViewer, { value: errors }),
|
|
228
|
+
trigger: content
|
|
229
|
+
});
|
|
230
|
+
return content;
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/connect/components/revision-history/revision/operation.tsx
|
|
234
|
+
function Operation$1(props) {
|
|
235
|
+
const { operationType, operationInput } = props;
|
|
236
|
+
return /* @__PURE__ */ jsx(CodePopover, {
|
|
237
|
+
content: /* @__PURE__ */ jsx(FormattedJsonViewer, { value: operationInput }),
|
|
238
|
+
trigger: /* @__PURE__ */ jsxs("span", {
|
|
239
|
+
className: "flex cursor-pointer items-center gap-2 text-xs text-foreground",
|
|
240
|
+
children: [operationType, /* @__PURE__ */ jsx(Icon, {
|
|
241
|
+
className: "text-foreground",
|
|
242
|
+
name: "Braces",
|
|
243
|
+
size: 16
|
|
244
|
+
})]
|
|
245
|
+
})
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/connect/components/revision-history/revision/revision-number.tsx
|
|
250
|
+
function RevisionNumber(props) {
|
|
251
|
+
const { operationIndex, eventId, stateHash } = props;
|
|
252
|
+
const revisionNumber = operationIndex + 1;
|
|
253
|
+
return /* @__PURE__ */ jsx(CodePopover, {
|
|
254
|
+
content: /* @__PURE__ */ jsx(FormattedJsonViewer, { value: {
|
|
255
|
+
revisionNumber,
|
|
256
|
+
eventId,
|
|
257
|
+
stateHash
|
|
258
|
+
} }),
|
|
259
|
+
trigger: /* @__PURE__ */ jsxs("span", {
|
|
260
|
+
className: "flex cursor-pointer items-center gap-2 text-xs text-foreground",
|
|
261
|
+
children: [
|
|
262
|
+
"Revision ",
|
|
263
|
+
revisionNumber,
|
|
264
|
+
".",
|
|
265
|
+
/* @__PURE__ */ jsx("a", { children: /* @__PURE__ */ jsx(Icon, {
|
|
266
|
+
className: "cursor-pointer text-foreground",
|
|
267
|
+
name: "Ellipsis",
|
|
268
|
+
size: 14
|
|
269
|
+
}) })
|
|
270
|
+
]
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
//#endregion
|
|
275
|
+
//#region src/connect/components/revision-history/revision/signature.tsx
|
|
276
|
+
function Signature(props) {
|
|
277
|
+
const { signatures } = props;
|
|
278
|
+
if (!signatures?.length) return null;
|
|
279
|
+
return /* @__PURE__ */ jsx(CodePopover, {
|
|
280
|
+
trigger: /* @__PURE__ */ jsxs("span", {
|
|
281
|
+
className: "flex w-fit cursor-pointer items-center gap-1 rounded-lg border border-border bg-background px-2 py-1",
|
|
282
|
+
children: [
|
|
283
|
+
/* @__PURE__ */ jsx(VerificationStatus, { signatures }),
|
|
284
|
+
" ",
|
|
285
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
286
|
+
className: "text-foreground",
|
|
287
|
+
name: "InfoSquare",
|
|
288
|
+
size: 16
|
|
289
|
+
})
|
|
290
|
+
]
|
|
291
|
+
}),
|
|
292
|
+
content: /* @__PURE__ */ jsx(FormattedJsonViewer, {
|
|
293
|
+
value: signatures,
|
|
294
|
+
collapsed: 1
|
|
295
|
+
})
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function VerificationStatus(props) {
|
|
299
|
+
const { signatures } = props;
|
|
300
|
+
if (!signatures?.length) return null;
|
|
301
|
+
const signatureCount = signatures.length;
|
|
302
|
+
const verifiedSignaturesCount = signatures.filter((signature) => signature.isVerified).length;
|
|
303
|
+
const verificationStatusText = `${verifiedSignaturesCount}/${signatureCount} ${signatureCount === 1 ? "signature" : "signatures"} verified`;
|
|
304
|
+
return /* @__PURE__ */ jsx("span", {
|
|
305
|
+
className: twMerge(`text-xs`, verifiedSignaturesCount === 0 ? "text-destructive" : verifiedSignaturesCount === signatureCount ? "text-success" : "text-warning"),
|
|
306
|
+
children: verificationStatusText
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/connect/components/revision-history/revision/timestamp.tsx
|
|
311
|
+
function Timestamp(props) {
|
|
312
|
+
const { timestampUtcMs: timestamp } = props;
|
|
313
|
+
const timestampNumber = typeof timestamp === "string" && !timestamp.includes("-") ? parseInt(timestamp) : timestamp;
|
|
314
|
+
const date = new Date(timestampNumber);
|
|
315
|
+
const shortDate = format(date, "HH:mm 'UTC'");
|
|
316
|
+
const longDate = format(date, "eee, dd MMM yyyy HH:mm:ss 'UTC'");
|
|
317
|
+
return /* @__PURE__ */ jsx(CodePopover, {
|
|
318
|
+
content: /* @__PURE__ */ jsx(FormattedJsonViewer, { value: {
|
|
319
|
+
timestampFormatted: longDate,
|
|
320
|
+
timestampUtcMs: timestamp
|
|
321
|
+
} }),
|
|
322
|
+
trigger: /* @__PURE__ */ jsxs("span", {
|
|
323
|
+
className: "cursor-pointer text-xs text-foreground",
|
|
324
|
+
children: ["committed at ", shortDate]
|
|
325
|
+
})
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region src/connect/components/revision-history/revision/revision.tsx
|
|
330
|
+
function _Revision(props) {
|
|
331
|
+
return /* @__PURE__ */ jsxs("article", {
|
|
332
|
+
className: "flex items-center justify-between rounded-xl border border-border bg-background px-4 py-2",
|
|
333
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
334
|
+
className: "flex items-center gap-2",
|
|
335
|
+
children: [
|
|
336
|
+
/* @__PURE__ */ jsx(RevisionNumber, { ...props }),
|
|
337
|
+
/* @__PURE__ */ jsx(Operation$1, { ...props }),
|
|
338
|
+
/* @__PURE__ */ jsx(Address, { ...props }),
|
|
339
|
+
/* @__PURE__ */ jsx(Timestamp, { ...props })
|
|
340
|
+
]
|
|
341
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
342
|
+
className: "flex items-center gap-1",
|
|
343
|
+
children: [/* @__PURE__ */ jsx(Signature, { ...props }), /* @__PURE__ */ jsx(Errors, { ...props })]
|
|
344
|
+
})]
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
const Revision = /*#__PURE__*/ memo(_Revision);
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/connect/components/revision-history/skip/skip.tsx
|
|
350
|
+
function Skip(props) {
|
|
351
|
+
const { operationIndex, skipCount } = props;
|
|
352
|
+
const revisionNumber = operationIndex;
|
|
353
|
+
const skippedRevisions = skipCount === 1 ? `${revisionNumber}` : `${revisionNumber} - ${revisionNumber + 1 - skipCount}`;
|
|
354
|
+
return /* @__PURE__ */ jsxs("article", {
|
|
355
|
+
className: "grid grid-cols-[1fr,auto,1fr] items-center py-2",
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ jsx("div", { className: "h-px rounded-full bg-muted" }),
|
|
358
|
+
/* @__PURE__ */ jsxs("div", {
|
|
359
|
+
className: "mx-3 text-xs text-foreground",
|
|
360
|
+
children: [
|
|
361
|
+
"[Skipped Revision ",
|
|
362
|
+
skippedRevisions,
|
|
363
|
+
"]"
|
|
364
|
+
]
|
|
365
|
+
}),
|
|
366
|
+
/* @__PURE__ */ jsx("div", { className: "h-px rounded-full bg-muted" })
|
|
367
|
+
]
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region src/connect/components/revision-history/utils.ts
|
|
372
|
+
function makeRows(operations) {
|
|
373
|
+
const revisionsAndSkips = [];
|
|
374
|
+
const seenDays = /* @__PURE__ */ new Set();
|
|
375
|
+
for (const operation of operations) {
|
|
376
|
+
if (!operation.timestampUtcMs) continue;
|
|
377
|
+
const day = operation.timestampUtcMs.split("T")[0];
|
|
378
|
+
if (!seenDays.has(day)) {
|
|
379
|
+
seenDays.add(day);
|
|
380
|
+
revisionsAndSkips.push({
|
|
381
|
+
type: "day",
|
|
382
|
+
height: 32,
|
|
383
|
+
timestampUtcMs: day
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
revisionsAndSkips.push({
|
|
387
|
+
type: "revision",
|
|
388
|
+
height: 46,
|
|
389
|
+
operationIndex: operation.index,
|
|
390
|
+
eventId: operation.id ?? "EVENT_ID_NOT_FOUND",
|
|
391
|
+
stateHash: operation.hash,
|
|
392
|
+
operationType: operation.action.type,
|
|
393
|
+
operationInput: operation.action.input ?? {},
|
|
394
|
+
address: operation.action?.context?.signer?.user.address,
|
|
395
|
+
chainId: operation.action?.context?.signer?.user.chainId,
|
|
396
|
+
timestampUtcMs: operation.timestampUtcMs,
|
|
397
|
+
signatures: makeSignatures(operation.action?.context?.signer?.signatures ?? []),
|
|
398
|
+
errors: operation.error ? [operation.error] : void 0
|
|
399
|
+
});
|
|
400
|
+
if (operation.skip > 0) revisionsAndSkips.push({
|
|
401
|
+
type: "skip",
|
|
402
|
+
height: 34,
|
|
403
|
+
operationIndex: operation.index,
|
|
404
|
+
skipCount: operation.skip,
|
|
405
|
+
timestampUtcMs: operation.timestampUtcMs
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
return revisionsAndSkips;
|
|
409
|
+
}
|
|
410
|
+
function makeSignatureFromSignatureArray(signatureArray) {
|
|
411
|
+
const [signerAddress, hash, prevStateHash, signatureBytes] = signatureArray;
|
|
412
|
+
return {
|
|
413
|
+
signerAddress,
|
|
414
|
+
hash,
|
|
415
|
+
prevStateHash,
|
|
416
|
+
signatureBytes,
|
|
417
|
+
isVerified: true
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
function makeSignatures(signaturesArray) {
|
|
421
|
+
return signaturesArray?.map(makeSignatureFromSignatureArray);
|
|
422
|
+
}
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/connect/components/revision-history/timeline/day.tsx
|
|
425
|
+
function Day(props) {
|
|
426
|
+
const { timestampUtcMs: timestamp } = props;
|
|
427
|
+
const formattedDate = format(timestamp, "MMM dd, yyyy");
|
|
428
|
+
return /* @__PURE__ */ jsxs("h2", {
|
|
429
|
+
className: "-ml-6 flex items-center gap-1 bg-background py-2 text-xs text-foreground",
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
432
|
+
name: "Ring",
|
|
433
|
+
size: 16
|
|
434
|
+
}),
|
|
435
|
+
" Changes on ",
|
|
436
|
+
formattedDate
|
|
437
|
+
]
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/connect/components/revision-history/timeline/timeline.tsx
|
|
442
|
+
/** How far each row is indented from the timeline's vertical line. */
|
|
443
|
+
const ROW_INSET = 16;
|
|
444
|
+
/**
|
|
445
|
+
* How far the line is inset from the scroll container's clip edge -- exactly
|
|
446
|
+
* the amount the day marker hangs past it (24 pulled back from a 16 inset
|
|
447
|
+
* leaves 8 on the wrong side of zero). Without this the ring is sliced in
|
|
448
|
+
* half, since a scrolling box clips on both axes.
|
|
449
|
+
*/
|
|
450
|
+
const DAY_MARKER_OVERHANG = 8;
|
|
451
|
+
/**
|
|
452
|
+
* The revision timeline, windowed by row.
|
|
453
|
+
*
|
|
454
|
+
* The scroll element and the content are deliberately two different
|
|
455
|
+
* elements. A virtualizer decides what is visible by comparing its scroll
|
|
456
|
+
* element's viewport against the total content size, so a scroll element
|
|
457
|
+
* sized to the content is a viewport that shows everything at once: it never
|
|
458
|
+
* scrolls, every row is "visible", and the whole page renders while still
|
|
459
|
+
* paying the virtualizer's bookkeeping. The outer element here is therefore
|
|
460
|
+
* bounded and scrollable, and the inner sizer carries the full height that
|
|
461
|
+
* the absolutely positioned rows are placed within.
|
|
462
|
+
*/
|
|
463
|
+
function Timeline(props) {
|
|
464
|
+
const { operations, maxHeight = "70vh" } = props;
|
|
465
|
+
const rows = useMemo(() => makeRows([...operations]), [operations]);
|
|
466
|
+
const parentRef = useRef(null);
|
|
467
|
+
const rowVirtualizer = useVirtualizer({
|
|
468
|
+
count: rows.length,
|
|
469
|
+
getScrollElement: () => parentRef.current,
|
|
470
|
+
estimateSize: (i) => rows[i]?.height ?? 0,
|
|
471
|
+
gap: 8,
|
|
472
|
+
overscan: 8
|
|
473
|
+
});
|
|
474
|
+
return /* @__PURE__ */ jsx("div", {
|
|
475
|
+
"data-testid": "revision-timeline",
|
|
476
|
+
ref: parentRef,
|
|
477
|
+
style: {
|
|
478
|
+
maxHeight,
|
|
479
|
+
overflowY: "auto",
|
|
480
|
+
width: "100%",
|
|
481
|
+
position: "relative"
|
|
482
|
+
},
|
|
483
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
484
|
+
className: "border-l border-border dark:border-none",
|
|
485
|
+
style: {
|
|
486
|
+
height: `${rowVirtualizer.getTotalSize()}px`,
|
|
487
|
+
marginLeft: DAY_MARKER_OVERHANG,
|
|
488
|
+
position: "relative"
|
|
489
|
+
},
|
|
490
|
+
children: rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
491
|
+
const row = rows[virtualRow.index];
|
|
492
|
+
if (!row) return null;
|
|
493
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
494
|
+
style: {
|
|
495
|
+
position: "absolute",
|
|
496
|
+
top: 0,
|
|
497
|
+
left: ROW_INSET,
|
|
498
|
+
right: 0,
|
|
499
|
+
height: `${virtualRow.size}px`,
|
|
500
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
501
|
+
},
|
|
502
|
+
children: [
|
|
503
|
+
row.type === "revision" && /* @__PURE__ */ jsx(Revision, { ...row }),
|
|
504
|
+
row.type === "skip" && /* @__PURE__ */ jsx(Skip, { ...row }),
|
|
505
|
+
row.type === "day" && /* @__PURE__ */ jsx(Day, { ...row })
|
|
506
|
+
]
|
|
507
|
+
}, virtualRow.key);
|
|
508
|
+
})
|
|
509
|
+
})
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region src/connect/components/revision-history/revision-history.impl.tsx
|
|
514
|
+
/** The current, scoped props. */
|
|
515
|
+
/**
|
|
516
|
+
* Legacy props: the whole global and local history, toggled inside the
|
|
517
|
+
* component.
|
|
518
|
+
* @deprecated Pass one scope's `operations` with `scopes`/`scope`/`onScopeChange` and the loading props. Removed in the next major.
|
|
519
|
+
*/
|
|
520
|
+
/**
|
|
521
|
+
* The revision history panel. Pages arrive oldest first while the timeline
|
|
522
|
+
* renders newest first, so rendering progressively would show operations in
|
|
523
|
+
* the wrong order until the last page landed and would repaint the whole
|
|
524
|
+
* timeline on every page in between. Instead the component keeps asking for
|
|
525
|
+
* the next page, showing "Loading operations…" and a running count, until
|
|
526
|
+
* the walk completes, then renders the pagination and timeline once.
|
|
527
|
+
*/
|
|
528
|
+
function ScopedRevisionHistory(props) {
|
|
529
|
+
const { documentTitle, documentId, operations, isLoading, hasNextPage, onLoadNextPage, scopes, scope, onScopeChange, onClose, itemsPerPage = 100, documentState, onCopyState, onCopyDocId, error } = props;
|
|
530
|
+
useEffect(() => {
|
|
531
|
+
if (!hasNextPage || isLoading || error) return;
|
|
532
|
+
const handle = window.setTimeout(onLoadNextPage, 0);
|
|
533
|
+
return () => window.clearTimeout(handle);
|
|
534
|
+
}, [
|
|
535
|
+
hasNextPage,
|
|
536
|
+
isLoading,
|
|
537
|
+
onLoadNextPage,
|
|
538
|
+
error
|
|
539
|
+
]);
|
|
540
|
+
const isWalking = !error && (hasNextPage || isLoading && operations.length === 0);
|
|
541
|
+
const visibleOperations = useMemo(() => isWalking ? [] : garbageCollect(sortOperations([...operations])).sort((a, b) => b.index - a.index), [operations, isWalking]);
|
|
542
|
+
const { pageItems, pages, goToPage, goToNextPage, goToPreviousPage, goToFirstPage, goToLastPage, hiddenNextPages, isNextPageAvailable, isPreviousPageAvailable } = usePagination(visibleOperations, { itemsPerPage });
|
|
543
|
+
function onChangeScope(nextScope) {
|
|
544
|
+
goToFirstPage();
|
|
545
|
+
onScopeChange(nextScope);
|
|
546
|
+
}
|
|
547
|
+
const PaginationComponent = visibleOperations.length > itemsPerPage ? /* @__PURE__ */ jsx("div", {
|
|
548
|
+
className: "mt-4 flex w-full justify-end",
|
|
549
|
+
children: /* @__PURE__ */ jsx(Pagination, {
|
|
550
|
+
firstPageLabel: "First Page",
|
|
551
|
+
goToFirstPage,
|
|
552
|
+
goToLastPage,
|
|
553
|
+
goToNextPage,
|
|
554
|
+
goToPage,
|
|
555
|
+
goToPreviousPage,
|
|
556
|
+
hiddenNextPages,
|
|
557
|
+
isNextPageAvailable,
|
|
558
|
+
isPreviousPageAvailable,
|
|
559
|
+
lastPageLabel: "Last Page",
|
|
560
|
+
nextPageLabel: "Next",
|
|
561
|
+
pages,
|
|
562
|
+
previousPageLabel: "Previous"
|
|
563
|
+
})
|
|
564
|
+
}) : /* @__PURE__ */ jsx("hr", { className: "h-12 border-none" });
|
|
565
|
+
const hasOperations = visibleOperations.length > 0;
|
|
566
|
+
return /* @__PURE__ */ jsx(ConnectTooltipProvider, { children: /* @__PURE__ */ jsxs("div", {
|
|
567
|
+
className: "p-6",
|
|
568
|
+
children: [/* @__PURE__ */ jsx(Header, {
|
|
569
|
+
docId: documentId,
|
|
570
|
+
onChangeScope,
|
|
571
|
+
onClose,
|
|
572
|
+
scope,
|
|
573
|
+
scopes,
|
|
574
|
+
title: documentTitle,
|
|
575
|
+
documentState,
|
|
576
|
+
onCopyState,
|
|
577
|
+
onCopyDocId
|
|
578
|
+
}), isWalking ? /* @__PURE__ */ jsxs("div", {
|
|
579
|
+
className: "mt-4 flex flex-col items-center rounded-md bg-background p-4",
|
|
580
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
581
|
+
className: "my-40 text-foreground",
|
|
582
|
+
children: "Loading operations…"
|
|
583
|
+
}), operations.length > 0 && /* @__PURE__ */ jsxs("p", {
|
|
584
|
+
className: "text-xs text-muted-foreground",
|
|
585
|
+
children: [operations.length, " loaded so far"]
|
|
586
|
+
})]
|
|
587
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
588
|
+
PaginationComponent,
|
|
589
|
+
/* @__PURE__ */ jsxs("div", {
|
|
590
|
+
className: "mt-4 flex flex-col items-center rounded-md bg-background p-4",
|
|
591
|
+
children: [error && /* @__PURE__ */ jsxs("p", {
|
|
592
|
+
className: "mb-2 text-xs text-destructive",
|
|
593
|
+
children: ["Could not load the rest of the history: ", error.message]
|
|
594
|
+
}), hasOperations ? /* @__PURE__ */ jsx("div", {
|
|
595
|
+
className: "grid grid-cols-[minmax(min-content,1018px)]",
|
|
596
|
+
children: /* @__PURE__ */ jsx(Timeline, { operations: pageItems })
|
|
597
|
+
}) : error ? null : /* @__PURE__ */ jsx("h3", {
|
|
598
|
+
className: "my-40 text-foreground",
|
|
599
|
+
children: "This document has no recorded operations yet."
|
|
600
|
+
})]
|
|
601
|
+
}),
|
|
602
|
+
PaginationComponent
|
|
603
|
+
] })]
|
|
604
|
+
}) });
|
|
605
|
+
}
|
|
606
|
+
const LEGACY_SCOPES = ["global", "local"];
|
|
607
|
+
const noop = () => {};
|
|
608
|
+
/** Toggles between the whole global and local history loaded up front. */
|
|
609
|
+
function LegacyRevisionHistory(props) {
|
|
610
|
+
const { globalOperations, localOperations, ...common } = props;
|
|
611
|
+
const [scope, setScope] = useState("global");
|
|
612
|
+
return /* @__PURE__ */ jsx(ScopedRevisionHistory, {
|
|
613
|
+
...common,
|
|
614
|
+
operations: scope === "local" ? localOperations : globalOperations,
|
|
615
|
+
isLoading: false,
|
|
616
|
+
hasNextPage: false,
|
|
617
|
+
onLoadNextPage: noop,
|
|
618
|
+
scopes: LEGACY_SCOPES,
|
|
619
|
+
scope,
|
|
620
|
+
onScopeChange: setScope
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* The revision history panel. Pages arrive oldest first while the timeline
|
|
625
|
+
* renders newest first, so it waits for the whole history to load before
|
|
626
|
+
* rendering the timeline, showing "Loading operations…" and a running count
|
|
627
|
+
* in the meantime.
|
|
628
|
+
*
|
|
629
|
+
* Also accepts the deprecated `globalOperations`/`localOperations` pair
|
|
630
|
+
* (see `RevisionHistoryLegacyProps`), toggling between them internally.
|
|
631
|
+
*/
|
|
632
|
+
function RevisionHistory(props) {
|
|
633
|
+
return "globalOperations" in props ? /* @__PURE__ */ jsx(LegacyRevisionHistory, { ...props }) : /* @__PURE__ */ jsx(ScopedRevisionHistory, { ...props });
|
|
634
|
+
}
|
|
635
|
+
//#endregion
|
|
636
|
+
export { RevisionHistory };
|
|
637
|
+
|
|
638
|
+
//# sourceMappingURL=revision-history.impl-uogo6xDI.js.map
|