@arbidocs/react 0.5.161 → 0.5.163
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/annotations/index.cjs +47 -47
- package/dist/annotations/useAnnotationLayer.js +7 -3
- package/dist/annotations/useAnnotationLayer.js.map +2 -2
- package/dist/artifacts/index.cjs +2 -2
- package/dist/calls/livekit/index.cjs +41 -41
- package/dist/chat/workflow-run-titles.js +6 -1
- package/dist/chat/workflow-run-titles.js.map +2 -2
- package/dist/{chunk-GVU3KYP3.cjs → chunk-42X5ZO7Y.cjs} +11 -82
- package/dist/chunk-42X5ZO7Y.cjs.map +1 -0
- package/dist/{chunk-SUZORMAB.cjs → chunk-L5TQDBG4.cjs} +9 -5
- package/dist/chunk-L5TQDBG4.cjs.map +1 -0
- package/dist/{chunk-2MGJXBBJ.cjs → chunk-SUMXDNYG.cjs} +157 -6
- package/dist/chunk-SUMXDNYG.cjs.map +1 -0
- package/dist/{chunk-QV7KINWC.cjs → chunk-ZBI5AMZC.cjs} +6 -6
- package/dist/{chunk-QV7KINWC.cjs.map → chunk-ZBI5AMZC.cjs.map} +1 -1
- package/dist/conversation-list.js +32 -4
- package/dist/conversation-list.js.map +2 -2
- package/dist/directmessages/chat-cache.js +5 -0
- package/dist/directmessages/chat-cache.js.map +2 -2
- package/dist/document-tools/core.cjs +62 -62
- package/dist/document-tools/index.cjs +62 -62
- package/dist/hooks.js +7 -1
- package/dist/hooks.js.map +2 -2
- package/dist/index.cjs +625 -603
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +208 -1024
- package/dist/session/conversation-panels.js +41 -0
- package/dist/session/conversation-panels.js.map +7 -0
- package/dist/session/index.js +2 -0
- package/dist/session/index.js.map +2 -2
- package/dist/session/layout.js +7 -3
- package/dist/session/layout.js.map +2 -2
- package/dist/workspaces/switch.js +7 -4
- package/dist/workspaces/switch.js.map +2 -2
- package/package.json +3 -3
- package/dist/chunk-2MGJXBBJ.cjs.map +0 -1
- package/dist/chunk-GVU3KYP3.cjs.map +0 -1
- package/dist/chunk-SUZORMAB.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkL5TQDBG4_cjs = require('../chunk-L5TQDBG4.cjs');
|
|
4
4
|
var chunk2IJP73ZG_cjs = require('../chunk-2IJP73ZG.cjs');
|
|
5
5
|
require('../chunk-WYZJLZ67.cjs');
|
|
6
6
|
require('../chunk-HJDR5HEO.cjs');
|
|
@@ -10,187 +10,187 @@ require('../chunk-S6A6FSG7.cjs');
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "AUTOSAVE_MS", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkL5TQDBG4_cjs.AUTOSAVE_MS; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "AnnotationPageOverlay", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkL5TQDBG4_cjs.AnnotationPageOverlay; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "AnnotationStoreOfflineError", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkL5TQDBG4_cjs.AnnotationStoreOfflineError; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "AnnotationToolbar", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkL5TQDBG4_cjs.AnnotationToolbar; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "DEFAULT_SETTINGS", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkL5TQDBG4_cjs.DEFAULT_SETTINGS; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "FreezeDialog", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkL5TQDBG4_cjs.FreezeDialog; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "HIGHLIGHT_COLORS", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkL5TQDBG4_cjs.HIGHLIGHT_COLORS; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "MARK_COLORS", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkL5TQDBG4_cjs.MARK_COLORS; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "ProductionDialog", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkL5TQDBG4_cjs.ProductionDialog; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "REDACTION_LOG_COLUMNS", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkL5TQDBG4_cjs.REDACTION_LOG_COLUMNS; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "REDACTION_REASONS", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkL5TQDBG4_cjs.REDACTION_REASONS; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "RETRY_MS", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkL5TQDBG4_cjs.RETRY_MS; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "STAMP_PRESETS", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkL5TQDBG4_cjs.STAMP_PRESETS; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "annotationsOnPage", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkL5TQDBG4_cjs.annotationsOnPage; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "applyAction", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkL5TQDBG4_cjs.applyAction; }
|
|
70
70
|
});
|
|
71
71
|
Object.defineProperty(exports, "canRedo", {
|
|
72
72
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunkL5TQDBG4_cjs.canRedo; }
|
|
74
74
|
});
|
|
75
75
|
Object.defineProperty(exports, "canUndo", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunkL5TQDBG4_cjs.canUndo; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "containsPoint", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunkL5TQDBG4_cjs.containsPoint; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "createHistory", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunkL5TQDBG4_cjs.createHistory; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "createLocalStorageStore", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunkL5TQDBG4_cjs.createLocalStorageStore; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "createMemoryStore", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunkL5TQDBG4_cjs.createMemoryStore; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "dragRect", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkL5TQDBG4_cjs.dragRect; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "dragToNorm", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunkL5TQDBG4_cjs.dragToNorm; }
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "intersects", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunkL5TQDBG4_cjs.intersects; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, "isTooSmall", {
|
|
108
108
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunkL5TQDBG4_cjs.isTooSmall; }
|
|
110
110
|
});
|
|
111
111
|
Object.defineProperty(exports, "layerStatusText", {
|
|
112
112
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunkL5TQDBG4_cjs.layerStatusText; }
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "mergeLayers", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunkL5TQDBG4_cjs.mergeLayers; }
|
|
118
118
|
});
|
|
119
119
|
Object.defineProperty(exports, "mergeLineRects", {
|
|
120
120
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunkL5TQDBG4_cjs.mergeLineRects; }
|
|
122
122
|
});
|
|
123
123
|
Object.defineProperty(exports, "moveItem", {
|
|
124
124
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunkL5TQDBG4_cjs.moveItem; }
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "patchForRect", {
|
|
128
128
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunkL5TQDBG4_cjs.patchForRect; }
|
|
130
130
|
});
|
|
131
131
|
Object.defineProperty(exports, "pendingRedactions", {
|
|
132
132
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunkL5TQDBG4_cjs.pendingRedactions; }
|
|
134
134
|
});
|
|
135
135
|
Object.defineProperty(exports, "qrCornerFor", {
|
|
136
136
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunkL5TQDBG4_cjs.qrCornerFor; }
|
|
138
138
|
});
|
|
139
139
|
Object.defineProperty(exports, "readSelection", {
|
|
140
140
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunkL5TQDBG4_cjs.readSelection; }
|
|
142
142
|
});
|
|
143
143
|
Object.defineProperty(exports, "redactionLogCsv", {
|
|
144
144
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunkL5TQDBG4_cjs.redactionLogCsv; }
|
|
146
146
|
});
|
|
147
147
|
Object.defineProperty(exports, "redactionLogRows", {
|
|
148
148
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunkL5TQDBG4_cjs.redactionLogRows; }
|
|
150
150
|
});
|
|
151
151
|
Object.defineProperty(exports, "redo", {
|
|
152
152
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunkL5TQDBG4_cjs.redo; }
|
|
154
154
|
});
|
|
155
155
|
Object.defineProperty(exports, "reduceLayer", {
|
|
156
156
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
157
|
+
get: function () { return chunkL5TQDBG4_cjs.reduceLayer; }
|
|
158
158
|
});
|
|
159
159
|
Object.defineProperty(exports, "sameMarks", {
|
|
160
160
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
161
|
+
get: function () { return chunkL5TQDBG4_cjs.sameMarks; }
|
|
162
162
|
});
|
|
163
163
|
Object.defineProperty(exports, "selectionToPageMarks", {
|
|
164
164
|
enumerable: true,
|
|
165
|
-
get: function () { return
|
|
165
|
+
get: function () { return chunkL5TQDBG4_cjs.selectionToPageMarks; }
|
|
166
166
|
});
|
|
167
167
|
Object.defineProperty(exports, "singleRect", {
|
|
168
168
|
enumerable: true,
|
|
169
|
-
get: function () { return
|
|
169
|
+
get: function () { return chunkL5TQDBG4_cjs.singleRect; }
|
|
170
170
|
});
|
|
171
171
|
Object.defineProperty(exports, "toNorm", {
|
|
172
172
|
enumerable: true,
|
|
173
|
-
get: function () { return
|
|
173
|
+
get: function () { return chunkL5TQDBG4_cjs.toNorm; }
|
|
174
174
|
});
|
|
175
175
|
Object.defineProperty(exports, "toPixels", {
|
|
176
176
|
enumerable: true,
|
|
177
|
-
get: function () { return
|
|
177
|
+
get: function () { return chunkL5TQDBG4_cjs.toPixels; }
|
|
178
178
|
});
|
|
179
179
|
Object.defineProperty(exports, "undo", {
|
|
180
180
|
enumerable: true,
|
|
181
|
-
get: function () { return
|
|
181
|
+
get: function () { return chunkL5TQDBG4_cjs.undo; }
|
|
182
182
|
});
|
|
183
183
|
Object.defineProperty(exports, "useAnnotationLayer", {
|
|
184
184
|
enumerable: true,
|
|
185
|
-
get: function () { return
|
|
185
|
+
get: function () { return chunkL5TQDBG4_cjs.useAnnotationLayer; }
|
|
186
186
|
});
|
|
187
187
|
Object.defineProperty(exports, "useAnnotationShortcuts", {
|
|
188
188
|
enumerable: true,
|
|
189
|
-
get: function () { return
|
|
189
|
+
get: function () { return chunkL5TQDBG4_cjs.useAnnotationShortcuts; }
|
|
190
190
|
});
|
|
191
191
|
Object.defineProperty(exports, "useTextSelectionMarks", {
|
|
192
192
|
enumerable: true,
|
|
193
|
-
get: function () { return
|
|
193
|
+
get: function () { return chunkL5TQDBG4_cjs.useTextSelectionMarks; }
|
|
194
194
|
});
|
|
195
195
|
Object.defineProperty(exports, "AnnotationLayerError", {
|
|
196
196
|
enumerable: true,
|
|
@@ -88,13 +88,17 @@ function useAnnotationLayer({
|
|
|
88
88
|
setSavedLayer(null);
|
|
89
89
|
setStoreReadOnly(false);
|
|
90
90
|
savedRef.current = null;
|
|
91
|
-
|
|
91
|
+
const placeholder = emptyLayer(documentId, nowRef.current());
|
|
92
|
+
commit(createHistory(placeholder));
|
|
92
93
|
storeRef.current.load(documentId).then((layer) => {
|
|
93
94
|
if (cancelled) return;
|
|
94
95
|
savedRef.current = layer;
|
|
95
96
|
setSavedLayer(layer);
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
const canEdit = storeRef.current.canEdit?.(documentId) !== false;
|
|
98
|
+
setStoreReadOnly(!canEdit);
|
|
99
|
+
commit(
|
|
100
|
+
canEdit ? rebaseHistory(historyRef.current, placeholder, layer) : createHistory(layer)
|
|
101
|
+
);
|
|
98
102
|
setStatus("ready");
|
|
99
103
|
}).catch((e) => {
|
|
100
104
|
if (cancelled) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/annotations/useAnnotationLayer.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Annotation state for one document: loads its layer from a store, applies edits through the pure\n * reducer (so undo/redo is exact), and saves back after a short pause.\n *\n * Edits are applied from a ref, not inside a React state updater, so a mark that fails validation\n * is reported through `error` instead of throwing during render.\n *\n * With a shared store (other people edit the same layer) a save may come back merged with their\n * marks, and `pull` brings in their changes while this user is idle. Either way the remote layer is\n * REBASED in: the edits made here since are replayed on top of it with `mergeLayers`, and so is\n * every undo/redo step, so undoing never removes a colleague's mark or brings back one they deleted.\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport {\n DEFAULT_SETTINGS,\n type AnnotationController,\n type AnnotationTool,\n type LayerStatus,\n type NewMark,\n type ToolSettings,\n} from './controller'\nimport { mergeLayers } from './merge'\nimport { emptyLayer, type Annotation, type AnnotationLayer } from './model'\nimport {\n applyAction,\n canRedo as historyCanRedo,\n canUndo as historyCanUndo,\n createHistory,\n redo as historyRedo,\n undo as historyUndo,\n type AnnotationAction,\n type LayerHistory,\n} from './state'\nimport { AnnotationStoreOfflineError, type AnnotationStore } from './store'\n\nexport const AUTOSAVE_MS = 600\n/** After a failed save, try again this much later (while edits are still unsaved). */\nexport const RETRY_MS = 10_000\n\nexport interface UseAnnotationLayerOptions {\n documentId: string\n store: AnnotationStore\n /** Display name recorded as the author of new marks. */\n author: string\n autosaveMs?: number\n /** View only: marks are shown and comments can be read, nothing can be changed. */\n readOnly?: boolean\n /** False while the device is offline: edits are kept and saved when it comes back. */\n online?: boolean\n /** Ask the store for others' changes this often while idle (0 = never). Needs `store.pull`. */\n pullMs?: number\n now?: () => string\n makeId?: () => string\n}\n\nconst defaultNow = () => new Date().toISOString()\nconst defaultId = () => globalThis.crypto.randomUUID()\n\n/** Replay a history onto a remote layer: `sent` is what the remote layer was made from. */\nfunction rebaseHistory(\n history: LayerHistory,\n sent: AnnotationLayer,\n remote: AnnotationLayer\n): LayerHistory {\n const onto = (layer: AnnotationLayer) =>\n layer === sent ? remote : mergeLayers({ base: sent, mine: layer, theirs: remote })\n return {\n present: onto(history.present),\n past: history.past.map(onto),\n future: history.future.map(onto),\n }\n}\n\nexport function useAnnotationLayer({\n documentId,\n store,\n author,\n autosaveMs = AUTOSAVE_MS,\n readOnly: readOnlyProp = false,\n online = true,\n pullMs = 0,\n now = defaultNow,\n makeId = defaultId,\n}: UseAnnotationLayerOptions): AnnotationController {\n const [history, setHistory] = useState<LayerHistory>(() =>\n createHistory(emptyLayer(documentId, now()))\n )\n const [savedLayer, setSavedLayer] = useState<AnnotationLayer | null>(null)\n const [status, setStatus] = useState<LayerStatus>('loading')\n const [error, setError] = useState<string | null>(null)\n const [saving, setSaving] = useState(false)\n const [offlineFailure, setOfflineFailure] = useState(false)\n const [storeReadOnly, setStoreReadOnly] = useState(false)\n const [tool, setToolState] = useState<AnnotationTool>('select')\n const [settings, setSettingsState] = useState<ToolSettings>(DEFAULT_SETTINGS)\n const [selectedId, setSelectedId] = useState<string | null>(null)\n const readOnly = readOnlyProp || storeReadOnly\n\n const historyRef = useRef(history)\n const savedRef = useRef<AnnotationLayer | null>(null)\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const retryRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const savingRef = useRef(false)\n const docRef = useRef(documentId)\n const storeRef = useRef(store)\n storeRef.current = store\n const nowRef = useRef(now)\n nowRef.current = now\n const idRef = useRef(makeId)\n idRef.current = makeId\n const readOnlyRef = useRef(readOnly)\n readOnlyRef.current = readOnly\n const onlineRef = useRef(online)\n onlineRef.current = online\n const autosaveMsRef = useRef(autosaveMs)\n autosaveMsRef.current = autosaveMs\n\n const commit = useCallback((next: LayerHistory) => {\n historyRef.current = next\n setHistory(next)\n }, [])\n\n /** Take in a layer the store produced from `sent` (a merged save, or others' changes). */\n const adoptRemote = useCallback(\n (sent: AnnotationLayer, remote: AnnotationLayer) => {\n commit(rebaseHistory(historyRef.current, sent, remote))\n savedRef.current = remote\n setSavedLayer(remote)\n },\n [commit]\n )\n\n // Load when the document changes.\n useEffect(() => {\n docRef.current = documentId\n let cancelled = false\n setStatus('loading')\n setError(null)\n setSelectedId(null)\n setSavedLayer(null)\n setStoreReadOnly(false)\n savedRef.current = null\n commit(createHistory(emptyLayer(documentId, nowRef.current())))\n storeRef.current\n .load(documentId)\n .then((layer) => {\n if (cancelled) return\n savedRef.current = layer\n setSavedLayer(layer)\n setStoreReadOnly(storeRef.current.canEdit?.(documentId) === false)\n commit(createHistory(layer))\n setStatus('ready')\n })\n .catch((e: unknown) => {\n if (cancelled) return\n setError(e instanceof Error ? e.message : 'The annotations could not be loaded')\n setStatus('error')\n })\n return () => {\n cancelled = true\n // Leaving this document (switching to another, or unmounting): write the edits still waiting\n // on the autosave timer. Without this they would be silently dropped.\n clearTimeout(timerRef.current)\n clearTimeout(retryRef.current)\n const layer = historyRef.current.present\n if (\n savedRef.current !== null &&\n layer !== savedRef.current &&\n layer.documentId === documentId &&\n !readOnlyRef.current\n ) {\n storeRef.current\n .save(layer)\n .catch((e: unknown) => console.error('Annotations could not be saved', e))\n }\n }\n }, [documentId, commit])\n\n const save = useCallback(async () => {\n clearTimeout(timerRef.current)\n clearTimeout(retryRef.current)\n const layer = historyRef.current.present\n // Nothing to write, not loaded yet (never overwrite a layer with the empty placeholder), view\n // only, or a write already in flight (its completion schedules the next one).\n if (layer === savedRef.current || savedRef.current === null) return\n if (readOnlyRef.current || savingRef.current) return\n if (!onlineRef.current) return // kept; the online effect saves it when the device is back\n savingRef.current = true\n setSaving(true)\n let failed = false\n try {\n const stored = await storeRef.current.save(layer)\n if (layer.documentId === docRef.current) {\n setError(null)\n setOfflineFailure(false)\n if (stored && stored !== layer) {\n adoptRemote(layer, stored)\n } else {\n savedRef.current = layer\n setSavedLayer(layer)\n }\n }\n } catch (e) {\n failed = true\n if (e instanceof AnnotationStoreOfflineError) {\n setOfflineFailure(true)\n } else {\n setError(e instanceof Error ? e.message : 'The annotations could not be saved')\n }\n // Try again later; any new edit also tries again.\n retryRef.current = setTimeout(() => void saveRef.current(), RETRY_MS)\n } finally {\n savingRef.current = false\n setSaving(false)\n // Edits made while this write was in flight go out next (their own timer found it busy).\n if (!failed && historyRef.current.present !== savedRef.current) {\n timerRef.current = setTimeout(() => void saveRef.current(), autosaveMsRef.current)\n }\n }\n }, [adoptRemote])\n const saveRef = useRef(save)\n saveRef.current = save\n\n const present = history.present\n const dirty = status === 'ready' && present !== savedLayer\n\n useEffect(() => {\n if (!dirty || !online || readOnly) return\n timerRef.current = setTimeout(() => void save(), autosaveMs)\n return () => clearTimeout(timerRef.current)\n }, [dirty, present, autosaveMs, save, online, readOnly])\n\n // Back online: the unsaved edits go out at once.\n useEffect(() => {\n if (online) setOfflineFailure(false)\n if (online && savedRef.current !== null && historyRef.current.present !== savedRef.current) {\n void save()\n }\n }, [online, save])\n\n // Others' changes, while this user is idle (nothing unsaved, nothing in flight).\n const pull = useCallback(async () => {\n const s = storeRef.current\n const base = savedRef.current\n if (!s.pull || !base || savingRef.current || !onlineRef.current) return\n if (historyRef.current.present !== base) return\n try {\n const remote = await s.pull(docRef.current)\n if (!remote || remote.documentId !== docRef.current || savedRef.current !== base) return\n adoptRemote(base, remote)\n } catch {\n // A failed pull changes nothing; the next one (or a save) catches up.\n }\n }, [adoptRemote])\n\n useEffect(() => {\n if (!pullMs || status !== 'ready') return\n const timer = setInterval(() => void pull(), pullMs)\n const onFocus = () => void pull()\n window.addEventListener('focus', onFocus)\n return () => {\n clearInterval(timer)\n window.removeEventListener('focus', onFocus)\n }\n }, [pullMs, status, pull])\n\n // The tab can close or reload with edits still waiting on the autosave timer, and React's own\n // cleanup does not run then. Write when the page is being left or hidden (mobile browsers often\n // fire only the latter). `save` starts the store write synchronously, which is what unload needs.\n useEffect(() => {\n const flush = () => void save()\n const onVisibility = () => {\n if (document.visibilityState === 'hidden') flush()\n }\n window.addEventListener('pagehide', flush)\n document.addEventListener('visibilitychange', onVisibility)\n return () => {\n window.removeEventListener('pagehide', flush)\n document.removeEventListener('visibilitychange', onVisibility)\n }\n }, [save])\n\n const dispatch = useCallback(\n (action: AnnotationAction): boolean => {\n if (readOnlyRef.current) return false\n try {\n commit(applyAction(historyRef.current, action))\n setError(null)\n return true\n } catch (e) {\n setError(e instanceof Error ? e.message : 'The change was rejected')\n return false\n }\n },\n [commit]\n )\n\n const stamp = useCallback(\n (mark: NewMark): Annotation => {\n const t = nowRef.current()\n return { ...mark, id: idRef.current(), author, createdAt: t, updatedAt: t } as Annotation\n },\n [author]\n )\n\n const offline = !online || offlineFailure\n\n const controller = useMemo<AnnotationController>(() => {\n const exists = (id: string | null) =>\n id !== null && present.annotations.some((a) => a.id === id) ? id : null\n return {\n layer: present,\n status,\n error,\n saving,\n dirty,\n offline,\n readOnly,\n author,\n tool: readOnly ? 'select' : tool,\n setTool: (next) => {\n if (readOnly && next !== 'select') return\n setToolState(next)\n if (next !== 'select') setSelectedId(null)\n },\n settings,\n setSettings: (patch) =>\n setSettingsState((s) => ({ ...s, ...patch, colors: { ...s.colors, ...patch.colors } })),\n selectedId: exists(selectedId),\n select: setSelectedId,\n add: (mark) => {\n const annotation = stamp(mark)\n return dispatch({ type: 'add', annotation }) ? annotation.id : null\n },\n addMany: (marks) => {\n const annotations = marks.map(stamp)\n return dispatch({ type: 'addMany', annotations }) ? annotations.map((a) => a.id) : []\n },\n update: (id, patch) => void dispatch({ type: 'update', id, patch, now: nowRef.current() }),\n remove: (id) => void dispatch({ type: 'remove', id, now: nowRef.current() }),\n setRedactionStatus: (ids, next) =>\n void dispatch({\n type: 'setRedactionStatus',\n ids,\n status: next,\n now: nowRef.current(),\n by: author,\n }),\n reply: (id, body) => {\n const t = nowRef.current()\n void dispatch({\n type: 'reply',\n id,\n reply: { id: idRef.current(), author, createdAt: t, body },\n now: t,\n })\n },\n resolve: (id, resolved) =>\n void dispatch({ type: 'resolve', id, resolved, now: nowRef.current() }),\n undo: () => {\n if (!readOnly) commit(historyUndo(historyRef.current))\n },\n redo: () => {\n if (!readOnly) commit(historyRedo(historyRef.current))\n },\n canUndo: !readOnly && historyCanUndo(history),\n canRedo: !readOnly && historyCanRedo(history),\n flush: save,\n }\n }, [\n present,\n history,\n status,\n error,\n saving,\n dirty,\n offline,\n readOnly,\n author,\n tool,\n settings,\n selectedId,\n stamp,\n dispatch,\n commit,\n save,\n ])\n\n return controller\n}\n"],
|
|
5
|
-
"mappings": "AAaA,SAAS,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AAClE;AAAA,EACE;AAAA,OAMK;AACP,SAAS,mBAAmB;AAC5B,SAAS,kBAAyD;AAClE;AAAA,EACE;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,EACR,QAAQ;AAAA,OAGH;AACP,SAAS,mCAAyD;AAE3D,MAAM,cAAc;AAEpB,MAAM,WAAW;AAkBxB,MAAM,aAAa,OAAM,oBAAI,KAAK,GAAE,YAAY;AAChD,MAAM,YAAY,MAAM,WAAW,OAAO,WAAW;AAGrD,SAAS,cACP,SACA,MACA,QACc;AACd,QAAM,OAAO,CAAC,UACZ,UAAU,OAAO,SAAS,YAAY,EAAE,MAAM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zB,SAAO,UAAU;AACjB,QAAM,QAAQ,OAAO,MAAM;AAC3B,QAAM,UAAU;AAChB,QAAM,cAAc,OAAO,QAAQ;AACnC,cAAY,UAAU;AACtB,QAAM,YAAY,OAAO,MAAM;AAC/B,YAAU,UAAU;AACpB,QAAM,gBAAgB,OAAO,UAAU;AACvC,gBAAc,UAAU;AAExB,QAAM,SAAS,YAAY,CAAC,SAAuB;AACjD,eAAW,UAAU;AACrB,eAAW,IAAI;AAAA,EACjB,GAAG,CAAC,CAAC;AAGL,QAAM,cAAc;AAAA,IAClB,CAAC,MAAuB,WAA4B;AAClD,aAAO,cAAc,WAAW,SAAS,MAAM,MAAM,CAAC;AACtD,eAAS,UAAU;AACnB,oBAAc,MAAM;AAAA,IACtB;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AAGA,YAAU,MAAM;AACd,WAAO,UAAU;AACjB,QAAI,YAAY;AAChB,cAAU,SAAS;AACnB,aAAS,IAAI;AACb,kBAAc,IAAI;AAClB,kBAAc,IAAI;AAClB,qBAAiB,KAAK;AACtB,aAAS,UAAU;AACnB,
|
|
4
|
+
"sourcesContent": ["/**\n * Annotation state for one document: loads its layer from a store, applies edits through the pure\n * reducer (so undo/redo is exact), and saves back after a short pause.\n *\n * Edits are applied from a ref, not inside a React state updater, so a mark that fails validation\n * is reported through `error` instead of throwing during render.\n *\n * With a shared store (other people edit the same layer) a save may come back merged with their\n * marks, and `pull` brings in their changes while this user is idle. Either way the remote layer is\n * REBASED in: the edits made here since are replayed on top of it with `mergeLayers`, and so is\n * every undo/redo step, so undoing never removes a colleague's mark or brings back one they deleted.\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport {\n DEFAULT_SETTINGS,\n type AnnotationController,\n type AnnotationTool,\n type LayerStatus,\n type NewMark,\n type ToolSettings,\n} from './controller'\nimport { mergeLayers } from './merge'\nimport { emptyLayer, type Annotation, type AnnotationLayer } from './model'\nimport {\n applyAction,\n canRedo as historyCanRedo,\n canUndo as historyCanUndo,\n createHistory,\n redo as historyRedo,\n undo as historyUndo,\n type AnnotationAction,\n type LayerHistory,\n} from './state'\nimport { AnnotationStoreOfflineError, type AnnotationStore } from './store'\n\nexport const AUTOSAVE_MS = 600\n/** After a failed save, try again this much later (while edits are still unsaved). */\nexport const RETRY_MS = 10_000\n\nexport interface UseAnnotationLayerOptions {\n documentId: string\n store: AnnotationStore\n /** Display name recorded as the author of new marks. */\n author: string\n autosaveMs?: number\n /** View only: marks are shown and comments can be read, nothing can be changed. */\n readOnly?: boolean\n /** False while the device is offline: edits are kept and saved when it comes back. */\n online?: boolean\n /** Ask the store for others' changes this often while idle (0 = never). Needs `store.pull`. */\n pullMs?: number\n now?: () => string\n makeId?: () => string\n}\n\nconst defaultNow = () => new Date().toISOString()\nconst defaultId = () => globalThis.crypto.randomUUID()\n\n/** Replay a history onto a remote layer: `sent` is what the remote layer was made from. */\nfunction rebaseHistory(\n history: LayerHistory,\n sent: AnnotationLayer,\n remote: AnnotationLayer\n): LayerHistory {\n const onto = (layer: AnnotationLayer) =>\n layer === sent ? remote : mergeLayers({ base: sent, mine: layer, theirs: remote })\n return {\n present: onto(history.present),\n past: history.past.map(onto),\n future: history.future.map(onto),\n }\n}\n\nexport function useAnnotationLayer({\n documentId,\n store,\n author,\n autosaveMs = AUTOSAVE_MS,\n readOnly: readOnlyProp = false,\n online = true,\n pullMs = 0,\n now = defaultNow,\n makeId = defaultId,\n}: UseAnnotationLayerOptions): AnnotationController {\n const [history, setHistory] = useState<LayerHistory>(() =>\n createHistory(emptyLayer(documentId, now()))\n )\n const [savedLayer, setSavedLayer] = useState<AnnotationLayer | null>(null)\n const [status, setStatus] = useState<LayerStatus>('loading')\n const [error, setError] = useState<string | null>(null)\n const [saving, setSaving] = useState(false)\n const [offlineFailure, setOfflineFailure] = useState(false)\n const [storeReadOnly, setStoreReadOnly] = useState(false)\n const [tool, setToolState] = useState<AnnotationTool>('select')\n const [settings, setSettingsState] = useState<ToolSettings>(DEFAULT_SETTINGS)\n const [selectedId, setSelectedId] = useState<string | null>(null)\n const readOnly = readOnlyProp || storeReadOnly\n\n const historyRef = useRef(history)\n const savedRef = useRef<AnnotationLayer | null>(null)\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const retryRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const savingRef = useRef(false)\n const docRef = useRef(documentId)\n const storeRef = useRef(store)\n storeRef.current = store\n const nowRef = useRef(now)\n nowRef.current = now\n const idRef = useRef(makeId)\n idRef.current = makeId\n const readOnlyRef = useRef(readOnly)\n readOnlyRef.current = readOnly\n const onlineRef = useRef(online)\n onlineRef.current = online\n const autosaveMsRef = useRef(autosaveMs)\n autosaveMsRef.current = autosaveMs\n\n const commit = useCallback((next: LayerHistory) => {\n historyRef.current = next\n setHistory(next)\n }, [])\n\n /** Take in a layer the store produced from `sent` (a merged save, or others' changes). */\n const adoptRemote = useCallback(\n (sent: AnnotationLayer, remote: AnnotationLayer) => {\n commit(rebaseHistory(historyRef.current, sent, remote))\n savedRef.current = remote\n setSavedLayer(remote)\n },\n [commit]\n )\n\n // Load when the document changes.\n useEffect(() => {\n docRef.current = documentId\n let cancelled = false\n setStatus('loading')\n setError(null)\n setSelectedId(null)\n setSavedLayer(null)\n setStoreReadOnly(false)\n savedRef.current = null\n const placeholder = emptyLayer(documentId, nowRef.current())\n commit(createHistory(placeholder))\n storeRef.current\n .load(documentId)\n .then((layer) => {\n if (cancelled) return\n savedRef.current = layer\n setSavedLayer(layer)\n const canEdit = storeRef.current.canEdit?.(documentId) !== false\n setStoreReadOnly(!canEdit)\n // Marks made while the layer loaded are kept on top of it (and saved), never overwritten by it.\n commit(\n canEdit ? rebaseHistory(historyRef.current, placeholder, layer) : createHistory(layer)\n )\n setStatus('ready')\n })\n .catch((e: unknown) => {\n if (cancelled) return\n setError(e instanceof Error ? e.message : 'The annotations could not be loaded')\n setStatus('error')\n })\n return () => {\n cancelled = true\n // Leaving this document (switching to another, or unmounting): write the edits still waiting\n // on the autosave timer. Without this they would be silently dropped.\n clearTimeout(timerRef.current)\n clearTimeout(retryRef.current)\n const layer = historyRef.current.present\n if (\n savedRef.current !== null &&\n layer !== savedRef.current &&\n layer.documentId === documentId &&\n !readOnlyRef.current\n ) {\n storeRef.current\n .save(layer)\n .catch((e: unknown) => console.error('Annotations could not be saved', e))\n }\n }\n }, [documentId, commit])\n\n const save = useCallback(async () => {\n clearTimeout(timerRef.current)\n clearTimeout(retryRef.current)\n const layer = historyRef.current.present\n // Nothing to write, not loaded yet (never overwrite a layer with the empty placeholder), view\n // only, or a write already in flight (its completion schedules the next one).\n if (layer === savedRef.current || savedRef.current === null) return\n if (readOnlyRef.current || savingRef.current) return\n if (!onlineRef.current) return // kept; the online effect saves it when the device is back\n savingRef.current = true\n setSaving(true)\n let failed = false\n try {\n const stored = await storeRef.current.save(layer)\n if (layer.documentId === docRef.current) {\n setError(null)\n setOfflineFailure(false)\n if (stored && stored !== layer) {\n adoptRemote(layer, stored)\n } else {\n savedRef.current = layer\n setSavedLayer(layer)\n }\n }\n } catch (e) {\n failed = true\n if (e instanceof AnnotationStoreOfflineError) {\n setOfflineFailure(true)\n } else {\n setError(e instanceof Error ? e.message : 'The annotations could not be saved')\n }\n // Try again later; any new edit also tries again.\n retryRef.current = setTimeout(() => void saveRef.current(), RETRY_MS)\n } finally {\n savingRef.current = false\n setSaving(false)\n // Edits made while this write was in flight go out next (their own timer found it busy).\n if (!failed && historyRef.current.present !== savedRef.current) {\n timerRef.current = setTimeout(() => void saveRef.current(), autosaveMsRef.current)\n }\n }\n }, [adoptRemote])\n const saveRef = useRef(save)\n saveRef.current = save\n\n const present = history.present\n const dirty = status === 'ready' && present !== savedLayer\n\n useEffect(() => {\n if (!dirty || !online || readOnly) return\n timerRef.current = setTimeout(() => void save(), autosaveMs)\n return () => clearTimeout(timerRef.current)\n }, [dirty, present, autosaveMs, save, online, readOnly])\n\n // Back online: the unsaved edits go out at once.\n useEffect(() => {\n if (online) setOfflineFailure(false)\n if (online && savedRef.current !== null && historyRef.current.present !== savedRef.current) {\n void save()\n }\n }, [online, save])\n\n // Others' changes, while this user is idle (nothing unsaved, nothing in flight).\n const pull = useCallback(async () => {\n const s = storeRef.current\n const base = savedRef.current\n if (!s.pull || !base || savingRef.current || !onlineRef.current) return\n if (historyRef.current.present !== base) return\n try {\n const remote = await s.pull(docRef.current)\n if (!remote || remote.documentId !== docRef.current || savedRef.current !== base) return\n adoptRemote(base, remote)\n } catch {\n // A failed pull changes nothing; the next one (or a save) catches up.\n }\n }, [adoptRemote])\n\n useEffect(() => {\n if (!pullMs || status !== 'ready') return\n const timer = setInterval(() => void pull(), pullMs)\n const onFocus = () => void pull()\n window.addEventListener('focus', onFocus)\n return () => {\n clearInterval(timer)\n window.removeEventListener('focus', onFocus)\n }\n }, [pullMs, status, pull])\n\n // The tab can close or reload with edits still waiting on the autosave timer, and React's own\n // cleanup does not run then. Write when the page is being left or hidden (mobile browsers often\n // fire only the latter). `save` starts the store write synchronously, which is what unload needs.\n useEffect(() => {\n const flush = () => void save()\n const onVisibility = () => {\n if (document.visibilityState === 'hidden') flush()\n }\n window.addEventListener('pagehide', flush)\n document.addEventListener('visibilitychange', onVisibility)\n return () => {\n window.removeEventListener('pagehide', flush)\n document.removeEventListener('visibilitychange', onVisibility)\n }\n }, [save])\n\n const dispatch = useCallback(\n (action: AnnotationAction): boolean => {\n if (readOnlyRef.current) return false\n try {\n commit(applyAction(historyRef.current, action))\n setError(null)\n return true\n } catch (e) {\n setError(e instanceof Error ? e.message : 'The change was rejected')\n return false\n }\n },\n [commit]\n )\n\n const stamp = useCallback(\n (mark: NewMark): Annotation => {\n const t = nowRef.current()\n return { ...mark, id: idRef.current(), author, createdAt: t, updatedAt: t } as Annotation\n },\n [author]\n )\n\n const offline = !online || offlineFailure\n\n const controller = useMemo<AnnotationController>(() => {\n const exists = (id: string | null) =>\n id !== null && present.annotations.some((a) => a.id === id) ? id : null\n return {\n layer: present,\n status,\n error,\n saving,\n dirty,\n offline,\n readOnly,\n author,\n tool: readOnly ? 'select' : tool,\n setTool: (next) => {\n if (readOnly && next !== 'select') return\n setToolState(next)\n if (next !== 'select') setSelectedId(null)\n },\n settings,\n setSettings: (patch) =>\n setSettingsState((s) => ({ ...s, ...patch, colors: { ...s.colors, ...patch.colors } })),\n selectedId: exists(selectedId),\n select: setSelectedId,\n add: (mark) => {\n const annotation = stamp(mark)\n return dispatch({ type: 'add', annotation }) ? annotation.id : null\n },\n addMany: (marks) => {\n const annotations = marks.map(stamp)\n return dispatch({ type: 'addMany', annotations }) ? annotations.map((a) => a.id) : []\n },\n update: (id, patch) => void dispatch({ type: 'update', id, patch, now: nowRef.current() }),\n remove: (id) => void dispatch({ type: 'remove', id, now: nowRef.current() }),\n setRedactionStatus: (ids, next) =>\n void dispatch({\n type: 'setRedactionStatus',\n ids,\n status: next,\n now: nowRef.current(),\n by: author,\n }),\n reply: (id, body) => {\n const t = nowRef.current()\n void dispatch({\n type: 'reply',\n id,\n reply: { id: idRef.current(), author, createdAt: t, body },\n now: t,\n })\n },\n resolve: (id, resolved) =>\n void dispatch({ type: 'resolve', id, resolved, now: nowRef.current() }),\n undo: () => {\n if (!readOnly) commit(historyUndo(historyRef.current))\n },\n redo: () => {\n if (!readOnly) commit(historyRedo(historyRef.current))\n },\n canUndo: !readOnly && historyCanUndo(history),\n canRedo: !readOnly && historyCanRedo(history),\n flush: save,\n }\n }, [\n present,\n history,\n status,\n error,\n saving,\n dirty,\n offline,\n readOnly,\n author,\n tool,\n settings,\n selectedId,\n stamp,\n dispatch,\n commit,\n save,\n ])\n\n return controller\n}\n"],
|
|
5
|
+
"mappings": "AAaA,SAAS,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AAClE;AAAA,EACE;AAAA,OAMK;AACP,SAAS,mBAAmB;AAC5B,SAAS,kBAAyD;AAClE;AAAA,EACE;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,EACR,QAA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QAAQ;AAAA,QACpB,IAAI;AAAA,MACN,CAAC;AAAA,MACH,OAAO,CAAC,IAAI,SAAS;AACnB,cAAM,IAAI,OAAO,QAAQ;AACzB,aAAK,SAAS;AAAA,UACZ,MAAM;AAAA,UACN;AAAA,UACA,OAAO,EAAE,IAAI,MAAM,QAAQ,GAAG,QAAQ,WAAW,GAAG,KAAK;AAAA,UACzD,KAAK;AAAA,QACP,CAAC;AAAA,MACH;AAAA,MACA,SAAS,CAAC,IAAI,aACZ,KAAK,SAAS,EAAE,MAAM,WAAW,IAAI,UAAU,KAAK,OAAO,QAAQ,EAAE,CAAC;AAAA,MACxE,MAAM,MAAM;AACV,YAAI,CAAC,SAAU,QAAO,YAAY,WAAW,OAAO,CAAC;AAAA,MACvD;AAAA,MACA,MAAM,MAAM;AACV,YAAI,CAAC,SAAU,QAAO,YAAY,WAAW,OAAO,CAAC;AAAA,MACvD;AAAA,MACA,SAAS,CAAC,YAAY,eAAe,OAAO;AAAA,MAC5C,SAAS,CAAC,YAAY,eAAe,OAAO;AAAA,MAC5C,OAAO;AAAA,IACT;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/artifacts/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkV5WCKJEH_cjs = require('../chunk-V5WCKJEH.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkSUMXDNYG_cjs = require('../chunk-SUMXDNYG.cjs');
|
|
5
5
|
var chunk3AADNIOK_cjs = require('../chunk-3AADNIOK.cjs');
|
|
6
6
|
var chunkZZBCZRA5_cjs = require('../chunk-ZZBCZRA5.cjs');
|
|
7
7
|
require('../chunk-N73IMVFF.cjs');
|
|
@@ -331,7 +331,7 @@ function useArtifactVersions(workspaceId, docId) {
|
|
|
331
331
|
() => (documents ?? []).find((d) => d.external_id === plainId),
|
|
332
332
|
[documents, plainId]
|
|
333
333
|
);
|
|
334
|
-
const { data: history } =
|
|
334
|
+
const { data: history } = chunkSUMXDNYG_cjs.useDocumentVersionList(plainId, {
|
|
335
335
|
enabled: !!plainId && documents !== void 0 && !listed
|
|
336
336
|
});
|
|
337
337
|
return react.useMemo(
|