@semiont/react-ui 0.2.45 → 0.2.46
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/index.d.mts +50 -42
- package/dist/index.mjs +710 -663
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/resource/ResourceViewer.tsx +2 -2
- package/src/components/resource/panels/AssessmentPanel.tsx +1 -1
- package/src/components/resource/panels/CommentsPanel.tsx +1 -1
- package/src/components/resource/panels/HighlightPanel.tsx +2 -2
- package/src/components/resource/panels/ReferencesPanel.tsx +1 -1
- package/src/components/resource/panels/TaggingPanel.tsx +1 -1
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +4 -4
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +3 -3
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +4 -4
- package/src/features/resource-viewer/__tests__/AnnotationCreationPending.test.tsx +11 -11
- package/src/features/resource-viewer/__tests__/AnnotationDeletionIntegration.test.tsx +2 -2
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +40 -1
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +7 -2
package/dist/index.mjs
CHANGED
|
@@ -563,7 +563,7 @@ var QUERY_KEYS = {
|
|
|
563
563
|
annotations: {
|
|
564
564
|
detail: (aUri) => ["annotations", aUri],
|
|
565
565
|
history: (aUri) => ["annotations", aUri, "history"],
|
|
566
|
-
llmContext: (resourceUri2,
|
|
566
|
+
llmContext: (resourceUri2, annotationId2) => ["annotations", "llm-context", resourceUri2, annotationId2]
|
|
567
567
|
},
|
|
568
568
|
entityTypes: {
|
|
569
569
|
all: () => ["entity-types"]
|
|
@@ -767,17 +767,8 @@ function useAnnotations() {
|
|
|
767
767
|
if (!client) throw new Error("Not authenticated");
|
|
768
768
|
return client.createAnnotation(rUri, data2, { auth: toAccessToken(token2) });
|
|
769
769
|
},
|
|
770
|
-
onSuccess: (
|
|
771
|
-
|
|
772
|
-
const currentData = queryClient.getQueryData(queryKey);
|
|
773
|
-
if (currentData && response.annotation) {
|
|
774
|
-
queryClient.setQueryData(queryKey, {
|
|
775
|
-
...currentData,
|
|
776
|
-
annotations: [...currentData.annotations, response.annotation]
|
|
777
|
-
});
|
|
778
|
-
} else {
|
|
779
|
-
queryClient.invalidateQueries({ queryKey });
|
|
780
|
-
}
|
|
770
|
+
onSuccess: (_4, variables) => {
|
|
771
|
+
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.annotations(variables.rUri) });
|
|
781
772
|
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.events(variables.rUri) });
|
|
782
773
|
}
|
|
783
774
|
});
|
|
@@ -795,10 +786,10 @@ function useAnnotations() {
|
|
|
795
786
|
const queryKey = QUERY_KEYS.resources.annotations(variables.resourceUri);
|
|
796
787
|
const currentData = queryClient.getQueryData(queryKey);
|
|
797
788
|
if (currentData) {
|
|
798
|
-
const
|
|
789
|
+
const annotationId2 = uriToAnnotationId(variables.annotationUri);
|
|
799
790
|
queryClient.setQueryData(queryKey, {
|
|
800
791
|
...currentData,
|
|
801
|
-
annotations: currentData.annotations.filter((ann) => ann.id !==
|
|
792
|
+
annotations: currentData.annotations.filter((ann) => ann.id !== annotationId2)
|
|
802
793
|
});
|
|
803
794
|
} else {
|
|
804
795
|
queryClient.invalidateQueries({ queryKey });
|
|
@@ -820,26 +811,10 @@ function useAnnotations() {
|
|
|
820
811
|
if (!client) throw new Error("Not authenticated");
|
|
821
812
|
return client.updateAnnotationBody(annotationUri2, data2, { auth: toAccessToken(token2) });
|
|
822
813
|
},
|
|
823
|
-
onSuccess: (
|
|
824
|
-
|
|
825
|
-
if (response.annotation) {
|
|
826
|
-
queryClient.setQueryData(singleQueryKey, response.annotation);
|
|
827
|
-
} else {
|
|
828
|
-
queryClient.invalidateQueries({ queryKey: singleQueryKey });
|
|
829
|
-
}
|
|
814
|
+
onSuccess: (_4, variables) => {
|
|
815
|
+
queryClient.invalidateQueries({ queryKey: ["annotations", variables.annotationUri] });
|
|
830
816
|
const resourceUri2 = extractResourceUriFromAnnotationUri(variables.annotationUri);
|
|
831
|
-
|
|
832
|
-
const currentList = queryClient.getQueryData(listQueryKey);
|
|
833
|
-
if (currentList && response.annotation) {
|
|
834
|
-
queryClient.setQueryData(listQueryKey, {
|
|
835
|
-
...currentList,
|
|
836
|
-
annotations: currentList.annotations.map(
|
|
837
|
-
(ann) => ann.id === response.annotation.id ? response.annotation : ann
|
|
838
|
-
)
|
|
839
|
-
});
|
|
840
|
-
} else {
|
|
841
|
-
queryClient.invalidateQueries({ queryKey: listQueryKey });
|
|
842
|
-
}
|
|
817
|
+
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.annotations(resourceUri2) });
|
|
843
818
|
if (variables.data.operations) {
|
|
844
819
|
for (const op of variables.data.operations) {
|
|
845
820
|
if (op.op === "add" && op.item && typeof op.item === "object") {
|
|
@@ -858,10 +833,10 @@ function useAnnotations() {
|
|
|
858
833
|
}
|
|
859
834
|
},
|
|
860
835
|
llmContext: {
|
|
861
|
-
useQuery: (resourceUri2,
|
|
862
|
-
queryKey: QUERY_KEYS.annotations.llmContext(resourceUri2,
|
|
863
|
-
queryFn: () => client.getAnnotationLLMContext(resourceUri2,
|
|
864
|
-
enabled: !!client && !!resourceUri2 && !!
|
|
836
|
+
useQuery: (resourceUri2, annotationId2, options) => useQuery({
|
|
837
|
+
queryKey: QUERY_KEYS.annotations.llmContext(resourceUri2, annotationId2),
|
|
838
|
+
queryFn: () => client.getAnnotationLLMContext(resourceUri2, annotationId2, { ...options, auth: toAccessToken(token) }),
|
|
839
|
+
enabled: !!client && !!resourceUri2 && !!annotationId2,
|
|
865
840
|
staleTime: 5 * 60 * 1e3
|
|
866
841
|
// 5 minutes - context doesn't change often
|
|
867
842
|
})
|
|
@@ -18219,13 +18194,83 @@ function useResourceEvents({
|
|
|
18219
18194
|
};
|
|
18220
18195
|
}
|
|
18221
18196
|
|
|
18197
|
+
// src/hooks/useGlobalEvents.ts
|
|
18198
|
+
import { useEffect as useEffect5, useState as useState6, useRef as useRef5, useCallback as useCallback7 } from "react";
|
|
18199
|
+
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
18200
|
+
import { accessToken as accessToken3 } from "@semiont/core";
|
|
18201
|
+
function useGlobalEvents({ autoConnect = true } = {}) {
|
|
18202
|
+
const client = useApiClient();
|
|
18203
|
+
const token = useAuthToken();
|
|
18204
|
+
const eventBus = useEventBus();
|
|
18205
|
+
const queryClient = useQueryClient2();
|
|
18206
|
+
const [status, setStatus] = useState6("disconnected");
|
|
18207
|
+
const streamRef = useRef5(null);
|
|
18208
|
+
const connectingRef = useRef5(false);
|
|
18209
|
+
const handleEvent = useCallback7((event) => {
|
|
18210
|
+
switch (event.type) {
|
|
18211
|
+
case "entitytype.added":
|
|
18212
|
+
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.entityTypes.all() });
|
|
18213
|
+
break;
|
|
18214
|
+
}
|
|
18215
|
+
}, [queryClient]);
|
|
18216
|
+
useEffect5(() => {
|
|
18217
|
+
const subscription = eventBus.get("make-meaning:event").subscribe((event) => {
|
|
18218
|
+
handleEvent(event);
|
|
18219
|
+
});
|
|
18220
|
+
return () => subscription.unsubscribe();
|
|
18221
|
+
}, [eventBus, handleEvent]);
|
|
18222
|
+
const connect = useCallback7(async () => {
|
|
18223
|
+
if (connectingRef.current || streamRef.current) return;
|
|
18224
|
+
connectingRef.current = true;
|
|
18225
|
+
if (!client) {
|
|
18226
|
+
setStatus("error");
|
|
18227
|
+
connectingRef.current = false;
|
|
18228
|
+
return;
|
|
18229
|
+
}
|
|
18230
|
+
setStatus("connecting");
|
|
18231
|
+
try {
|
|
18232
|
+
const stream = client.sse.globalEvents({
|
|
18233
|
+
...token ? { auth: accessToken3(token) } : {},
|
|
18234
|
+
eventBus
|
|
18235
|
+
});
|
|
18236
|
+
streamRef.current = stream;
|
|
18237
|
+
setStatus("connected");
|
|
18238
|
+
connectingRef.current = false;
|
|
18239
|
+
} catch (error) {
|
|
18240
|
+
console.error("[GlobalEvents] Failed to connect:", error);
|
|
18241
|
+
setStatus("error");
|
|
18242
|
+
connectingRef.current = false;
|
|
18243
|
+
}
|
|
18244
|
+
}, [client, token, eventBus]);
|
|
18245
|
+
const disconnect = useCallback7(() => {
|
|
18246
|
+
if (streamRef.current) {
|
|
18247
|
+
streamRef.current.close();
|
|
18248
|
+
streamRef.current = null;
|
|
18249
|
+
}
|
|
18250
|
+
setStatus("disconnected");
|
|
18251
|
+
connectingRef.current = false;
|
|
18252
|
+
}, []);
|
|
18253
|
+
useEffect5(() => {
|
|
18254
|
+
if (autoConnect && client) {
|
|
18255
|
+
connect();
|
|
18256
|
+
}
|
|
18257
|
+
return () => disconnect();
|
|
18258
|
+
}, [autoConnect, client]);
|
|
18259
|
+
return {
|
|
18260
|
+
status,
|
|
18261
|
+
connect,
|
|
18262
|
+
disconnect,
|
|
18263
|
+
isConnected: status === "connected"
|
|
18264
|
+
};
|
|
18265
|
+
}
|
|
18266
|
+
|
|
18222
18267
|
// src/hooks/useRovingTabIndex.ts
|
|
18223
|
-
import { useRef as
|
|
18268
|
+
import { useRef as useRef6, useEffect as useEffect6, useCallback as useCallback8 } from "react";
|
|
18224
18269
|
function useRovingTabIndex(itemCount, options = {}) {
|
|
18225
18270
|
const { orientation = "horizontal", loop = true, cols = 1 } = options;
|
|
18226
|
-
const containerRef =
|
|
18227
|
-
const currentIndexRef =
|
|
18228
|
-
const getFocusableItems =
|
|
18271
|
+
const containerRef = useRef6(null);
|
|
18272
|
+
const currentIndexRef = useRef6(0);
|
|
18273
|
+
const getFocusableItems = useCallback8(() => {
|
|
18229
18274
|
if (!containerRef.current) return [];
|
|
18230
18275
|
return Array.from(
|
|
18231
18276
|
containerRef.current.querySelectorAll(
|
|
@@ -18233,7 +18278,7 @@ function useRovingTabIndex(itemCount, options = {}) {
|
|
|
18233
18278
|
)
|
|
18234
18279
|
);
|
|
18235
18280
|
}, []);
|
|
18236
|
-
const focusItem =
|
|
18281
|
+
const focusItem = useCallback8((index2) => {
|
|
18237
18282
|
const items = getFocusableItems();
|
|
18238
18283
|
if (items.length === 0) return;
|
|
18239
18284
|
let targetIndex = index2;
|
|
@@ -18248,7 +18293,7 @@ function useRovingTabIndex(itemCount, options = {}) {
|
|
|
18248
18293
|
items[targetIndex]?.focus();
|
|
18249
18294
|
currentIndexRef.current = targetIndex;
|
|
18250
18295
|
}, [getFocusableItems, loop]);
|
|
18251
|
-
const handleKeyDown =
|
|
18296
|
+
const handleKeyDown = useCallback8(
|
|
18252
18297
|
(event) => {
|
|
18253
18298
|
const items = getFocusableItems();
|
|
18254
18299
|
if (items.length === 0) return;
|
|
@@ -18300,7 +18345,7 @@ function useRovingTabIndex(itemCount, options = {}) {
|
|
|
18300
18345
|
},
|
|
18301
18346
|
[orientation, cols, getFocusableItems, focusItem]
|
|
18302
18347
|
);
|
|
18303
|
-
|
|
18348
|
+
useEffect6(() => {
|
|
18304
18349
|
const items = getFocusableItems();
|
|
18305
18350
|
if (items.length === 0) return;
|
|
18306
18351
|
items.forEach((item, i12) => {
|
|
@@ -18335,12 +18380,12 @@ function useRovingTabIndex(itemCount, options = {}) {
|
|
|
18335
18380
|
}
|
|
18336
18381
|
|
|
18337
18382
|
// src/hooks/useSessionExpiry.ts
|
|
18338
|
-
import { useState as
|
|
18383
|
+
import { useState as useState7, useEffect as useEffect7 } from "react";
|
|
18339
18384
|
function useSessionExpiry() {
|
|
18340
18385
|
const { expiresAt } = useSessionContext();
|
|
18341
|
-
const [timeRemaining, setTimeRemaining] =
|
|
18342
|
-
const [isExpiringSoon, setIsExpiringSoon] =
|
|
18343
|
-
|
|
18386
|
+
const [timeRemaining, setTimeRemaining] = useState7(null);
|
|
18387
|
+
const [isExpiringSoon, setIsExpiringSoon] = useState7(false);
|
|
18388
|
+
useEffect7(() => {
|
|
18344
18389
|
if (!expiresAt) {
|
|
18345
18390
|
setTimeRemaining(null);
|
|
18346
18391
|
setIsExpiringSoon(false);
|
|
@@ -18359,28 +18404,28 @@ function useSessionExpiry() {
|
|
|
18359
18404
|
}
|
|
18360
18405
|
|
|
18361
18406
|
// src/contexts/ThemeContext.tsx
|
|
18362
|
-
import { createContext as createContext2, useContext as useContext2, useEffect as
|
|
18407
|
+
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect8, useState as useState8 } from "react";
|
|
18363
18408
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
18364
18409
|
var ThemeContext = createContext2(null);
|
|
18365
18410
|
function ThemeProvider({ children }) {
|
|
18366
|
-
const [theme2, setThemeState] =
|
|
18411
|
+
const [theme2, setThemeState] = useState8(() => {
|
|
18367
18412
|
if (typeof window !== "undefined") {
|
|
18368
18413
|
return localStorage.getItem("theme") || "system";
|
|
18369
18414
|
}
|
|
18370
18415
|
return "system";
|
|
18371
18416
|
});
|
|
18372
|
-
const [systemTheme, setSystemTheme] =
|
|
18417
|
+
const [systemTheme, setSystemTheme] = useState8(() => {
|
|
18373
18418
|
if (typeof window !== "undefined") {
|
|
18374
18419
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
18375
18420
|
}
|
|
18376
18421
|
return "light";
|
|
18377
18422
|
});
|
|
18378
18423
|
const resolvedTheme = theme2 === "system" ? systemTheme : theme2;
|
|
18379
|
-
|
|
18424
|
+
useEffect8(() => {
|
|
18380
18425
|
const root4 = window.document.documentElement;
|
|
18381
18426
|
root4.setAttribute("data-theme", resolvedTheme);
|
|
18382
18427
|
}, [resolvedTheme]);
|
|
18383
|
-
|
|
18428
|
+
useEffect8(() => {
|
|
18384
18429
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
18385
18430
|
const handleChange = (e6) => {
|
|
18386
18431
|
setSystemTheme(e6.matches ? "dark" : "light");
|
|
@@ -18405,20 +18450,20 @@ function useTheme() {
|
|
|
18405
18450
|
}
|
|
18406
18451
|
|
|
18407
18452
|
// src/hooks/useUI.ts
|
|
18408
|
-
import { useState as
|
|
18453
|
+
import { useState as useState9, useEffect as useEffect9, useCallback as useCallback9, useRef as useRef7 } from "react";
|
|
18409
18454
|
function useDropdown() {
|
|
18410
|
-
const [isOpen, setIsOpen] =
|
|
18411
|
-
const dropdownRef =
|
|
18412
|
-
const toggle =
|
|
18455
|
+
const [isOpen, setIsOpen] = useState9(false);
|
|
18456
|
+
const dropdownRef = useRef7(null);
|
|
18457
|
+
const toggle = useCallback9(() => {
|
|
18413
18458
|
setIsOpen((prev) => !prev);
|
|
18414
18459
|
}, []);
|
|
18415
|
-
const open =
|
|
18460
|
+
const open = useCallback9(() => {
|
|
18416
18461
|
setIsOpen(true);
|
|
18417
18462
|
}, []);
|
|
18418
|
-
const close =
|
|
18463
|
+
const close = useCallback9(() => {
|
|
18419
18464
|
setIsOpen(false);
|
|
18420
18465
|
}, []);
|
|
18421
|
-
|
|
18466
|
+
useEffect9(() => {
|
|
18422
18467
|
function handleClickOutside(event) {
|
|
18423
18468
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
18424
18469
|
close();
|
|
@@ -18430,7 +18475,7 @@ function useDropdown() {
|
|
|
18430
18475
|
}
|
|
18431
18476
|
return void 0;
|
|
18432
18477
|
}, [isOpen, close]);
|
|
18433
|
-
|
|
18478
|
+
useEffect9(() => {
|
|
18434
18479
|
function handleEscape(event) {
|
|
18435
18480
|
if (event.key === "Escape") {
|
|
18436
18481
|
close();
|
|
@@ -18451,20 +18496,20 @@ function useDropdown() {
|
|
|
18451
18496
|
};
|
|
18452
18497
|
}
|
|
18453
18498
|
function useLoadingState(minLoadingTime = 500) {
|
|
18454
|
-
const [isLoading, setIsLoading] =
|
|
18455
|
-
const [showLoading, setShowLoading] =
|
|
18456
|
-
const timeoutRef =
|
|
18457
|
-
const startLoading =
|
|
18499
|
+
const [isLoading, setIsLoading] = useState9(false);
|
|
18500
|
+
const [showLoading, setShowLoading] = useState9(false);
|
|
18501
|
+
const timeoutRef = useRef7(null);
|
|
18502
|
+
const startLoading = useCallback9(() => {
|
|
18458
18503
|
setIsLoading(true);
|
|
18459
18504
|
setShowLoading(true);
|
|
18460
18505
|
}, []);
|
|
18461
|
-
const stopLoading =
|
|
18506
|
+
const stopLoading = useCallback9(() => {
|
|
18462
18507
|
setIsLoading(false);
|
|
18463
18508
|
timeoutRef.current = setTimeout(() => {
|
|
18464
18509
|
setShowLoading(false);
|
|
18465
18510
|
}, minLoadingTime);
|
|
18466
18511
|
}, [minLoadingTime]);
|
|
18467
|
-
|
|
18512
|
+
useEffect9(() => {
|
|
18468
18513
|
return () => {
|
|
18469
18514
|
if (timeoutRef.current) {
|
|
18470
18515
|
clearTimeout(timeoutRef.current);
|
|
@@ -18479,7 +18524,7 @@ function useLoadingState(minLoadingTime = 500) {
|
|
|
18479
18524
|
};
|
|
18480
18525
|
}
|
|
18481
18526
|
function useLocalStorage(key, initialValue) {
|
|
18482
|
-
const [storedValue, setStoredValue] =
|
|
18527
|
+
const [storedValue, setStoredValue] = useState9(() => {
|
|
18483
18528
|
if (typeof window === "undefined") {
|
|
18484
18529
|
return initialValue;
|
|
18485
18530
|
}
|
|
@@ -18491,7 +18536,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
18491
18536
|
return initialValue;
|
|
18492
18537
|
}
|
|
18493
18538
|
});
|
|
18494
|
-
const setValue =
|
|
18539
|
+
const setValue = useCallback9((value) => {
|
|
18495
18540
|
try {
|
|
18496
18541
|
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
18497
18542
|
setStoredValue(valueToStore);
|
|
@@ -18506,14 +18551,14 @@ function useLocalStorage(key, initialValue) {
|
|
|
18506
18551
|
}
|
|
18507
18552
|
|
|
18508
18553
|
// src/hooks/useResourceContent.ts
|
|
18509
|
-
import { useEffect as
|
|
18554
|
+
import { useEffect as useEffect10 } from "react";
|
|
18510
18555
|
import { getPrimaryMediaType } from "@semiont/api-client";
|
|
18511
18556
|
function useResourceContent(rUri, resource) {
|
|
18512
18557
|
const { showError } = useToast();
|
|
18513
18558
|
const resources = useResources();
|
|
18514
18559
|
const mediaType = getPrimaryMediaType(resource) || "text/plain";
|
|
18515
18560
|
const { data: data2, isLoading, error } = resources.representation.useQuery(rUri, mediaType);
|
|
18516
|
-
|
|
18561
|
+
useEffect10(() => {
|
|
18517
18562
|
if (error) {
|
|
18518
18563
|
console.error("Failed to fetch representation:", error);
|
|
18519
18564
|
showError("Failed to load resource representation");
|
|
@@ -18556,10 +18601,10 @@ function useCacheManager() {
|
|
|
18556
18601
|
}
|
|
18557
18602
|
|
|
18558
18603
|
// src/contexts/ResourceAnnotationsContext.tsx
|
|
18559
|
-
import { createContext as createContext6, useContext as useContext6, useState as
|
|
18604
|
+
import { createContext as createContext6, useContext as useContext6, useState as useState11, useCallback as useCallback11, useMemo } from "react";
|
|
18560
18605
|
|
|
18561
18606
|
// src/components/LiveRegion.tsx
|
|
18562
|
-
import { useState as
|
|
18607
|
+
import { useState as useState10, createContext as createContext5, useContext as useContext5, useCallback as useCallback10 } from "react";
|
|
18563
18608
|
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
18564
18609
|
var LiveRegionContext = createContext5(null);
|
|
18565
18610
|
function useLiveRegion() {
|
|
@@ -18571,9 +18616,9 @@ function useLiveRegion() {
|
|
|
18571
18616
|
return context;
|
|
18572
18617
|
}
|
|
18573
18618
|
function LiveRegionProvider({ children }) {
|
|
18574
|
-
const [politeMessage, setPoliteMessage] =
|
|
18575
|
-
const [assertiveMessage, setAssertiveMessage] =
|
|
18576
|
-
const announce =
|
|
18619
|
+
const [politeMessage, setPoliteMessage] = useState10("");
|
|
18620
|
+
const [assertiveMessage, setAssertiveMessage] = useState10("");
|
|
18621
|
+
const announce = useCallback10((message, priority = "polite") => {
|
|
18577
18622
|
if (priority === "assertive") {
|
|
18578
18623
|
setAssertiveMessage(message);
|
|
18579
18624
|
setTimeout(() => setAssertiveMessage(""), 1e3);
|
|
@@ -18608,14 +18653,14 @@ function LiveRegionProvider({ children }) {
|
|
|
18608
18653
|
}
|
|
18609
18654
|
function useSearchAnnouncements() {
|
|
18610
18655
|
const { announce } = useLiveRegion();
|
|
18611
|
-
const announceSearchResults =
|
|
18656
|
+
const announceSearchResults = useCallback10((count2, query) => {
|
|
18612
18657
|
if (count2 === 0) {
|
|
18613
18658
|
announce(`No results found for ${query}`, "polite");
|
|
18614
18659
|
} else {
|
|
18615
18660
|
announce(`${count2} result${count2 === 1 ? "" : "s"} found for ${query}`, "polite");
|
|
18616
18661
|
}
|
|
18617
18662
|
}, [announce]);
|
|
18618
|
-
const announceSearching =
|
|
18663
|
+
const announceSearching = useCallback10(() => {
|
|
18619
18664
|
announce("Searching...", "polite");
|
|
18620
18665
|
}, [announce]);
|
|
18621
18666
|
return {
|
|
@@ -18625,26 +18670,26 @@ function useSearchAnnouncements() {
|
|
|
18625
18670
|
}
|
|
18626
18671
|
function useDocumentAnnouncements(annotators) {
|
|
18627
18672
|
const { announce } = useLiveRegion();
|
|
18628
|
-
const announceDocumentSaved =
|
|
18673
|
+
const announceDocumentSaved = useCallback10(() => {
|
|
18629
18674
|
announce("Document saved successfully", "polite");
|
|
18630
18675
|
}, [announce]);
|
|
18631
|
-
const announceDocumentDeleted =
|
|
18676
|
+
const announceDocumentDeleted = useCallback10(() => {
|
|
18632
18677
|
announce("Document deleted", "polite");
|
|
18633
18678
|
}, [announce]);
|
|
18634
|
-
const announceAnnotationCreated =
|
|
18679
|
+
const announceAnnotationCreated = useCallback10((annotation) => {
|
|
18635
18680
|
const metadata = annotators ? Object.values(annotators).find((a15) => a15.matchesAnnotation(annotation)) : null;
|
|
18636
18681
|
const message = metadata?.announceOnCreate ?? "Annotation created";
|
|
18637
18682
|
announce(message, "polite");
|
|
18638
18683
|
}, [announce, annotators]);
|
|
18639
|
-
const announceAnnotationDeleted =
|
|
18684
|
+
const announceAnnotationDeleted = useCallback10(() => {
|
|
18640
18685
|
announce("Annotation deleted", "polite");
|
|
18641
18686
|
}, [announce]);
|
|
18642
|
-
const announceAnnotationUpdated =
|
|
18687
|
+
const announceAnnotationUpdated = useCallback10((annotation) => {
|
|
18643
18688
|
const metadata = annotators ? Object.values(annotators).find((a15) => a15.matchesAnnotation(annotation)) : null;
|
|
18644
18689
|
const message = `${metadata?.displayName ?? "Annotation"} updated`;
|
|
18645
18690
|
announce(message, "polite");
|
|
18646
18691
|
}, [announce, annotators]);
|
|
18647
|
-
const announceError =
|
|
18692
|
+
const announceError = useCallback10((message) => {
|
|
18648
18693
|
announce(`Error: ${message}`, "assertive");
|
|
18649
18694
|
}, [announce]);
|
|
18650
18695
|
return {
|
|
@@ -18658,18 +18703,18 @@ function useDocumentAnnouncements(annotators) {
|
|
|
18658
18703
|
}
|
|
18659
18704
|
function useResourceLoadingAnnouncements() {
|
|
18660
18705
|
const { announce } = useLiveRegion();
|
|
18661
|
-
const announceResourceLoading =
|
|
18706
|
+
const announceResourceLoading = useCallback10((resourceName) => {
|
|
18662
18707
|
const message = resourceName ? `Loading ${resourceName}...` : "Loading resource...";
|
|
18663
18708
|
announce(message, "polite");
|
|
18664
18709
|
}, [announce]);
|
|
18665
|
-
const announceResourceLoaded =
|
|
18710
|
+
const announceResourceLoaded = useCallback10((resourceName) => {
|
|
18666
18711
|
announce(`${resourceName} loaded successfully`, "polite");
|
|
18667
18712
|
}, [announce]);
|
|
18668
|
-
const announceResourceLoadError =
|
|
18713
|
+
const announceResourceLoadError = useCallback10((resourceName) => {
|
|
18669
18714
|
const message = resourceName ? `Failed to load ${resourceName}` : "Failed to load resource";
|
|
18670
18715
|
announce(message, "assertive");
|
|
18671
18716
|
}, [announce]);
|
|
18672
|
-
const announceResourceUpdating =
|
|
18717
|
+
const announceResourceUpdating = useCallback10((resourceName) => {
|
|
18673
18718
|
announce(`Updating ${resourceName}...`, "polite");
|
|
18674
18719
|
}, [announce]);
|
|
18675
18720
|
return {
|
|
@@ -18681,16 +18726,16 @@ function useResourceLoadingAnnouncements() {
|
|
|
18681
18726
|
}
|
|
18682
18727
|
function useFormAnnouncements() {
|
|
18683
18728
|
const { announce } = useLiveRegion();
|
|
18684
|
-
const announceFormSubmitting =
|
|
18729
|
+
const announceFormSubmitting = useCallback10(() => {
|
|
18685
18730
|
announce("Submitting form...", "polite");
|
|
18686
18731
|
}, [announce]);
|
|
18687
|
-
const announceFormSuccess =
|
|
18732
|
+
const announceFormSuccess = useCallback10((message) => {
|
|
18688
18733
|
announce(message || "Form submitted successfully", "polite");
|
|
18689
18734
|
}, [announce]);
|
|
18690
|
-
const announceFormError =
|
|
18735
|
+
const announceFormError = useCallback10((message) => {
|
|
18691
18736
|
announce(message || "Form submission failed. Please check your entries and try again.", "assertive");
|
|
18692
18737
|
}, [announce]);
|
|
18693
|
-
const announceFormValidationError =
|
|
18738
|
+
const announceFormValidationError = useCallback10((fieldCount) => {
|
|
18694
18739
|
const message = fieldCount === 1 ? "There is 1 field with an error" : `There are ${fieldCount} fields with errors`;
|
|
18695
18740
|
announce(message, "assertive");
|
|
18696
18741
|
}, [announce]);
|
|
@@ -18703,10 +18748,10 @@ function useFormAnnouncements() {
|
|
|
18703
18748
|
}
|
|
18704
18749
|
function useLanguageChangeAnnouncements() {
|
|
18705
18750
|
const { announce } = useLiveRegion();
|
|
18706
|
-
const announceLanguageChanging =
|
|
18751
|
+
const announceLanguageChanging = useCallback10((newLanguage) => {
|
|
18707
18752
|
announce(`Changing language to ${newLanguage}...`, "polite");
|
|
18708
18753
|
}, [announce]);
|
|
18709
|
-
const announceLanguageChanged =
|
|
18754
|
+
const announceLanguageChanged = useCallback10((newLanguage) => {
|
|
18710
18755
|
announce(`Language changed to ${newLanguage}`, "polite");
|
|
18711
18756
|
}, [announce]);
|
|
18712
18757
|
return {
|
|
@@ -18719,11 +18764,11 @@ function useLanguageChangeAnnouncements() {
|
|
|
18719
18764
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
18720
18765
|
var ResourceAnnotationsContext = createContext6(void 0);
|
|
18721
18766
|
function ResourceAnnotationsProvider({ children }) {
|
|
18722
|
-
const [newAnnotationIds, setNewAnnotationIds] =
|
|
18723
|
-
const {
|
|
18767
|
+
const [newAnnotationIds, setNewAnnotationIds] = useState11(/* @__PURE__ */ new Set());
|
|
18768
|
+
const { announce } = useLiveRegion();
|
|
18724
18769
|
const annotations = useAnnotations();
|
|
18725
18770
|
const createAnnotationMutation = annotations.create.useMutation();
|
|
18726
|
-
const createAnnotation =
|
|
18771
|
+
const createAnnotation = useCallback11(async (rUri, motivation, selector, body = []) => {
|
|
18727
18772
|
try {
|
|
18728
18773
|
const createData = {
|
|
18729
18774
|
motivation,
|
|
@@ -18737,37 +18782,37 @@ function ResourceAnnotationsProvider({ children }) {
|
|
|
18737
18782
|
rUri,
|
|
18738
18783
|
data: createData
|
|
18739
18784
|
});
|
|
18740
|
-
if (result.
|
|
18741
|
-
setNewAnnotationIds((prev) => new Set(prev).add(result.
|
|
18785
|
+
if (result.annotationId) {
|
|
18786
|
+
setNewAnnotationIds((prev) => new Set(prev).add(result.annotationId));
|
|
18742
18787
|
setTimeout(() => {
|
|
18743
18788
|
setNewAnnotationIds((prev) => {
|
|
18744
18789
|
const next = new Set(prev);
|
|
18745
|
-
next.delete(result.
|
|
18790
|
+
next.delete(result.annotationId);
|
|
18746
18791
|
return next;
|
|
18747
18792
|
});
|
|
18748
18793
|
}, 6e3);
|
|
18749
|
-
|
|
18794
|
+
announce("Annotation created", "polite");
|
|
18750
18795
|
}
|
|
18751
|
-
return result.
|
|
18796
|
+
return result.annotationId;
|
|
18752
18797
|
} catch (err) {
|
|
18753
18798
|
console.error("Failed to create annotation:", err);
|
|
18754
|
-
|
|
18799
|
+
announce("Failed to create annotation", "assertive");
|
|
18755
18800
|
throw err;
|
|
18756
18801
|
}
|
|
18757
|
-
}, [createAnnotationMutation,
|
|
18758
|
-
const clearNewAnnotationId =
|
|
18802
|
+
}, [createAnnotationMutation, announce]);
|
|
18803
|
+
const clearNewAnnotationId = useCallback11((id2) => {
|
|
18759
18804
|
setNewAnnotationIds((prev) => {
|
|
18760
18805
|
const next = new Set(prev);
|
|
18761
18806
|
next.delete(id2);
|
|
18762
18807
|
return next;
|
|
18763
18808
|
});
|
|
18764
18809
|
}, []);
|
|
18765
|
-
const triggerSparkleAnimation =
|
|
18766
|
-
setNewAnnotationIds((prev) => new Set(prev).add(
|
|
18810
|
+
const triggerSparkleAnimation = useCallback11((annotationId2) => {
|
|
18811
|
+
setNewAnnotationIds((prev) => new Set(prev).add(annotationId2));
|
|
18767
18812
|
setTimeout(() => {
|
|
18768
18813
|
setNewAnnotationIds((prev) => {
|
|
18769
18814
|
const next = new Set(prev);
|
|
18770
|
-
next.delete(
|
|
18815
|
+
next.delete(annotationId2);
|
|
18771
18816
|
return next;
|
|
18772
18817
|
});
|
|
18773
18818
|
}, 6e3);
|
|
@@ -18792,7 +18837,7 @@ function useResourceAnnotations() {
|
|
|
18792
18837
|
}
|
|
18793
18838
|
|
|
18794
18839
|
// src/components/CodeMirrorRenderer.tsx
|
|
18795
|
-
import { useEffect as
|
|
18840
|
+
import { useEffect as useEffect11, useRef as useRef8 } from "react";
|
|
18796
18841
|
|
|
18797
18842
|
// ../../node_modules/@codemirror/autocomplete/dist/index.js
|
|
18798
18843
|
var CompletionContext = class {
|
|
@@ -26111,11 +26156,11 @@ var pasteURLAsLink = /* @__PURE__ */ EditorView.domEventHandlers({
|
|
|
26111
26156
|
});
|
|
26112
26157
|
|
|
26113
26158
|
// src/lib/scroll-utils.ts
|
|
26114
|
-
function scrollAnnotationIntoView(
|
|
26115
|
-
if (!
|
|
26159
|
+
function scrollAnnotationIntoView(annotationId2, rootElement, options = {}) {
|
|
26160
|
+
if (!annotationId2) return false;
|
|
26116
26161
|
const { pulse = false, behavior = "smooth" } = options;
|
|
26117
26162
|
const element2 = rootElement.querySelector(
|
|
26118
|
-
`[data-annotation-id="${CSS.escape(
|
|
26163
|
+
`[data-annotation-id="${CSS.escape(annotationId2)}"]`
|
|
26119
26164
|
);
|
|
26120
26165
|
if (!element2) return false;
|
|
26121
26166
|
const scrollContainer = element2.closest(".semiont-browse-view__content") || element2.closest(".semiont-annotate-view__content") || element2.closest(".semiont-document-viewer__scrollable-body");
|
|
@@ -26244,12 +26289,12 @@ function computeWidgetDecorations(segments, generatingReferenceId, getTargetDocu
|
|
|
26244
26289
|
// src/lib/codemirror-handlers.ts
|
|
26245
26290
|
function handleAnnotationClick(target, segmentsById, eventBus) {
|
|
26246
26291
|
const annotationElement = target.closest("[data-annotation-id]");
|
|
26247
|
-
const
|
|
26248
|
-
if (!
|
|
26249
|
-
const segment = segmentsById.get(
|
|
26292
|
+
const annotationId2 = annotationElement?.getAttribute("data-annotation-id");
|
|
26293
|
+
if (!annotationId2) return false;
|
|
26294
|
+
const segment = segmentsById.get(annotationId2);
|
|
26250
26295
|
if (!segment?.annotation) return false;
|
|
26251
26296
|
eventBus.get("browse:click").next({
|
|
26252
|
-
annotationId,
|
|
26297
|
+
annotationId: annotationId2,
|
|
26253
26298
|
motivation: segment.annotation.motivation
|
|
26254
26299
|
});
|
|
26255
26300
|
return true;
|
|
@@ -26259,22 +26304,22 @@ function handleWidgetClick(target) {
|
|
|
26259
26304
|
if (!widget || widget.dataset.widgetGenerating === "true") {
|
|
26260
26305
|
return { handled: false };
|
|
26261
26306
|
}
|
|
26262
|
-
const
|
|
26307
|
+
const annotationId2 = widget.dataset.widgetAnnotationId;
|
|
26263
26308
|
const bodySource = widget.dataset.widgetBodySource;
|
|
26264
26309
|
const isResolved = widget.dataset.widgetResolved === "true";
|
|
26265
|
-
if (!
|
|
26310
|
+
if (!annotationId2) return { handled: false };
|
|
26266
26311
|
if (isResolved && bodySource) {
|
|
26267
26312
|
return {
|
|
26268
26313
|
handled: true,
|
|
26269
26314
|
action: "navigate",
|
|
26270
26315
|
documentId: bodySource,
|
|
26271
|
-
annotationId
|
|
26316
|
+
annotationId: annotationId2
|
|
26272
26317
|
};
|
|
26273
26318
|
}
|
|
26274
26319
|
return {
|
|
26275
26320
|
handled: true,
|
|
26276
26321
|
action: "browse-click",
|
|
26277
|
-
annotationId,
|
|
26322
|
+
annotationId: annotationId2,
|
|
26278
26323
|
motivation: widget.dataset.widgetMotivation || "linking"
|
|
26279
26324
|
};
|
|
26280
26325
|
}
|
|
@@ -26412,15 +26457,15 @@ function CodeMirrorRenderer({
|
|
|
26412
26457
|
generatingReferenceId,
|
|
26413
26458
|
hoverDelayMs
|
|
26414
26459
|
}) {
|
|
26415
|
-
const containerRef =
|
|
26416
|
-
const viewRef =
|
|
26417
|
-
const contentRef =
|
|
26460
|
+
const containerRef = useRef8(null);
|
|
26461
|
+
const viewRef = useRef8(null);
|
|
26462
|
+
const contentRef = useRef8(content4);
|
|
26418
26463
|
const convertedSegments = convertSegmentPositions(segments, content4);
|
|
26419
|
-
const segmentsRef =
|
|
26420
|
-
const segmentsByIdRef =
|
|
26421
|
-
const lineNumbersCompartment =
|
|
26422
|
-
const eventBusRef =
|
|
26423
|
-
const getTargetDocumentNameRef =
|
|
26464
|
+
const segmentsRef = useRef8(convertedSegments);
|
|
26465
|
+
const segmentsByIdRef = useRef8(/* @__PURE__ */ new Map());
|
|
26466
|
+
const lineNumbersCompartment = useRef8(new Compartment());
|
|
26467
|
+
const eventBusRef = useRef8(eventBus);
|
|
26468
|
+
const getTargetDocumentNameRef = useRef8(getTargetDocumentName);
|
|
26424
26469
|
segmentsRef.current = segments;
|
|
26425
26470
|
const segmentsById = /* @__PURE__ */ new Map();
|
|
26426
26471
|
for (const s11 of segments) {
|
|
@@ -26429,7 +26474,7 @@ function CodeMirrorRenderer({
|
|
|
26429
26474
|
segmentsByIdRef.current = segmentsById;
|
|
26430
26475
|
eventBusRef.current = eventBus;
|
|
26431
26476
|
getTargetDocumentNameRef.current = getTargetDocumentName;
|
|
26432
|
-
|
|
26477
|
+
useEffect11(() => {
|
|
26433
26478
|
if (!containerRef.current || viewRef.current) return;
|
|
26434
26479
|
const annotationDecorationsField = createAnnotationDecorationsField();
|
|
26435
26480
|
const state = EditorState.create({
|
|
@@ -26510,14 +26555,14 @@ function CodeMirrorRenderer({
|
|
|
26510
26555
|
containerRef.current.__cmView = view;
|
|
26511
26556
|
const container = view.dom;
|
|
26512
26557
|
const { handleMouseEnter, handleMouseLeave, cleanup: cleanupHover } = createHoverHandlers(
|
|
26513
|
-
(
|
|
26558
|
+
(annotationId2) => eventBusRef.current?.get("beckon:hover").next({ annotationId: annotationId2 }),
|
|
26514
26559
|
hoverDelayMs
|
|
26515
26560
|
);
|
|
26516
26561
|
const handleMouseOver = (e6) => {
|
|
26517
26562
|
const target = e6.target;
|
|
26518
26563
|
const annotationElement = target.closest("[data-annotation-id]");
|
|
26519
|
-
const
|
|
26520
|
-
if (
|
|
26564
|
+
const annotationId2 = annotationElement?.getAttribute("data-annotation-id");
|
|
26565
|
+
if (annotationId2) handleMouseEnter(annotationId2);
|
|
26521
26566
|
};
|
|
26522
26567
|
const handleMouseOut = (e6) => {
|
|
26523
26568
|
const target = e6.target;
|
|
@@ -26564,7 +26609,7 @@ function CodeMirrorRenderer({
|
|
|
26564
26609
|
viewRef.current = null;
|
|
26565
26610
|
};
|
|
26566
26611
|
}, [hoverDelayMs]);
|
|
26567
|
-
|
|
26612
|
+
useEffect11(() => {
|
|
26568
26613
|
if (!viewRef.current) return;
|
|
26569
26614
|
const currentContent = viewRef.current.state.doc.toString();
|
|
26570
26615
|
if (content4 === currentContent) return;
|
|
@@ -26580,19 +26625,19 @@ function CodeMirrorRenderer({
|
|
|
26580
26625
|
});
|
|
26581
26626
|
contentRef.current = content4;
|
|
26582
26627
|
}, [content4]);
|
|
26583
|
-
|
|
26628
|
+
useEffect11(() => {
|
|
26584
26629
|
if (!viewRef.current) return;
|
|
26585
26630
|
viewRef.current.dispatch({
|
|
26586
26631
|
effects: lineNumbersCompartment.current.reconfigure(showLineNumbers ? lineNumbers() : [])
|
|
26587
26632
|
});
|
|
26588
26633
|
}, [showLineNumbers]);
|
|
26589
|
-
|
|
26634
|
+
useEffect11(() => {
|
|
26590
26635
|
if (!viewRef.current) return;
|
|
26591
26636
|
viewRef.current.dispatch({
|
|
26592
26637
|
effects: updateAnnotationsEffect.of({ segments: convertedSegments, ...newAnnotationIds && { newAnnotationIds } })
|
|
26593
26638
|
});
|
|
26594
26639
|
}, [convertedSegments, newAnnotationIds]);
|
|
26595
|
-
|
|
26640
|
+
useEffect11(() => {
|
|
26596
26641
|
if (!viewRef.current || !enableWidgets) return;
|
|
26597
26642
|
viewRef.current.dispatch({
|
|
26598
26643
|
effects: updateWidgetsEffect.of({
|
|
@@ -26603,7 +26648,7 @@ function CodeMirrorRenderer({
|
|
|
26603
26648
|
})
|
|
26604
26649
|
});
|
|
26605
26650
|
}, [content4, convertedSegments, enableWidgets, generatingReferenceId]);
|
|
26606
|
-
|
|
26651
|
+
useEffect11(() => {
|
|
26607
26652
|
if (!viewRef.current || !hoveredAnnotationId) return void 0;
|
|
26608
26653
|
const view = viewRef.current;
|
|
26609
26654
|
const element2 = view.contentDOM.querySelector(
|
|
@@ -26631,7 +26676,7 @@ function CodeMirrorRenderer({
|
|
|
26631
26676
|
element2.classList.remove("annotation-pulse");
|
|
26632
26677
|
};
|
|
26633
26678
|
}, [hoveredAnnotationId]);
|
|
26634
|
-
|
|
26679
|
+
useEffect11(() => {
|
|
26635
26680
|
if (!viewRef.current || !scrollToAnnotationId) return;
|
|
26636
26681
|
scrollAnnotationIntoView(scrollToAnnotationId, viewRef.current.contentDOM);
|
|
26637
26682
|
}, [scrollToAnnotationId]);
|
|
@@ -26818,7 +26863,7 @@ function AsyncErrorBoundary({ children }) {
|
|
|
26818
26863
|
}
|
|
26819
26864
|
|
|
26820
26865
|
// src/components/ResizeHandle.tsx
|
|
26821
|
-
import { useRef as
|
|
26866
|
+
import { useRef as useRef9, useCallback as useCallback12, useEffect as useEffect12, useState as useState12 } from "react";
|
|
26822
26867
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
26823
26868
|
function ResizeHandle({
|
|
26824
26869
|
onResize,
|
|
@@ -26827,14 +26872,14 @@ function ResizeHandle({
|
|
|
26827
26872
|
position: position3 = "left",
|
|
26828
26873
|
ariaLabel = "Resize panel"
|
|
26829
26874
|
}) {
|
|
26830
|
-
const [isDragging, setIsDragging] =
|
|
26831
|
-
const startXRef =
|
|
26832
|
-
const startWidthRef =
|
|
26833
|
-
const onResizeRef =
|
|
26834
|
-
|
|
26875
|
+
const [isDragging, setIsDragging] = useState12(false);
|
|
26876
|
+
const startXRef = useRef9(0);
|
|
26877
|
+
const startWidthRef = useRef9(0);
|
|
26878
|
+
const onResizeRef = useRef9(onResize);
|
|
26879
|
+
useEffect12(() => {
|
|
26835
26880
|
onResizeRef.current = onResize;
|
|
26836
26881
|
});
|
|
26837
|
-
const handleMouseDown =
|
|
26882
|
+
const handleMouseDown = useCallback12((e6) => {
|
|
26838
26883
|
e6.preventDefault();
|
|
26839
26884
|
setIsDragging(true);
|
|
26840
26885
|
startXRef.current = e6.clientX;
|
|
@@ -26843,7 +26888,7 @@ function ResizeHandle({
|
|
|
26843
26888
|
startWidthRef.current = parent.offsetWidth;
|
|
26844
26889
|
}
|
|
26845
26890
|
}, []);
|
|
26846
|
-
const handleMouseMove =
|
|
26891
|
+
const handleMouseMove = useCallback12((e6) => {
|
|
26847
26892
|
if (!isDragging) return;
|
|
26848
26893
|
const deltaX = e6.clientX - startXRef.current;
|
|
26849
26894
|
const widthDelta = position3 === "left" ? -deltaX : deltaX;
|
|
@@ -26851,10 +26896,10 @@ function ResizeHandle({
|
|
|
26851
26896
|
const constrainedWidth = Math.max(minWidth, Math.min(maxWidth, newWidth));
|
|
26852
26897
|
onResizeRef.current(constrainedWidth);
|
|
26853
26898
|
}, [isDragging, minWidth, maxWidth, position3]);
|
|
26854
|
-
const handleMouseUp =
|
|
26899
|
+
const handleMouseUp = useCallback12(() => {
|
|
26855
26900
|
setIsDragging(false);
|
|
26856
26901
|
}, []);
|
|
26857
|
-
const handleKeyDown =
|
|
26902
|
+
const handleKeyDown = useCallback12((e6) => {
|
|
26858
26903
|
const parent = e6.target.parentElement;
|
|
26859
26904
|
if (!parent) return;
|
|
26860
26905
|
const currentWidth = parent.offsetWidth;
|
|
@@ -26882,7 +26927,7 @@ function ResizeHandle({
|
|
|
26882
26927
|
onResizeRef.current(constrainedWidth);
|
|
26883
26928
|
}
|
|
26884
26929
|
}, [minWidth, maxWidth, position3]);
|
|
26885
|
-
|
|
26930
|
+
useEffect12(() => {
|
|
26886
26931
|
if (isDragging) {
|
|
26887
26932
|
document.addEventListener("mousemove", handleMouseMove);
|
|
26888
26933
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -27040,7 +27085,7 @@ function Toolbar({
|
|
|
27040
27085
|
}
|
|
27041
27086
|
|
|
27042
27087
|
// src/components/settings/SettingsPanel.tsx
|
|
27043
|
-
import React6, { useEffect as
|
|
27088
|
+
import React6, { useEffect as useEffect13 } from "react";
|
|
27044
27089
|
import { LOCALES } from "@semiont/api-client";
|
|
27045
27090
|
import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
27046
27091
|
function SettingsPanel({
|
|
@@ -27059,7 +27104,7 @@ function SettingsPanel({
|
|
|
27059
27104
|
announceLanguageChanging(localeName);
|
|
27060
27105
|
eventBus.get("settings:locale-changed").next({ locale: newLocale });
|
|
27061
27106
|
};
|
|
27062
|
-
|
|
27107
|
+
useEffect13(() => {
|
|
27063
27108
|
if (locale !== previousLocale && !isPendingLocaleChange) {
|
|
27064
27109
|
const localeName = LOCALES.find((l10) => l10.code === locale)?.nativeName || locale;
|
|
27065
27110
|
announceLanguageChanged(localeName);
|
|
@@ -27178,7 +27223,7 @@ function SettingsPanel({
|
|
|
27178
27223
|
}
|
|
27179
27224
|
|
|
27180
27225
|
// src/components/annotation/AnnotateToolbar.tsx
|
|
27181
|
-
import React7, { useState as
|
|
27226
|
+
import React7, { useState as useState13, useRef as useRef10, useEffect as useEffect14 } from "react";
|
|
27182
27227
|
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
27183
27228
|
function DropdownGroup({
|
|
27184
27229
|
label,
|
|
@@ -27189,7 +27234,7 @@ function DropdownGroup({
|
|
|
27189
27234
|
onPin,
|
|
27190
27235
|
containerRef
|
|
27191
27236
|
}) {
|
|
27192
|
-
const dropdownRef =
|
|
27237
|
+
const dropdownRef = useRef10(null);
|
|
27193
27238
|
const handleKeyDown = (event) => {
|
|
27194
27239
|
if (event.key === "Enter" || event.key === " ") {
|
|
27195
27240
|
event.preventDefault();
|
|
@@ -27252,23 +27297,23 @@ function AnnotateToolbar({
|
|
|
27252
27297
|
const annotator = Object.values(annotators).find((a15) => a15.motivation === motivation);
|
|
27253
27298
|
return annotator?.iconEmoji || "\u2753";
|
|
27254
27299
|
};
|
|
27255
|
-
const [modeHovered, setModeHovered] =
|
|
27256
|
-
const [modePinned, setModePinned] =
|
|
27257
|
-
const [clickHovered, setClickHovered] =
|
|
27258
|
-
const [clickPinned, setClickPinned] =
|
|
27259
|
-
const [selectionHovered, setSelectionHovered] =
|
|
27260
|
-
const [selectionPinned, setSelectionPinned] =
|
|
27261
|
-
const [shapeHovered, setShapeHovered] =
|
|
27262
|
-
const [shapePinned, setShapePinned] =
|
|
27263
|
-
const modeRef =
|
|
27264
|
-
const clickRef =
|
|
27265
|
-
const selectionRef =
|
|
27266
|
-
const shapeRef =
|
|
27300
|
+
const [modeHovered, setModeHovered] = useState13(false);
|
|
27301
|
+
const [modePinned, setModePinned] = useState13(false);
|
|
27302
|
+
const [clickHovered, setClickHovered] = useState13(false);
|
|
27303
|
+
const [clickPinned, setClickPinned] = useState13(false);
|
|
27304
|
+
const [selectionHovered, setSelectionHovered] = useState13(false);
|
|
27305
|
+
const [selectionPinned, setSelectionPinned] = useState13(false);
|
|
27306
|
+
const [shapeHovered, setShapeHovered] = useState13(false);
|
|
27307
|
+
const [shapePinned, setShapePinned] = useState13(false);
|
|
27308
|
+
const modeRef = useRef10(null);
|
|
27309
|
+
const clickRef = useRef10(null);
|
|
27310
|
+
const selectionRef = useRef10(null);
|
|
27311
|
+
const shapeRef = useRef10(null);
|
|
27267
27312
|
const modeExpanded = modeHovered || modePinned;
|
|
27268
27313
|
const clickExpanded = clickHovered || clickPinned;
|
|
27269
27314
|
const selectionExpanded = selectionHovered || selectionPinned;
|
|
27270
27315
|
const shapeExpanded = shapeHovered || shapePinned;
|
|
27271
|
-
|
|
27316
|
+
useEffect14(() => {
|
|
27272
27317
|
const handleClickOutside = (event) => {
|
|
27273
27318
|
if (modePinned && modeRef.current && !modeRef.current.contains(event.target)) {
|
|
27274
27319
|
setModePinned(false);
|
|
@@ -27286,7 +27331,7 @@ function AnnotateToolbar({
|
|
|
27286
27331
|
document.addEventListener("mousedown", handleClickOutside);
|
|
27287
27332
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
27288
27333
|
}, [modePinned, clickPinned, selectionPinned, shapePinned]);
|
|
27289
|
-
|
|
27334
|
+
useEffect14(() => {
|
|
27290
27335
|
const handleEscape = (event) => {
|
|
27291
27336
|
if (event.key === "Escape") {
|
|
27292
27337
|
setModePinned(false);
|
|
@@ -27468,7 +27513,7 @@ function AnnotateToolbar({
|
|
|
27468
27513
|
}
|
|
27469
27514
|
|
|
27470
27515
|
// src/components/annotation-popups/JsonLdView.tsx
|
|
27471
|
-
import { useEffect as
|
|
27516
|
+
import { useEffect as useEffect15, useRef as useRef11 } from "react";
|
|
27472
27517
|
|
|
27473
27518
|
// ../../node_modules/@lezer/json/dist/index.js
|
|
27474
27519
|
var jsonHighlighting = styleTags({
|
|
@@ -27672,14 +27717,14 @@ var oneDark = [oneDarkTheme, /* @__PURE__ */ syntaxHighlighting(oneDarkHighlight
|
|
|
27672
27717
|
// src/components/annotation-popups/JsonLdView.tsx
|
|
27673
27718
|
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
27674
27719
|
function JsonLdView({ annotation, onBack }) {
|
|
27675
|
-
const editorRef =
|
|
27676
|
-
const viewRef =
|
|
27720
|
+
const editorRef = useRef11(null);
|
|
27721
|
+
const viewRef = useRef11(null);
|
|
27677
27722
|
const { showLineNumbers } = useLineNumbers();
|
|
27678
|
-
const onBackRef =
|
|
27679
|
-
|
|
27723
|
+
const onBackRef = useRef11(onBack);
|
|
27724
|
+
useEffect15(() => {
|
|
27680
27725
|
onBackRef.current = onBack;
|
|
27681
27726
|
});
|
|
27682
|
-
|
|
27727
|
+
useEffect15(() => {
|
|
27683
27728
|
const handleKeyDown = (e6) => {
|
|
27684
27729
|
if (e6.key === "Escape") {
|
|
27685
27730
|
onBackRef.current();
|
|
@@ -27688,7 +27733,7 @@ function JsonLdView({ annotation, onBack }) {
|
|
|
27688
27733
|
window.addEventListener("keydown", handleKeyDown);
|
|
27689
27734
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
27690
27735
|
}, []);
|
|
27691
|
-
|
|
27736
|
+
useEffect15(() => {
|
|
27692
27737
|
if (!editorRef.current) return;
|
|
27693
27738
|
const isDarkMode = document.documentElement.classList.contains("dark");
|
|
27694
27739
|
const jsonContent = JSON.stringify(annotation, null, 2);
|
|
@@ -29406,7 +29451,7 @@ function AnnotationOverlay({
|
|
|
29406
29451
|
const scaleX = displayWidth / imageWidth;
|
|
29407
29452
|
const scaleY = displayHeight / imageHeight;
|
|
29408
29453
|
const { handleMouseEnter, handleMouseLeave } = useMemo2(
|
|
29409
|
-
() => createHoverHandlers((
|
|
29454
|
+
() => createHoverHandlers((annotationId2) => eventBus?.get("beckon:hover").next({ annotationId: annotationId2 }), hoverDelayMs),
|
|
29410
29455
|
[eventBus, hoverDelayMs]
|
|
29411
29456
|
);
|
|
29412
29457
|
return /* @__PURE__ */ jsx18(
|
|
@@ -29574,7 +29619,7 @@ function AnnotationOverlay({
|
|
|
29574
29619
|
}
|
|
29575
29620
|
|
|
29576
29621
|
// src/components/image-annotation/SvgDrawingCanvas.tsx
|
|
29577
|
-
import { useRef as
|
|
29622
|
+
import { useRef as useRef12, useState as useState15, useEffect as useEffect17, useCallback as useCallback13, useMemo as useMemo3 } from "react";
|
|
29578
29623
|
import { createRectangleSvg, createCircleSvg, createPolygonSvg, scaleSvgToNative, parseSvgSelector as parseSvgSelector2 } from "@semiont/api-client";
|
|
29579
29624
|
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
29580
29625
|
function getMotivationColor(motivation) {
|
|
@@ -29612,14 +29657,14 @@ function SvgDrawingCanvas({
|
|
|
29612
29657
|
const resourceId = resourceUri2.split("/").pop();
|
|
29613
29658
|
return `/api/resources/${resourceId}`;
|
|
29614
29659
|
}, [resourceUri2]);
|
|
29615
|
-
const containerRef =
|
|
29616
|
-
const imageRef =
|
|
29617
|
-
const [imageDimensions, setImageDimensions] =
|
|
29618
|
-
const [displayDimensions, setDisplayDimensions] =
|
|
29619
|
-
const [isDrawing, setIsDrawing] =
|
|
29620
|
-
const [startPoint, setStartPoint] =
|
|
29621
|
-
const [currentPoint, setCurrentPoint] =
|
|
29622
|
-
|
|
29660
|
+
const containerRef = useRef12(null);
|
|
29661
|
+
const imageRef = useRef12(null);
|
|
29662
|
+
const [imageDimensions, setImageDimensions] = useState15(null);
|
|
29663
|
+
const [displayDimensions, setDisplayDimensions] = useState15(null);
|
|
29664
|
+
const [isDrawing, setIsDrawing] = useState15(false);
|
|
29665
|
+
const [startPoint, setStartPoint] = useState15(null);
|
|
29666
|
+
const [currentPoint, setCurrentPoint] = useState15(null);
|
|
29667
|
+
useEffect17(() => {
|
|
29623
29668
|
const img = new Image();
|
|
29624
29669
|
img.onload = () => {
|
|
29625
29670
|
setImageDimensions({
|
|
@@ -29629,7 +29674,7 @@ function SvgDrawingCanvas({
|
|
|
29629
29674
|
};
|
|
29630
29675
|
img.src = imageUrl;
|
|
29631
29676
|
}, [imageUrl]);
|
|
29632
|
-
|
|
29677
|
+
useEffect17(() => {
|
|
29633
29678
|
const updateDisplayDimensions = () => {
|
|
29634
29679
|
if (imageRef.current) {
|
|
29635
29680
|
setDisplayDimensions({
|
|
@@ -29657,7 +29702,7 @@ function SvgDrawingCanvas({
|
|
|
29657
29702
|
}
|
|
29658
29703
|
};
|
|
29659
29704
|
}, []);
|
|
29660
|
-
const getRelativeCoordinates =
|
|
29705
|
+
const getRelativeCoordinates = useCallback13((e6) => {
|
|
29661
29706
|
if (!imageRef.current) return null;
|
|
29662
29707
|
const rect = imageRef.current.getBoundingClientRect();
|
|
29663
29708
|
return {
|
|
@@ -29665,7 +29710,7 @@ function SvgDrawingCanvas({
|
|
|
29665
29710
|
y: e6.clientY - rect.top
|
|
29666
29711
|
};
|
|
29667
29712
|
}, []);
|
|
29668
|
-
const handleMouseDown =
|
|
29713
|
+
const handleMouseDown = useCallback13((e6) => {
|
|
29669
29714
|
if (!drawingMode) return;
|
|
29670
29715
|
const point4 = getRelativeCoordinates(e6);
|
|
29671
29716
|
if (point4) {
|
|
@@ -29674,14 +29719,14 @@ function SvgDrawingCanvas({
|
|
|
29674
29719
|
setCurrentPoint(point4);
|
|
29675
29720
|
}
|
|
29676
29721
|
}, [drawingMode, getRelativeCoordinates]);
|
|
29677
|
-
const handleMouseMove =
|
|
29722
|
+
const handleMouseMove = useCallback13((e6) => {
|
|
29678
29723
|
if (!isDrawing || !startPoint) return;
|
|
29679
29724
|
const point4 = getRelativeCoordinates(e6);
|
|
29680
29725
|
if (point4) {
|
|
29681
29726
|
setCurrentPoint(point4);
|
|
29682
29727
|
}
|
|
29683
29728
|
}, [isDrawing, startPoint, getRelativeCoordinates]);
|
|
29684
|
-
const handleMouseUp =
|
|
29729
|
+
const handleMouseUp = useCallback13((e6) => {
|
|
29685
29730
|
if (!isDrawing || !startPoint || !drawingMode) return;
|
|
29686
29731
|
const endPoint = getRelativeCoordinates(e6);
|
|
29687
29732
|
if (!endPoint || !displayDimensions || !imageDimensions) return;
|
|
@@ -29777,7 +29822,7 @@ function SvgDrawingCanvas({
|
|
|
29777
29822
|
setStartPoint(null);
|
|
29778
29823
|
setCurrentPoint(null);
|
|
29779
29824
|
}, [isDrawing, startPoint, drawingMode, displayDimensions, imageDimensions, getRelativeCoordinates, selectedMotivation, existingAnnotations]);
|
|
29780
|
-
const handleMouseLeave =
|
|
29825
|
+
const handleMouseLeave = useCallback13(() => {
|
|
29781
29826
|
if (isDrawing) {
|
|
29782
29827
|
setIsDrawing(false);
|
|
29783
29828
|
setStartPoint(null);
|
|
@@ -30066,7 +30111,7 @@ function KeyboardShortcutsHelpModal({ isOpen, onClose }) {
|
|
|
30066
30111
|
}
|
|
30067
30112
|
|
|
30068
30113
|
// src/components/modals/ProposeEntitiesModal.tsx
|
|
30069
|
-
import { useEffect as
|
|
30114
|
+
import { useEffect as useEffect18, useState as useState16, Fragment as Fragment5 } from "react";
|
|
30070
30115
|
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
30071
30116
|
var STORAGE_KEY = "userPreferredEntityTypes";
|
|
30072
30117
|
function ProposeEntitiesModal({
|
|
@@ -30074,11 +30119,11 @@ function ProposeEntitiesModal({
|
|
|
30074
30119
|
onConfirm,
|
|
30075
30120
|
onCancel
|
|
30076
30121
|
}) {
|
|
30077
|
-
const [selectedTypes, setSelectedTypes] =
|
|
30122
|
+
const [selectedTypes, setSelectedTypes] = useState16([]);
|
|
30078
30123
|
const entityTypesAPI = useEntityTypes();
|
|
30079
30124
|
const { data: entityTypesData } = entityTypesAPI.list.useQuery();
|
|
30080
30125
|
const allEntityTypes = entityTypesData?.entityTypes || [];
|
|
30081
|
-
|
|
30126
|
+
useEffect18(() => {
|
|
30082
30127
|
if (isOpen) {
|
|
30083
30128
|
try {
|
|
30084
30129
|
const saved = sessionStorage.getItem(STORAGE_KEY);
|
|
@@ -30188,7 +30233,7 @@ function ProposeEntitiesModal({
|
|
|
30188
30233
|
}
|
|
30189
30234
|
|
|
30190
30235
|
// src/components/resource/AnnotateView.tsx
|
|
30191
|
-
import { useRef as
|
|
30236
|
+
import { useRef as useRef13, useEffect as useEffect19, useCallback as useCallback14, lazy, Suspense } from "react";
|
|
30192
30237
|
import { resourceUri as toResourceUri } from "@semiont/core";
|
|
30193
30238
|
import { getMimeCategory, isPdfMimeType as isPdfMimeType2 } from "@semiont/api-client";
|
|
30194
30239
|
|
|
@@ -30299,26 +30344,26 @@ function AnnotateView({
|
|
|
30299
30344
|
annotateMode
|
|
30300
30345
|
}) {
|
|
30301
30346
|
const { newAnnotationIds } = useResourceAnnotations();
|
|
30302
|
-
const containerRef =
|
|
30347
|
+
const containerRef = useRef13(null);
|
|
30303
30348
|
const eventBus = useEventBus();
|
|
30304
30349
|
const category = getMimeCategory(mimeType);
|
|
30305
30350
|
const { highlights, references, assessments, comments, tags: tags3 } = annotations;
|
|
30306
30351
|
const allAnnotations = [...highlights, ...references, ...assessments, ...comments, ...tags3];
|
|
30307
30352
|
const segments = segmentTextWithAnnotations(content4, allAnnotations);
|
|
30308
30353
|
const { selectedMotivation, selectedClick, selectedShape, hoveredAnnotationId, scrollToAnnotationId } = uiState;
|
|
30309
|
-
const onUIStateChangeRef =
|
|
30354
|
+
const onUIStateChangeRef = useRef13(onUIStateChange);
|
|
30310
30355
|
onUIStateChangeRef.current = onUIStateChange;
|
|
30311
|
-
const handleToolbarSelectionChanged =
|
|
30356
|
+
const handleToolbarSelectionChanged = useCallback14(({ motivation }) => {
|
|
30312
30357
|
onUIStateChangeRef.current?.({ selectedMotivation: motivation });
|
|
30313
30358
|
}, []);
|
|
30314
|
-
const handleToolbarClickChanged =
|
|
30359
|
+
const handleToolbarClickChanged = useCallback14(({ action }) => {
|
|
30315
30360
|
onUIStateChangeRef.current?.({ selectedClick: action });
|
|
30316
30361
|
}, []);
|
|
30317
|
-
const handleToolbarShapeChanged =
|
|
30362
|
+
const handleToolbarShapeChanged = useCallback14(({ shape }) => {
|
|
30318
30363
|
onUIStateChangeRef.current?.({ selectedShape: shape });
|
|
30319
30364
|
}, []);
|
|
30320
|
-
const handleAnnotationHover =
|
|
30321
|
-
onUIStateChangeRef.current?.({ hoveredAnnotationId:
|
|
30365
|
+
const handleAnnotationHover = useCallback14(({ annotationId: annotationId2 }) => {
|
|
30366
|
+
onUIStateChangeRef.current?.({ hoveredAnnotationId: annotationId2 });
|
|
30322
30367
|
}, []);
|
|
30323
30368
|
useEventSubscriptions({
|
|
30324
30369
|
"mark:selection-changed": handleToolbarSelectionChanged,
|
|
@@ -30326,7 +30371,7 @@ function AnnotateView({
|
|
|
30326
30371
|
"mark:shape-changed": handleToolbarShapeChanged,
|
|
30327
30372
|
"beckon:hover": handleAnnotationHover
|
|
30328
30373
|
});
|
|
30329
|
-
|
|
30374
|
+
useEffect19(() => {
|
|
30330
30375
|
const container = containerRef.current;
|
|
30331
30376
|
if (!container) return;
|
|
30332
30377
|
let clickedOnAnnotation = false;
|
|
@@ -30491,11 +30536,11 @@ function AnnotateView({
|
|
|
30491
30536
|
}
|
|
30492
30537
|
|
|
30493
30538
|
// src/components/resource/AnnotationHistory.tsx
|
|
30494
|
-
import { useEffect as
|
|
30539
|
+
import { useEffect as useEffect21, useRef as useRef15 } from "react";
|
|
30495
30540
|
import { getAnnotationUriFromEvent as getAnnotationUriFromEvent2 } from "@semiont/core";
|
|
30496
30541
|
|
|
30497
30542
|
// src/components/resource/HistoryEvent.tsx
|
|
30498
|
-
import { useRef as
|
|
30543
|
+
import { useRef as useRef14, useCallback as useCallback15, useEffect as useEffect20 } from "react";
|
|
30499
30544
|
import { getAnnotationUriFromEvent } from "@semiont/core";
|
|
30500
30545
|
|
|
30501
30546
|
// src/components/resource/event-formatting.ts
|
|
@@ -30735,12 +30780,12 @@ function HistoryEvent({
|
|
|
30735
30780
|
const annotationUri2 = getAnnotationUriFromEvent(event);
|
|
30736
30781
|
const creationDetails = getResourceCreationDetails(event);
|
|
30737
30782
|
const entityTypes = getEventEntityTypes(event);
|
|
30738
|
-
const hoverTimeoutRef =
|
|
30739
|
-
const onEventHoverRef =
|
|
30740
|
-
|
|
30783
|
+
const hoverTimeoutRef = useRef14(null);
|
|
30784
|
+
const onEventHoverRef = useRef14(onEventHover);
|
|
30785
|
+
useEffect20(() => {
|
|
30741
30786
|
onEventHoverRef.current = onEventHover;
|
|
30742
30787
|
});
|
|
30743
|
-
const handleEmojiMouseEnter =
|
|
30788
|
+
const handleEmojiMouseEnter = useCallback15(() => {
|
|
30744
30789
|
if (!annotationUri2 || !onEventHoverRef.current) return;
|
|
30745
30790
|
if (hoverTimeoutRef.current) {
|
|
30746
30791
|
clearTimeout(hoverTimeoutRef.current);
|
|
@@ -30749,7 +30794,7 @@ function HistoryEvent({
|
|
|
30749
30794
|
onEventHoverRef.current?.(annotationUri2);
|
|
30750
30795
|
}, 300);
|
|
30751
30796
|
}, [annotationUri2]);
|
|
30752
|
-
const handleEmojiMouseLeave =
|
|
30797
|
+
const handleEmojiMouseLeave = useCallback15(() => {
|
|
30753
30798
|
if (hoverTimeoutRef.current) {
|
|
30754
30799
|
clearTimeout(hoverTimeoutRef.current);
|
|
30755
30800
|
hoverTimeoutRef.current = null;
|
|
@@ -30841,15 +30886,15 @@ function AnnotationHistory({ rUri, hoveredAnnotationId, onEventHover, onEventCli
|
|
|
30841
30886
|
const { data: eventsData, isLoading: loading, isError: error } = resources.events.useQuery(rUri);
|
|
30842
30887
|
const { data: annotationsData } = resources.annotations.useQuery(rUri);
|
|
30843
30888
|
const annotations = annotationsData?.annotations || [];
|
|
30844
|
-
const eventRefs =
|
|
30845
|
-
const containerRef =
|
|
30889
|
+
const eventRefs = useRef15(/* @__PURE__ */ new Map());
|
|
30890
|
+
const containerRef = useRef15(null);
|
|
30846
30891
|
const events2 = !eventsData?.events ? [] : [...eventsData.events].filter((e6) => {
|
|
30847
30892
|
const eventType = e6.event.type;
|
|
30848
30893
|
return eventType !== "job.started" && eventType !== "job.progress" && eventType !== "job.completed";
|
|
30849
30894
|
}).sort(
|
|
30850
30895
|
(a15, b8) => a15.metadata.sequenceNumber - b8.metadata.sequenceNumber
|
|
30851
30896
|
);
|
|
30852
|
-
|
|
30897
|
+
useEffect21(() => {
|
|
30853
30898
|
if (containerRef.current && events2.length > 0) {
|
|
30854
30899
|
requestAnimationFrame(() => {
|
|
30855
30900
|
if (containerRef.current) {
|
|
@@ -30858,7 +30903,7 @@ function AnnotationHistory({ rUri, hoveredAnnotationId, onEventHover, onEventCli
|
|
|
30858
30903
|
});
|
|
30859
30904
|
}
|
|
30860
30905
|
}, [events2.length]);
|
|
30861
|
-
|
|
30906
|
+
useEffect21(() => {
|
|
30862
30907
|
if (!hoveredAnnotationId) return;
|
|
30863
30908
|
const eventElement = eventRefs.current.get(hoveredAnnotationId);
|
|
30864
30909
|
if (eventElement && containerRef.current) {
|
|
@@ -30899,11 +30944,11 @@ function AnnotationHistory({ rUri, hoveredAnnotationId, onEventHover, onEventCli
|
|
|
30899
30944
|
t: t12,
|
|
30900
30945
|
Link,
|
|
30901
30946
|
routes,
|
|
30902
|
-
onEventRef: (
|
|
30903
|
-
if (el &&
|
|
30904
|
-
eventRefs.current.set(
|
|
30905
|
-
} else if (!el &&
|
|
30906
|
-
eventRefs.current.delete(
|
|
30947
|
+
onEventRef: (annotationId2, el) => {
|
|
30948
|
+
if (el && annotationId2) {
|
|
30949
|
+
eventRefs.current.set(annotationId2, el);
|
|
30950
|
+
} else if (!el && annotationId2) {
|
|
30951
|
+
eventRefs.current.delete(annotationId2);
|
|
30907
30952
|
}
|
|
30908
30953
|
},
|
|
30909
30954
|
...onEventClick && { onEventClick },
|
|
@@ -30916,7 +30961,7 @@ function AnnotationHistory({ rUri, hoveredAnnotationId, onEventHover, onEventCli
|
|
|
30916
30961
|
}
|
|
30917
30962
|
|
|
30918
30963
|
// src/components/resource/BrowseView.tsx
|
|
30919
|
-
import { useEffect as
|
|
30964
|
+
import { useEffect as useEffect23, useRef as useRef16, useCallback as useCallback16, useMemo as useMemo4, memo, lazy as lazy2, Suspense as Suspense2 } from "react";
|
|
30920
30965
|
|
|
30921
30966
|
// ../../node_modules/devlop/lib/default.js
|
|
30922
30967
|
function ok() {
|
|
@@ -32791,7 +32836,7 @@ var urlAttributes = {
|
|
|
32791
32836
|
|
|
32792
32837
|
// ../../node_modules/react-markdown/lib/index.js
|
|
32793
32838
|
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
32794
|
-
import { useEffect as
|
|
32839
|
+
import { useEffect as useEffect22, useState as useState17 } from "react";
|
|
32795
32840
|
|
|
32796
32841
|
// ../../node_modules/mdast-util-to-string/lib/index.js
|
|
32797
32842
|
var emptyOptions2 = {};
|
|
@@ -45476,7 +45521,7 @@ var BrowseView = memo(function BrowseView2({
|
|
|
45476
45521
|
}) {
|
|
45477
45522
|
const { newAnnotationIds } = useResourceAnnotations();
|
|
45478
45523
|
const eventBus = useEventBus();
|
|
45479
|
-
const containerRef =
|
|
45524
|
+
const containerRef = useRef16(null);
|
|
45480
45525
|
const category = getMimeCategory2(mimeType);
|
|
45481
45526
|
const { highlights, references, assessments, comments, tags: tags3 } = annotations;
|
|
45482
45527
|
const allAnnotations = useMemo4(
|
|
@@ -45487,12 +45532,12 @@ var BrowseView = memo(function BrowseView2({
|
|
|
45487
45532
|
() => toOverlayAnnotations(allAnnotations),
|
|
45488
45533
|
[allAnnotations]
|
|
45489
45534
|
);
|
|
45490
|
-
const offsetMapRef =
|
|
45491
|
-
|
|
45535
|
+
const offsetMapRef = useRef16(null);
|
|
45536
|
+
useEffect23(() => {
|
|
45492
45537
|
if (!containerRef.current) return;
|
|
45493
45538
|
offsetMapRef.current = buildSourceToRenderedMap(content4, containerRef.current);
|
|
45494
45539
|
}, [content4]);
|
|
45495
|
-
|
|
45540
|
+
useEffect23(() => {
|
|
45496
45541
|
if (!containerRef.current || !offsetMapRef.current || overlayAnnotations.length === 0) return;
|
|
45497
45542
|
const container = containerRef.current;
|
|
45498
45543
|
const textNodeIndex = buildTextNodeIndex(container);
|
|
@@ -45500,31 +45545,31 @@ var BrowseView = memo(function BrowseView2({
|
|
|
45500
45545
|
applyHighlights(ranges);
|
|
45501
45546
|
return () => clearHighlights(container);
|
|
45502
45547
|
}, [overlayAnnotations]);
|
|
45503
|
-
|
|
45548
|
+
useEffect23(() => {
|
|
45504
45549
|
if (!containerRef.current) return;
|
|
45505
45550
|
const container = containerRef.current;
|
|
45506
45551
|
const handleClick = (e6) => {
|
|
45507
45552
|
const target = e6.target;
|
|
45508
45553
|
const annotationElement = target.closest("[data-annotation-id]");
|
|
45509
45554
|
if (!annotationElement) return;
|
|
45510
|
-
const
|
|
45555
|
+
const annotationId2 = annotationElement.getAttribute("data-annotation-id");
|
|
45511
45556
|
const annotationType = annotationElement.getAttribute("data-annotation-type");
|
|
45512
|
-
if (
|
|
45513
|
-
const annotation = allAnnotations.find((a15) => a15.id ===
|
|
45557
|
+
if (annotationId2 && annotationType === "reference") {
|
|
45558
|
+
const annotation = allAnnotations.find((a15) => a15.id === annotationId2);
|
|
45514
45559
|
if (annotation) {
|
|
45515
|
-
eventBus.get("browse:click").next({ annotationId, motivation: annotation.motivation });
|
|
45560
|
+
eventBus.get("browse:click").next({ annotationId: annotationId2, motivation: annotation.motivation });
|
|
45516
45561
|
}
|
|
45517
45562
|
}
|
|
45518
45563
|
};
|
|
45519
45564
|
const { handleMouseEnter, handleMouseLeave, cleanup: cleanupHover } = createHoverHandlers(
|
|
45520
|
-
(
|
|
45565
|
+
(annotationId2) => eventBus.get("beckon:hover").next({ annotationId: annotationId2 }),
|
|
45521
45566
|
hoverDelayMs
|
|
45522
45567
|
);
|
|
45523
45568
|
const handleMouseOver = (e6) => {
|
|
45524
45569
|
const target = e6.target;
|
|
45525
45570
|
const annotationElement = target.closest("[data-annotation-id]");
|
|
45526
|
-
const
|
|
45527
|
-
if (
|
|
45571
|
+
const annotationId2 = annotationElement?.getAttribute("data-annotation-id");
|
|
45572
|
+
if (annotationId2) handleMouseEnter(annotationId2);
|
|
45528
45573
|
};
|
|
45529
45574
|
const handleMouseOut = (e6) => {
|
|
45530
45575
|
const target = e6.target;
|
|
@@ -45534,8 +45579,8 @@ var BrowseView = memo(function BrowseView2({
|
|
|
45534
45579
|
if (newAnnotationIds) {
|
|
45535
45580
|
const annotationSpans = container.querySelectorAll("[data-annotation-id]");
|
|
45536
45581
|
annotationSpans.forEach((span) => {
|
|
45537
|
-
const
|
|
45538
|
-
if (
|
|
45582
|
+
const annotationId2 = span.getAttribute("data-annotation-id");
|
|
45583
|
+
if (annotationId2 && newAnnotationIds.has(annotationId2)) {
|
|
45539
45584
|
span.classList.add("annotation-sparkle");
|
|
45540
45585
|
}
|
|
45541
45586
|
});
|
|
@@ -45550,15 +45595,15 @@ var BrowseView = memo(function BrowseView2({
|
|
|
45550
45595
|
cleanupHover();
|
|
45551
45596
|
};
|
|
45552
45597
|
}, [content4, allAnnotations, newAnnotationIds, hoverDelayMs]);
|
|
45553
|
-
const scrollToAnnotation =
|
|
45598
|
+
const scrollToAnnotation = useCallback16((annotationId2, removePulse = false) => {
|
|
45554
45599
|
if (!containerRef.current) return;
|
|
45555
|
-
scrollAnnotationIntoView(
|
|
45600
|
+
scrollAnnotationIntoView(annotationId2, containerRef.current, { pulse: removePulse });
|
|
45556
45601
|
}, []);
|
|
45557
|
-
const handleAnnotationHover =
|
|
45558
|
-
scrollToAnnotation(
|
|
45602
|
+
const handleAnnotationHover = useCallback16(({ annotationId: annotationId2 }) => {
|
|
45603
|
+
scrollToAnnotation(annotationId2);
|
|
45559
45604
|
}, [scrollToAnnotation]);
|
|
45560
|
-
const handleAnnotationFocus =
|
|
45561
|
-
scrollToAnnotation(
|
|
45605
|
+
const handleAnnotationFocus = useCallback16(({ annotationId: annotationId2 }) => {
|
|
45606
|
+
scrollToAnnotation(annotationId2, true);
|
|
45562
45607
|
}, [scrollToAnnotation]);
|
|
45563
45608
|
useEventSubscriptions({
|
|
45564
45609
|
"beckon:hover": handleAnnotationHover,
|
|
@@ -45646,8 +45691,8 @@ var BrowseView = memo(function BrowseView2({
|
|
|
45646
45691
|
});
|
|
45647
45692
|
|
|
45648
45693
|
// src/components/resource/ResourceViewer.tsx
|
|
45649
|
-
import { useState as
|
|
45650
|
-
import { resourceUri } from "@semiont/core";
|
|
45694
|
+
import { useState as useState18, useEffect as useEffect24, useCallback as useCallback17, useRef as useRef17, useMemo as useMemo5 } from "react";
|
|
45695
|
+
import { resourceUri, annotationId as toAnnotationId } from "@semiont/core";
|
|
45651
45696
|
import { getExactText as getExactText3, getTargetSelector as getTargetSelector4, isHighlight as isHighlight4, isAssessment as isAssessment3, isReference as isReference5, isComment as isComment4, isTag as isTag5, getBodySource as getBodySource4 } from "@semiont/api-client";
|
|
45652
45697
|
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
45653
45698
|
function ResourceViewer({
|
|
@@ -45659,7 +45704,7 @@ function ResourceViewer({
|
|
|
45659
45704
|
hoveredAnnotationId: hoveredAnnotationIdProp
|
|
45660
45705
|
}) {
|
|
45661
45706
|
const t12 = useTranslations("ResourceViewer");
|
|
45662
|
-
const documentViewerRef =
|
|
45707
|
+
const documentViewerRef = useRef17(null);
|
|
45663
45708
|
const eventBus = useEventBus();
|
|
45664
45709
|
const navigate = useObservableExternalNavigation();
|
|
45665
45710
|
const { highlights, references, assessments, comments, tags: tags3 } = annotations;
|
|
@@ -45675,38 +45720,38 @@ function ResourceViewer({
|
|
|
45675
45720
|
return "text/plain";
|
|
45676
45721
|
};
|
|
45677
45722
|
const mimeType = getMimeType();
|
|
45678
|
-
const [annotateMode, setAnnotateMode] =
|
|
45723
|
+
const [annotateMode, setAnnotateMode] = useState18(() => {
|
|
45679
45724
|
if (typeof window !== "undefined") {
|
|
45680
45725
|
return localStorage.getItem("annotateMode") === "true";
|
|
45681
45726
|
}
|
|
45682
45727
|
return false;
|
|
45683
45728
|
});
|
|
45684
|
-
|
|
45729
|
+
useEffect24(() => {
|
|
45685
45730
|
if (typeof window !== "undefined") {
|
|
45686
45731
|
localStorage.setItem("annotateMode", annotateMode.toString());
|
|
45687
45732
|
}
|
|
45688
45733
|
}, [annotateMode]);
|
|
45689
|
-
const handleViewModeToggle =
|
|
45734
|
+
const handleViewModeToggle = useCallback17(() => {
|
|
45690
45735
|
setAnnotateMode((prev) => !prev);
|
|
45691
45736
|
}, []);
|
|
45692
45737
|
const activeView = annotateMode ? "annotate" : "browse";
|
|
45693
45738
|
const cacheManager = useCacheManager();
|
|
45694
|
-
const handleAnnotateAdded =
|
|
45739
|
+
const handleAnnotateAdded = useCallback17(() => {
|
|
45695
45740
|
if (cacheManager) {
|
|
45696
45741
|
cacheManager.invalidateAnnotations(rUri);
|
|
45697
45742
|
}
|
|
45698
45743
|
}, [cacheManager, rUri]);
|
|
45699
|
-
const handleAnnotateRemoved =
|
|
45744
|
+
const handleAnnotateRemoved = useCallback17(() => {
|
|
45700
45745
|
if (cacheManager) {
|
|
45701
45746
|
cacheManager.invalidateAnnotations(rUri);
|
|
45702
45747
|
}
|
|
45703
45748
|
}, [cacheManager, rUri]);
|
|
45704
|
-
const handleAnnotateBodyUpdated =
|
|
45749
|
+
const handleAnnotateBodyUpdated = useCallback17(() => {
|
|
45705
45750
|
if (cacheManager) {
|
|
45706
45751
|
cacheManager.invalidateAnnotations(rUri);
|
|
45707
45752
|
}
|
|
45708
45753
|
}, [cacheManager, rUri]);
|
|
45709
|
-
const [selectedMotivation, setSelectedMotivation] =
|
|
45754
|
+
const [selectedMotivation, setSelectedMotivation] = useState18(() => {
|
|
45710
45755
|
if (typeof window !== "undefined") {
|
|
45711
45756
|
const stored = localStorage.getItem("semiont-toolbar-selection");
|
|
45712
45757
|
if (stored === "null") return null;
|
|
@@ -45716,7 +45761,7 @@ function ResourceViewer({
|
|
|
45716
45761
|
}
|
|
45717
45762
|
return "linking";
|
|
45718
45763
|
});
|
|
45719
|
-
const [selectedClick, setSelectedClick] =
|
|
45764
|
+
const [selectedClick, setSelectedClick] = useState18(() => {
|
|
45720
45765
|
if (typeof window !== "undefined") {
|
|
45721
45766
|
const stored = localStorage.getItem("semiont-toolbar-click");
|
|
45722
45767
|
if (stored && ["detail", "follow", "jsonld", "deleting"].includes(stored)) {
|
|
@@ -45726,46 +45771,46 @@ function ResourceViewer({
|
|
|
45726
45771
|
return "detail";
|
|
45727
45772
|
});
|
|
45728
45773
|
const selectorType = getSelectorType(mimeType);
|
|
45729
|
-
const [selectedShape, setSelectedShape] =
|
|
45774
|
+
const [selectedShape, setSelectedShape] = useState18(() => {
|
|
45730
45775
|
return getSelectedShapeForSelectorType(selectorType);
|
|
45731
45776
|
});
|
|
45732
|
-
const handleToolbarSelectionChanged =
|
|
45777
|
+
const handleToolbarSelectionChanged = useCallback17(({ motivation }) => {
|
|
45733
45778
|
setSelectedMotivation(motivation);
|
|
45734
45779
|
}, []);
|
|
45735
|
-
const handleToolbarClickChanged =
|
|
45780
|
+
const handleToolbarClickChanged = useCallback17(({ action }) => {
|
|
45736
45781
|
setSelectedClick(action);
|
|
45737
45782
|
}, []);
|
|
45738
|
-
const handleToolbarShapeChanged =
|
|
45783
|
+
const handleToolbarShapeChanged = useCallback17(({ shape }) => {
|
|
45739
45784
|
setSelectedShape(shape);
|
|
45740
45785
|
}, []);
|
|
45741
|
-
|
|
45786
|
+
useEffect24(() => {
|
|
45742
45787
|
if (selectedMotivation === null) {
|
|
45743
45788
|
localStorage.setItem("semiont-toolbar-selection", "null");
|
|
45744
45789
|
} else {
|
|
45745
45790
|
localStorage.setItem("semiont-toolbar-selection", selectedMotivation);
|
|
45746
45791
|
}
|
|
45747
45792
|
}, [selectedMotivation]);
|
|
45748
|
-
|
|
45793
|
+
useEffect24(() => {
|
|
45749
45794
|
localStorage.setItem("semiont-toolbar-click", selectedClick);
|
|
45750
45795
|
}, [selectedClick]);
|
|
45751
|
-
|
|
45796
|
+
useEffect24(() => {
|
|
45752
45797
|
saveSelectedShapeForSelectorType(selectorType, selectedShape);
|
|
45753
45798
|
}, [selectorType, selectedShape]);
|
|
45754
|
-
|
|
45799
|
+
useEffect24(() => {
|
|
45755
45800
|
const shapeForType = getSelectedShapeForSelectorType(selectorType);
|
|
45756
45801
|
if (shapeForType !== selectedShape) {
|
|
45757
45802
|
setSelectedShape(shapeForType);
|
|
45758
45803
|
}
|
|
45759
45804
|
}, [selectorType]);
|
|
45760
|
-
const [showJsonLdView, setShowJsonLdView] =
|
|
45761
|
-
const [jsonLdAnnotation, setJsonLdAnnotation] =
|
|
45762
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
45805
|
+
const [showJsonLdView, setShowJsonLdView] = useState18(false);
|
|
45806
|
+
const [jsonLdAnnotation, setJsonLdAnnotation] = useState18(null);
|
|
45807
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState18(null);
|
|
45763
45808
|
const hoveredAnnotationId = hoveredAnnotationIdProp ?? null;
|
|
45764
|
-
const [scrollToAnnotationId, setScrollToAnnotationId] =
|
|
45765
|
-
const [_focusedAnnotationId, setFocusedAnnotationId] =
|
|
45766
|
-
const focusAnnotation =
|
|
45767
|
-
setFocusedAnnotationId(
|
|
45768
|
-
setScrollToAnnotationId(
|
|
45809
|
+
const [scrollToAnnotationId, setScrollToAnnotationId] = useState18(null);
|
|
45810
|
+
const [_focusedAnnotationId, setFocusedAnnotationId] = useState18(null);
|
|
45811
|
+
const focusAnnotation = useCallback17((annotationId2) => {
|
|
45812
|
+
setFocusedAnnotationId(annotationId2);
|
|
45813
|
+
setScrollToAnnotationId(annotationId2);
|
|
45769
45814
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
45770
45815
|
}, []);
|
|
45771
45816
|
const getJsonLdModalPosition = () => {
|
|
@@ -45777,10 +45822,10 @@ function ResourceViewer({
|
|
|
45777
45822
|
y: Math.max(0, (window.innerHeight - popupHeight) / 2)
|
|
45778
45823
|
};
|
|
45779
45824
|
};
|
|
45780
|
-
const handleDeleteAnnotation =
|
|
45781
|
-
eventBus.get("mark:delete").next({ annotationId: id2 });
|
|
45825
|
+
const handleDeleteAnnotation = useCallback17((id2) => {
|
|
45826
|
+
eventBus.get("mark:delete").next({ annotationId: toAnnotationId(id2) });
|
|
45782
45827
|
}, []);
|
|
45783
|
-
const handleAnnotationClick2 =
|
|
45828
|
+
const handleAnnotationClick2 = useCallback17((annotation, event) => {
|
|
45784
45829
|
const metadata = Object.values(ANNOTATORS).find((a15) => a15.matchesAnnotation(annotation));
|
|
45785
45830
|
if (metadata?.hasSidePanel) {
|
|
45786
45831
|
if (selectedClick === "detail") {
|
|
@@ -45814,11 +45859,11 @@ function ResourceViewer({
|
|
|
45814
45859
|
return;
|
|
45815
45860
|
}
|
|
45816
45861
|
}, [annotateMode, selectedClick, focusAnnotation]);
|
|
45817
|
-
const handleAnnotationClickEvent =
|
|
45862
|
+
const handleAnnotationClickEvent = useCallback17(({ annotationId: annotationId2, motivation }) => {
|
|
45818
45863
|
const metadata = Object.values(ANNOTATORS).find((a15) => a15.matchesAnnotation({ motivation }));
|
|
45819
45864
|
if (!metadata?.hasSidePanel) {
|
|
45820
45865
|
const allAnnotations = [...highlights, ...references, ...assessments, ...comments, ...tags3];
|
|
45821
|
-
const annotation = allAnnotations.find((a15) => a15.id ===
|
|
45866
|
+
const annotation = allAnnotations.find((a15) => a15.id === annotationId2);
|
|
45822
45867
|
if (annotation) {
|
|
45823
45868
|
handleAnnotationClick2(annotation);
|
|
45824
45869
|
}
|
|
@@ -45826,13 +45871,13 @@ function ResourceViewer({
|
|
|
45826
45871
|
}
|
|
45827
45872
|
if (selectedClick !== "detail") {
|
|
45828
45873
|
const allAnnotations = [...highlights, ...references, ...assessments, ...comments, ...tags3];
|
|
45829
|
-
const annotation = allAnnotations.find((a15) => a15.id ===
|
|
45874
|
+
const annotation = allAnnotations.find((a15) => a15.id === annotationId2);
|
|
45830
45875
|
if (annotation) {
|
|
45831
45876
|
handleAnnotationClick2(annotation);
|
|
45832
45877
|
}
|
|
45833
45878
|
return;
|
|
45834
45879
|
}
|
|
45835
|
-
eventBus.get("browse:panel-open").next({ panel: "annotations", scrollToAnnotationId:
|
|
45880
|
+
eventBus.get("browse:panel-open").next({ panel: "annotations", scrollToAnnotationId: annotationId2, motivation });
|
|
45836
45881
|
}, [highlights, references, assessments, comments, tags3, handleAnnotationClick2, selectedClick]);
|
|
45837
45882
|
useEventSubscriptions({
|
|
45838
45883
|
// View mode
|
|
@@ -45859,7 +45904,7 @@ function ResourceViewer({
|
|
|
45859
45904
|
hoveredAnnotationId,
|
|
45860
45905
|
scrollToAnnotationId
|
|
45861
45906
|
};
|
|
45862
|
-
const getTargetDocumentName =
|
|
45907
|
+
const getTargetDocumentName = useCallback17((documentId) => {
|
|
45863
45908
|
const referencedResource = references.find((a15) => getBodySource4(a15.body) === documentId);
|
|
45864
45909
|
return referencedResource ? getExactText3(getTargetSelector4(referencedResource.target)) : void 0;
|
|
45865
45910
|
}, [references]);
|
|
@@ -46040,11 +46085,11 @@ var AssessmentEntry = forwardRef(
|
|
|
46040
46085
|
);
|
|
46041
46086
|
|
|
46042
46087
|
// src/components/resource/panels/AssessmentPanel.tsx
|
|
46043
|
-
import { useState as
|
|
46088
|
+
import { useState as useState20, useEffect as useEffect26, useRef as useRef18, useCallback as useCallback19, useMemo as useMemo6 } from "react";
|
|
46044
46089
|
import { getTextPositionSelector as getTextPositionSelector3, getTargetSelector as getTargetSelector5 } from "@semiont/api-client";
|
|
46045
46090
|
|
|
46046
46091
|
// src/components/resource/panels/AssistSection.tsx
|
|
46047
|
-
import { useState as
|
|
46092
|
+
import { useState as useState19, useEffect as useEffect25, useCallback as useCallback18 } from "react";
|
|
46048
46093
|
import { Fragment as Fragment7, jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
46049
46094
|
function AssistSection({
|
|
46050
46095
|
annotationType,
|
|
@@ -46054,21 +46099,21 @@ function AssistSection({
|
|
|
46054
46099
|
const panelName = annotationType === "highlight" ? "HighlightPanel" : annotationType === "assessment" ? "AssessmentPanel" : "CommentsPanel";
|
|
46055
46100
|
const t12 = useTranslations(panelName);
|
|
46056
46101
|
const eventBus = useEventBus();
|
|
46057
|
-
const [instructions, setInstructions] =
|
|
46058
|
-
const [tone, setTone] =
|
|
46102
|
+
const [instructions, setInstructions] = useState19("");
|
|
46103
|
+
const [tone, setTone] = useState19("");
|
|
46059
46104
|
const defaultDensity = annotationType === "comment" ? 5 : annotationType === "assessment" ? 4 : annotationType === "highlight" ? 5 : 5;
|
|
46060
|
-
const [density, setDensity] =
|
|
46061
|
-
const [useDensity, setUseDensity] =
|
|
46062
|
-
const [isExpanded, setIsExpanded] =
|
|
46105
|
+
const [density, setDensity] = useState19(defaultDensity);
|
|
46106
|
+
const [useDensity, setUseDensity] = useState19(true);
|
|
46107
|
+
const [isExpanded, setIsExpanded] = useState19(() => {
|
|
46063
46108
|
if (typeof window === "undefined") return true;
|
|
46064
46109
|
const stored = localStorage.getItem(`assist-section-expanded-${annotationType}`);
|
|
46065
46110
|
return stored ? stored === "true" : true;
|
|
46066
46111
|
});
|
|
46067
|
-
|
|
46112
|
+
useEffect25(() => {
|
|
46068
46113
|
if (typeof window === "undefined") return;
|
|
46069
46114
|
localStorage.setItem(`assist-section-expanded-${annotationType}`, String(isExpanded));
|
|
46070
46115
|
}, [isExpanded, annotationType]);
|
|
46071
|
-
const handleAssist =
|
|
46116
|
+
const handleAssist = useCallback18(() => {
|
|
46072
46117
|
const motivation = annotationType === "highlight" ? "highlighting" : annotationType === "assessment" ? "assessing" : "commenting";
|
|
46073
46118
|
eventBus.get("mark:assist-request").next({
|
|
46074
46119
|
motivation,
|
|
@@ -46081,7 +46126,7 @@ function AssistSection({
|
|
|
46081
46126
|
setInstructions("");
|
|
46082
46127
|
setTone("");
|
|
46083
46128
|
}, [annotationType, instructions, tone, useDensity, density]);
|
|
46084
|
-
const handleDismissProgress =
|
|
46129
|
+
const handleDismissProgress = useCallback18(() => {
|
|
46085
46130
|
eventBus.get("mark:progress-dismiss").next(void 0);
|
|
46086
46131
|
}, []);
|
|
46087
46132
|
return /* @__PURE__ */ jsxs20("div", { className: "semiont-panel__section", children: [
|
|
@@ -46286,10 +46331,10 @@ function AssessmentPanel({
|
|
|
46286
46331
|
}) {
|
|
46287
46332
|
const t12 = useTranslations("AssessmentPanel");
|
|
46288
46333
|
const eventBus = useEventBus();
|
|
46289
|
-
const [newAssessmentText, setNewAssessmentText] =
|
|
46290
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
46291
|
-
const containerRef =
|
|
46292
|
-
const entryRefs =
|
|
46334
|
+
const [newAssessmentText, setNewAssessmentText] = useState20("");
|
|
46335
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState20(null);
|
|
46336
|
+
const containerRef = useRef18(null);
|
|
46337
|
+
const entryRefs = useRef18(/* @__PURE__ */ new Map());
|
|
46293
46338
|
const sortedAnnotations = useMemo6(() => {
|
|
46294
46339
|
return [...annotations].sort((a15, b8) => {
|
|
46295
46340
|
const aSelector = getTextPositionSelector3(getTargetSelector5(a15.target));
|
|
@@ -46298,14 +46343,14 @@ function AssessmentPanel({
|
|
|
46298
46343
|
return aSelector.start - bSelector.start;
|
|
46299
46344
|
});
|
|
46300
46345
|
}, [annotations]);
|
|
46301
|
-
const setEntryRef =
|
|
46346
|
+
const setEntryRef = useCallback19((id2, element2) => {
|
|
46302
46347
|
if (element2) {
|
|
46303
46348
|
entryRefs.current.set(id2, element2);
|
|
46304
46349
|
} else {
|
|
46305
46350
|
entryRefs.current.delete(id2);
|
|
46306
46351
|
}
|
|
46307
46352
|
}, []);
|
|
46308
|
-
|
|
46353
|
+
useEffect26(() => {
|
|
46309
46354
|
if (!scrollToAnnotationId) return;
|
|
46310
46355
|
const element2 = entryRefs.current.get(scrollToAnnotationId);
|
|
46311
46356
|
if (element2 && containerRef.current) {
|
|
@@ -46320,7 +46365,7 @@ function AssessmentPanel({
|
|
|
46320
46365
|
if (onScrollCompleted) onScrollCompleted();
|
|
46321
46366
|
}
|
|
46322
46367
|
}, [scrollToAnnotationId]);
|
|
46323
|
-
|
|
46368
|
+
useEffect26(() => {
|
|
46324
46369
|
if (!hoveredAnnotationId) return;
|
|
46325
46370
|
const element2 = entryRefs.current.get(hoveredAnnotationId);
|
|
46326
46371
|
if (!element2 || !containerRef.current) return;
|
|
@@ -46339,7 +46384,7 @@ function AssessmentPanel({
|
|
|
46339
46384
|
const handleSaveNewAssessment = () => {
|
|
46340
46385
|
if (pendingAnnotation) {
|
|
46341
46386
|
const body = newAssessmentText.trim() ? [{ type: "TextualBody", value: newAssessmentText, purpose: "assessing" }] : [];
|
|
46342
|
-
eventBus.get("mark:
|
|
46387
|
+
eventBus.get("mark:submit").next({
|
|
46343
46388
|
motivation: "assessing",
|
|
46344
46389
|
selector: pendingAnnotation.selector,
|
|
46345
46390
|
body
|
|
@@ -46347,7 +46392,7 @@ function AssessmentPanel({
|
|
|
46347
46392
|
setNewAssessmentText("");
|
|
46348
46393
|
}
|
|
46349
46394
|
};
|
|
46350
|
-
|
|
46395
|
+
useEffect26(() => {
|
|
46351
46396
|
if (!pendingAnnotation) return;
|
|
46352
46397
|
const handleEscape = (e6) => {
|
|
46353
46398
|
if (e6.key === "Escape") {
|
|
@@ -46358,8 +46403,8 @@ function AssessmentPanel({
|
|
|
46358
46403
|
document.addEventListener("keydown", handleEscape);
|
|
46359
46404
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
46360
46405
|
}, [pendingAnnotation]);
|
|
46361
|
-
const handleAnnotationClick2 =
|
|
46362
|
-
setFocusedAnnotationId(
|
|
46406
|
+
const handleAnnotationClick2 = useCallback19(({ annotationId: annotationId2 }) => {
|
|
46407
|
+
setFocusedAnnotationId(annotationId2);
|
|
46363
46408
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
46364
46409
|
}, []);
|
|
46365
46410
|
useEventSubscriptions({
|
|
@@ -46519,7 +46564,7 @@ function CollaborationPanel({
|
|
|
46519
46564
|
}
|
|
46520
46565
|
|
|
46521
46566
|
// src/components/resource/panels/CommentEntry.tsx
|
|
46522
|
-
import { useState as
|
|
46567
|
+
import { useState as useState21, useEffect as useEffect27, useRef as useRef19, forwardRef as forwardRef2, useImperativeHandle } from "react";
|
|
46523
46568
|
import { getAnnotationExactText as getAnnotationExactText2, getCommentText } from "@semiont/api-client";
|
|
46524
46569
|
import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
46525
46570
|
function formatRelativeTime3(isoString) {
|
|
@@ -46546,13 +46591,13 @@ var CommentEntry = forwardRef2(
|
|
|
46546
46591
|
const t12 = useTranslations("CommentsPanel");
|
|
46547
46592
|
const eventBus = useEventBus();
|
|
46548
46593
|
const hoverProps = useHoverEmitter(comment2.id);
|
|
46549
|
-
const [isEditing, setIsEditing] =
|
|
46550
|
-
const [editText, setEditText] =
|
|
46551
|
-
const internalRef =
|
|
46594
|
+
const [isEditing, setIsEditing] = useState21(false);
|
|
46595
|
+
const [editText, setEditText] = useState21("");
|
|
46596
|
+
const internalRef = useRef19(null);
|
|
46552
46597
|
useImperativeHandle(ref, () => internalRef.current);
|
|
46553
46598
|
const commentText = getCommentText(comment2) || "";
|
|
46554
46599
|
const selectedText = getAnnotationExactText2(comment2);
|
|
46555
|
-
|
|
46600
|
+
useEffect27(() => {
|
|
46556
46601
|
if (isFocused && internalRef.current) {
|
|
46557
46602
|
internalRef.current.scrollIntoView({
|
|
46558
46603
|
behavior: "smooth",
|
|
@@ -46651,7 +46696,7 @@ var CommentEntry = forwardRef2(
|
|
|
46651
46696
|
);
|
|
46652
46697
|
|
|
46653
46698
|
// src/components/resource/panels/CommentsPanel.tsx
|
|
46654
|
-
import { useState as
|
|
46699
|
+
import { useState as useState22, useEffect as useEffect28, useRef as useRef20, useCallback as useCallback20, useMemo as useMemo7 } from "react";
|
|
46655
46700
|
import { getTextPositionSelector as getTextPositionSelector4, getTargetSelector as getTargetSelector6 } from "@semiont/api-client";
|
|
46656
46701
|
import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
46657
46702
|
function getSelectorDisplayText2(selector) {
|
|
@@ -46679,10 +46724,10 @@ function CommentsPanel({
|
|
|
46679
46724
|
}) {
|
|
46680
46725
|
const t12 = useTranslations("CommentsPanel");
|
|
46681
46726
|
const eventBus = useEventBus();
|
|
46682
|
-
const [newCommentText, setNewCommentText] =
|
|
46683
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
46684
|
-
const containerRef =
|
|
46685
|
-
const entryRefs =
|
|
46727
|
+
const [newCommentText, setNewCommentText] = useState22("");
|
|
46728
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState22(null);
|
|
46729
|
+
const containerRef = useRef20(null);
|
|
46730
|
+
const entryRefs = useRef20(/* @__PURE__ */ new Map());
|
|
46686
46731
|
const sortedAnnotations = useMemo7(() => {
|
|
46687
46732
|
return [...annotations].sort((a15, b8) => {
|
|
46688
46733
|
const aSelector = getTextPositionSelector4(getTargetSelector6(a15.target));
|
|
@@ -46691,14 +46736,14 @@ function CommentsPanel({
|
|
|
46691
46736
|
return aSelector.start - bSelector.start;
|
|
46692
46737
|
});
|
|
46693
46738
|
}, [annotations]);
|
|
46694
|
-
const setEntryRef =
|
|
46739
|
+
const setEntryRef = useCallback20((id2, element2) => {
|
|
46695
46740
|
if (element2) {
|
|
46696
46741
|
entryRefs.current.set(id2, element2);
|
|
46697
46742
|
} else {
|
|
46698
46743
|
entryRefs.current.delete(id2);
|
|
46699
46744
|
}
|
|
46700
46745
|
}, []);
|
|
46701
|
-
|
|
46746
|
+
useEffect28(() => {
|
|
46702
46747
|
if (!scrollToAnnotationId) return;
|
|
46703
46748
|
const element2 = entryRefs.current.get(scrollToAnnotationId);
|
|
46704
46749
|
if (element2 && containerRef.current) {
|
|
@@ -46715,7 +46760,7 @@ function CommentsPanel({
|
|
|
46715
46760
|
}
|
|
46716
46761
|
}
|
|
46717
46762
|
}, [scrollToAnnotationId]);
|
|
46718
|
-
|
|
46763
|
+
useEffect28(() => {
|
|
46719
46764
|
if (!hoveredAnnotationId) return;
|
|
46720
46765
|
const element2 = entryRefs.current.get(hoveredAnnotationId);
|
|
46721
46766
|
if (!element2 || !containerRef.current) return;
|
|
@@ -46731,8 +46776,8 @@ function CommentsPanel({
|
|
|
46731
46776
|
container.scrollTo({ top: scrollTo, behavior: "smooth" });
|
|
46732
46777
|
}
|
|
46733
46778
|
}, [hoveredAnnotationId]);
|
|
46734
|
-
const handleAnnotationClick2 =
|
|
46735
|
-
setFocusedAnnotationId(
|
|
46779
|
+
const handleAnnotationClick2 = useCallback20(({ annotationId: annotationId2 }) => {
|
|
46780
|
+
setFocusedAnnotationId(annotationId2);
|
|
46736
46781
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
46737
46782
|
}, []);
|
|
46738
46783
|
useEventSubscriptions({
|
|
@@ -46740,7 +46785,7 @@ function CommentsPanel({
|
|
|
46740
46785
|
});
|
|
46741
46786
|
const handleSaveNewComment = () => {
|
|
46742
46787
|
if (newCommentText.trim() && pendingAnnotation) {
|
|
46743
|
-
eventBus.get("mark:
|
|
46788
|
+
eventBus.get("mark:submit").next({
|
|
46744
46789
|
motivation: "commenting",
|
|
46745
46790
|
selector: pendingAnnotation.selector,
|
|
46746
46791
|
body: [{ type: "TextualBody", value: newCommentText, purpose: "commenting" }]
|
|
@@ -46748,7 +46793,7 @@ function CommentsPanel({
|
|
|
46748
46793
|
setNewCommentText("");
|
|
46749
46794
|
}
|
|
46750
46795
|
};
|
|
46751
|
-
|
|
46796
|
+
useEffect28(() => {
|
|
46752
46797
|
if (!pendingAnnotation) return;
|
|
46753
46798
|
const handleEscape = (e6) => {
|
|
46754
46799
|
if (e6.key === "Escape") {
|
|
@@ -46894,7 +46939,7 @@ var HighlightEntry = forwardRef3(
|
|
|
46894
46939
|
);
|
|
46895
46940
|
|
|
46896
46941
|
// src/components/resource/panels/HighlightPanel.tsx
|
|
46897
|
-
import { useEffect as
|
|
46942
|
+
import { useEffect as useEffect29, useState as useState23, useRef as useRef21, useCallback as useCallback21, useMemo as useMemo8 } from "react";
|
|
46898
46943
|
import { getTextPositionSelector as getTextPositionSelector5, getTargetSelector as getTargetSelector7 } from "@semiont/api-client";
|
|
46899
46944
|
import { jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
46900
46945
|
function HighlightPanel({
|
|
@@ -46909,9 +46954,9 @@ function HighlightPanel({
|
|
|
46909
46954
|
}) {
|
|
46910
46955
|
const t12 = useTranslations("HighlightPanel");
|
|
46911
46956
|
const eventBus = useEventBus();
|
|
46912
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
46913
|
-
const containerRef =
|
|
46914
|
-
const entryRefs =
|
|
46957
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState23(null);
|
|
46958
|
+
const containerRef = useRef21(null);
|
|
46959
|
+
const entryRefs = useRef21(/* @__PURE__ */ new Map());
|
|
46915
46960
|
const sortedAnnotations = useMemo8(() => {
|
|
46916
46961
|
return [...annotations].sort((a15, b8) => {
|
|
46917
46962
|
const aSelector = getTextPositionSelector5(getTargetSelector7(a15.target));
|
|
@@ -46920,14 +46965,14 @@ function HighlightPanel({
|
|
|
46920
46965
|
return aSelector.start - bSelector.start;
|
|
46921
46966
|
});
|
|
46922
46967
|
}, [annotations]);
|
|
46923
|
-
const setEntryRef =
|
|
46968
|
+
const setEntryRef = useCallback21((id2, element2) => {
|
|
46924
46969
|
if (element2) {
|
|
46925
46970
|
entryRefs.current.set(id2, element2);
|
|
46926
46971
|
} else {
|
|
46927
46972
|
entryRefs.current.delete(id2);
|
|
46928
46973
|
}
|
|
46929
46974
|
}, []);
|
|
46930
|
-
|
|
46975
|
+
useEffect29(() => {
|
|
46931
46976
|
if (!scrollToAnnotationId) return;
|
|
46932
46977
|
const element2 = entryRefs.current.get(scrollToAnnotationId);
|
|
46933
46978
|
if (element2 && containerRef.current) {
|
|
@@ -46942,7 +46987,7 @@ function HighlightPanel({
|
|
|
46942
46987
|
if (onScrollCompleted) onScrollCompleted();
|
|
46943
46988
|
}
|
|
46944
46989
|
}, [scrollToAnnotationId]);
|
|
46945
|
-
|
|
46990
|
+
useEffect29(() => {
|
|
46946
46991
|
if (!hoveredAnnotationId) return;
|
|
46947
46992
|
const element2 = entryRefs.current.get(hoveredAnnotationId);
|
|
46948
46993
|
if (!element2 || !containerRef.current) return;
|
|
@@ -46958,16 +47003,16 @@ function HighlightPanel({
|
|
|
46958
47003
|
container.scrollTo({ top: scrollTo, behavior: "smooth" });
|
|
46959
47004
|
}
|
|
46960
47005
|
}, [hoveredAnnotationId]);
|
|
46961
|
-
const handleAnnotationClick2 =
|
|
46962
|
-
setFocusedAnnotationId(
|
|
47006
|
+
const handleAnnotationClick2 = useCallback21(({ annotationId: annotationId2 }) => {
|
|
47007
|
+
setFocusedAnnotationId(annotationId2);
|
|
46963
47008
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
46964
47009
|
}, []);
|
|
46965
47010
|
useEventSubscriptions({
|
|
46966
47011
|
"browse:click": handleAnnotationClick2
|
|
46967
47012
|
});
|
|
46968
|
-
|
|
47013
|
+
useEffect29(() => {
|
|
46969
47014
|
if (pendingAnnotation && pendingAnnotation.motivation === "highlighting") {
|
|
46970
|
-
eventBus.get("mark:
|
|
47015
|
+
eventBus.get("mark:submit").next({
|
|
46971
47016
|
motivation: "highlighting",
|
|
46972
47017
|
selector: pendingAnnotation.selector,
|
|
46973
47018
|
body: []
|
|
@@ -47000,13 +47045,13 @@ function HighlightPanel({
|
|
|
47000
47045
|
}
|
|
47001
47046
|
|
|
47002
47047
|
// src/components/resource/panels/JsonLdPanel.tsx
|
|
47003
|
-
import { useEffect as
|
|
47048
|
+
import { useEffect as useEffect30, useRef as useRef22 } from "react";
|
|
47004
47049
|
import { jsx as jsx37, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
47005
47050
|
function JsonLdPanel({ resource: semiontResource }) {
|
|
47006
|
-
const editorRef =
|
|
47007
|
-
const viewRef =
|
|
47051
|
+
const editorRef = useRef22(null);
|
|
47052
|
+
const viewRef = useRef22(null);
|
|
47008
47053
|
const { showLineNumbers } = useLineNumbers();
|
|
47009
|
-
|
|
47054
|
+
useEffect30(() => {
|
|
47010
47055
|
if (!editorRef.current) return;
|
|
47011
47056
|
const isDarkMode = document.documentElement?.classList.contains("dark") ?? false;
|
|
47012
47057
|
const jsonLdContent = JSON.stringify(semiontResource, null, 2);
|
|
@@ -47238,7 +47283,7 @@ var ReferenceEntry = forwardRef4(
|
|
|
47238
47283
|
);
|
|
47239
47284
|
|
|
47240
47285
|
// src/components/resource/panels/ReferencesPanel.tsx
|
|
47241
|
-
import { useState as
|
|
47286
|
+
import { useState as useState24, useRef as useRef23, useEffect as useEffect31, useCallback as useCallback22, useMemo as useMemo9 } from "react";
|
|
47242
47287
|
import { getTextPositionSelector as getTextPositionSelector6, getTargetSelector as getTargetSelector9 } from "@semiont/api-client";
|
|
47243
47288
|
import { Fragment as Fragment8, jsx as jsx39, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
47244
47289
|
function getSelectorDisplayText3(selector) {
|
|
@@ -47272,22 +47317,22 @@ function ReferencesPanel({
|
|
|
47272
47317
|
}) {
|
|
47273
47318
|
const t12 = useTranslations("ReferencesPanel");
|
|
47274
47319
|
const eventBus = useEventBus();
|
|
47275
|
-
const [selectedEntityTypes, setSelectedEntityTypes] =
|
|
47276
|
-
const [lastAnnotationLog, setLastDetectionLog] =
|
|
47277
|
-
const [pendingEntityTypes, setPendingEntityTypes] =
|
|
47278
|
-
const [includeDescriptiveReferences, setIncludeDescriptiveReferences] =
|
|
47279
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
47280
|
-
const containerRef =
|
|
47281
|
-
const [isAssistExpanded, setIsDetectExpanded] =
|
|
47320
|
+
const [selectedEntityTypes, setSelectedEntityTypes] = useState24([]);
|
|
47321
|
+
const [lastAnnotationLog, setLastDetectionLog] = useState24(null);
|
|
47322
|
+
const [pendingEntityTypes, setPendingEntityTypes] = useState24([]);
|
|
47323
|
+
const [includeDescriptiveReferences, setIncludeDescriptiveReferences] = useState24(false);
|
|
47324
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState24(null);
|
|
47325
|
+
const containerRef = useRef23(null);
|
|
47326
|
+
const [isAssistExpanded, setIsDetectExpanded] = useState24(() => {
|
|
47282
47327
|
if (typeof window === "undefined") return true;
|
|
47283
47328
|
const stored = localStorage.getItem("assist-section-expanded-reference");
|
|
47284
47329
|
return stored ? stored === "true" : true;
|
|
47285
47330
|
});
|
|
47286
|
-
|
|
47331
|
+
useEffect31(() => {
|
|
47287
47332
|
if (typeof window === "undefined") return;
|
|
47288
47333
|
localStorage.setItem("assist-section-expanded-reference", String(isAssistExpanded));
|
|
47289
47334
|
}, [isAssistExpanded]);
|
|
47290
|
-
const entryRefs =
|
|
47335
|
+
const entryRefs = useRef23(/* @__PURE__ */ new Map());
|
|
47291
47336
|
const sortedAnnotations = useMemo9(() => {
|
|
47292
47337
|
return [...annotations].sort((a15, b8) => {
|
|
47293
47338
|
const aSelector = getTextPositionSelector6(getTargetSelector9(a15.target));
|
|
@@ -47296,14 +47341,14 @@ function ReferencesPanel({
|
|
|
47296
47341
|
return aSelector.start - bSelector.start;
|
|
47297
47342
|
});
|
|
47298
47343
|
}, [annotations]);
|
|
47299
|
-
const setEntryRef =
|
|
47344
|
+
const setEntryRef = useCallback22((id2, element2) => {
|
|
47300
47345
|
if (element2) {
|
|
47301
47346
|
entryRefs.current.set(id2, element2);
|
|
47302
47347
|
} else {
|
|
47303
47348
|
entryRefs.current.delete(id2);
|
|
47304
47349
|
}
|
|
47305
47350
|
}, []);
|
|
47306
|
-
|
|
47351
|
+
useEffect31(() => {
|
|
47307
47352
|
if (!scrollToAnnotationId) return;
|
|
47308
47353
|
const element2 = entryRefs.current.get(scrollToAnnotationId);
|
|
47309
47354
|
if (element2 && containerRef.current) {
|
|
@@ -47322,7 +47367,7 @@ function ReferencesPanel({
|
|
|
47322
47367
|
console.warn("[ReferencesPanel] Element not found for scrollToAnnotationId:", scrollToAnnotationId);
|
|
47323
47368
|
}
|
|
47324
47369
|
}, [scrollToAnnotationId]);
|
|
47325
|
-
|
|
47370
|
+
useEffect31(() => {
|
|
47326
47371
|
if (!hoveredAnnotationId) return;
|
|
47327
47372
|
const element2 = entryRefs.current.get(hoveredAnnotationId);
|
|
47328
47373
|
if (!element2 || !containerRef.current) return;
|
|
@@ -47338,8 +47383,8 @@ function ReferencesPanel({
|
|
|
47338
47383
|
container.scrollTo({ top: scrollTo, behavior: "smooth" });
|
|
47339
47384
|
}
|
|
47340
47385
|
}, [hoveredAnnotationId]);
|
|
47341
|
-
const handleAnnotationClick2 =
|
|
47342
|
-
setFocusedAnnotationId(
|
|
47386
|
+
const handleAnnotationClick2 = useCallback22(({ annotationId: annotationId2 }) => {
|
|
47387
|
+
setFocusedAnnotationId(annotationId2);
|
|
47343
47388
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
47344
47389
|
}, []);
|
|
47345
47390
|
useEventSubscriptions({
|
|
@@ -47355,8 +47400,8 @@ function ReferencesPanel({
|
|
|
47355
47400
|
}
|
|
47356
47401
|
});
|
|
47357
47402
|
};
|
|
47358
|
-
const hasSavedLogRef =
|
|
47359
|
-
|
|
47403
|
+
const hasSavedLogRef = useRef23(false);
|
|
47404
|
+
useEffect31(() => {
|
|
47360
47405
|
if (isAssisting) {
|
|
47361
47406
|
hasSavedLogRef.current = false;
|
|
47362
47407
|
return;
|
|
@@ -47375,7 +47420,7 @@ function ReferencesPanel({
|
|
|
47375
47420
|
const handleCreateReference = () => {
|
|
47376
47421
|
if (pendingAnnotation) {
|
|
47377
47422
|
const entityType3 = pendingEntityTypes.join(",") || void 0;
|
|
47378
|
-
eventBus.get("mark:
|
|
47423
|
+
eventBus.get("mark:submit").next({
|
|
47379
47424
|
motivation: "linking",
|
|
47380
47425
|
selector: pendingAnnotation.selector,
|
|
47381
47426
|
body: entityType3 ? [{ type: "TextualBody", value: entityType3, purpose: "tagging" }] : []
|
|
@@ -47383,7 +47428,7 @@ function ReferencesPanel({
|
|
|
47383
47428
|
setPendingEntityTypes([]);
|
|
47384
47429
|
}
|
|
47385
47430
|
};
|
|
47386
|
-
|
|
47431
|
+
useEffect31(() => {
|
|
47387
47432
|
if (!pendingAnnotation) return;
|
|
47388
47433
|
const handleEscape = (e6) => {
|
|
47389
47434
|
if (e6.key === "Escape") {
|
|
@@ -47796,7 +47841,7 @@ var TagEntry = forwardRef5(
|
|
|
47796
47841
|
);
|
|
47797
47842
|
|
|
47798
47843
|
// src/components/resource/panels/TaggingPanel.tsx
|
|
47799
|
-
import { useState as
|
|
47844
|
+
import { useState as useState25, useEffect as useEffect32, useRef as useRef24, useCallback as useCallback23, useMemo as useMemo10 } from "react";
|
|
47800
47845
|
import { getTextPositionSelector as getTextPositionSelector7, getTargetSelector as getTargetSelector10 } from "@semiont/api-client";
|
|
47801
47846
|
import { Fragment as Fragment10, jsx as jsx43, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
47802
47847
|
function getSelectorDisplayText4(selector) {
|
|
@@ -47824,27 +47869,27 @@ function TaggingPanel({
|
|
|
47824
47869
|
}) {
|
|
47825
47870
|
const t12 = useTranslations("TaggingPanel");
|
|
47826
47871
|
const eventBus = useEventBus();
|
|
47827
|
-
const [selectedSchemaId, setSelectedSchemaId] =
|
|
47828
|
-
const [selectedCategories, setSelectedCategories] =
|
|
47829
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
47830
|
-
const containerRef =
|
|
47831
|
-
const [isAssistExpanded, setIsDetectExpanded] =
|
|
47872
|
+
const [selectedSchemaId, setSelectedSchemaId] = useState25("legal-irac");
|
|
47873
|
+
const [selectedCategories, setSelectedCategories] = useState25(/* @__PURE__ */ new Set());
|
|
47874
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState25(null);
|
|
47875
|
+
const containerRef = useRef24(null);
|
|
47876
|
+
const [isAssistExpanded, setIsDetectExpanded] = useState25(() => {
|
|
47832
47877
|
if (typeof window === "undefined") return true;
|
|
47833
47878
|
const stored = localStorage.getItem("assist-section-expanded-tag");
|
|
47834
47879
|
return stored ? stored === "true" : true;
|
|
47835
47880
|
});
|
|
47836
|
-
|
|
47881
|
+
useEffect32(() => {
|
|
47837
47882
|
if (typeof window === "undefined") return;
|
|
47838
47883
|
localStorage.setItem("assist-section-expanded-tag", String(isAssistExpanded));
|
|
47839
47884
|
}, [isAssistExpanded]);
|
|
47840
|
-
const handleAnnotationClick2 =
|
|
47841
|
-
setFocusedAnnotationId(
|
|
47885
|
+
const handleAnnotationClick2 = useCallback23(({ annotationId: annotationId2 }) => {
|
|
47886
|
+
setFocusedAnnotationId(annotationId2);
|
|
47842
47887
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
47843
47888
|
}, []);
|
|
47844
47889
|
useEventSubscriptions({
|
|
47845
47890
|
"browse:click": handleAnnotationClick2
|
|
47846
47891
|
});
|
|
47847
|
-
const entryRefs =
|
|
47892
|
+
const entryRefs = useRef24(/* @__PURE__ */ new Map());
|
|
47848
47893
|
const sortedAnnotations = useMemo10(() => {
|
|
47849
47894
|
return [...annotations].sort((a15, b8) => {
|
|
47850
47895
|
const aSelector = getTextPositionSelector7(getTargetSelector10(a15.target));
|
|
@@ -47853,14 +47898,14 @@ function TaggingPanel({
|
|
|
47853
47898
|
return aSelector.start - bSelector.start;
|
|
47854
47899
|
});
|
|
47855
47900
|
}, [annotations]);
|
|
47856
|
-
const setEntryRef =
|
|
47901
|
+
const setEntryRef = useCallback23((id2, element2) => {
|
|
47857
47902
|
if (element2) {
|
|
47858
47903
|
entryRefs.current.set(id2, element2);
|
|
47859
47904
|
} else {
|
|
47860
47905
|
entryRefs.current.delete(id2);
|
|
47861
47906
|
}
|
|
47862
47907
|
}, []);
|
|
47863
|
-
|
|
47908
|
+
useEffect32(() => {
|
|
47864
47909
|
if (!scrollToAnnotationId) return;
|
|
47865
47910
|
const element2 = entryRefs.current.get(scrollToAnnotationId);
|
|
47866
47911
|
if (element2 && containerRef.current) {
|
|
@@ -47875,7 +47920,7 @@ function TaggingPanel({
|
|
|
47875
47920
|
if (onScrollCompleted) onScrollCompleted();
|
|
47876
47921
|
}
|
|
47877
47922
|
}, [scrollToAnnotationId]);
|
|
47878
|
-
|
|
47923
|
+
useEffect32(() => {
|
|
47879
47924
|
if (!hoveredAnnotationId) return;
|
|
47880
47925
|
const element2 = entryRefs.current.get(hoveredAnnotationId);
|
|
47881
47926
|
if (!element2 || !containerRef.current) return;
|
|
@@ -47926,7 +47971,7 @@ function TaggingPanel({
|
|
|
47926
47971
|
setSelectedCategories(/* @__PURE__ */ new Set());
|
|
47927
47972
|
}
|
|
47928
47973
|
};
|
|
47929
|
-
|
|
47974
|
+
useEffect32(() => {
|
|
47930
47975
|
if (!pendingAnnotation) return;
|
|
47931
47976
|
const handleEscape = (e6) => {
|
|
47932
47977
|
if (e6.key === "Escape") {
|
|
@@ -47968,7 +48013,7 @@ function TaggingPanel({
|
|
|
47968
48013
|
className: "semiont-select",
|
|
47969
48014
|
onChange: (e6) => {
|
|
47970
48015
|
if (e6.target.value && pendingAnnotation) {
|
|
47971
|
-
eventBus.get("mark:
|
|
48016
|
+
eventBus.get("mark:submit").next({
|
|
47972
48017
|
motivation: "tagging",
|
|
47973
48018
|
selector: pendingAnnotation.selector,
|
|
47974
48019
|
body: [
|
|
@@ -48153,7 +48198,7 @@ function TaggingPanel({
|
|
|
48153
48198
|
}
|
|
48154
48199
|
|
|
48155
48200
|
// src/components/resource/panels/UnifiedAnnotationsPanel.tsx
|
|
48156
|
-
import { useState as
|
|
48201
|
+
import { useState as useState26, useEffect as useEffect33 } from "react";
|
|
48157
48202
|
import { jsx as jsx44, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
48158
48203
|
var TAB_ORDER = ["statistics", "reference", "highlight", "assessment", "comment", "tag"];
|
|
48159
48204
|
function UnifiedAnnotationsPanel(props) {
|
|
@@ -48175,7 +48220,7 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
48175
48220
|
}
|
|
48176
48221
|
}
|
|
48177
48222
|
const grouped = groups;
|
|
48178
|
-
const [activeTab, setActiveTab] =
|
|
48223
|
+
const [activeTab, setActiveTab] = useState26(() => {
|
|
48179
48224
|
if (typeof window === "undefined") return props.initialTab || "statistics";
|
|
48180
48225
|
const storageKey = props.resourceId ? `annotations-tab-${props.resourceId}` : "annotations-tab-global";
|
|
48181
48226
|
const stored = localStorage.getItem(storageKey);
|
|
@@ -48184,17 +48229,17 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
48184
48229
|
}
|
|
48185
48230
|
return props.initialTab || "statistics";
|
|
48186
48231
|
});
|
|
48187
|
-
|
|
48232
|
+
useEffect33(() => {
|
|
48188
48233
|
if (typeof window === "undefined") return;
|
|
48189
48234
|
const storageKey = props.resourceId ? `annotations-tab-${props.resourceId}` : "annotations-tab-global";
|
|
48190
48235
|
localStorage.setItem(storageKey, activeTab);
|
|
48191
48236
|
}, [activeTab, props.resourceId]);
|
|
48192
|
-
|
|
48237
|
+
useEffect33(() => {
|
|
48193
48238
|
if (props.initialTab && props.initialTabGeneration !== void 0) {
|
|
48194
48239
|
setActiveTab(props.initialTab);
|
|
48195
48240
|
}
|
|
48196
48241
|
}, [props.initialTabGeneration]);
|
|
48197
|
-
|
|
48242
|
+
useEffect33(() => {
|
|
48198
48243
|
if (props.pendingAnnotation) {
|
|
48199
48244
|
const motivationToTab = {
|
|
48200
48245
|
"linking": "reference",
|
|
@@ -48333,7 +48378,7 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
48333
48378
|
}
|
|
48334
48379
|
|
|
48335
48380
|
// src/components/navigation/Footer.tsx
|
|
48336
|
-
import { useState as
|
|
48381
|
+
import { useState as useState27 } from "react";
|
|
48337
48382
|
import { Fragment as Fragment11, jsx as jsx45, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
48338
48383
|
function Footer({
|
|
48339
48384
|
Link,
|
|
@@ -48344,7 +48389,7 @@ function Footer({
|
|
|
48344
48389
|
apiDocsUrl = "/api/docs",
|
|
48345
48390
|
sourceCodeUrl = "https://github.com/The-AI-Alliance/semiont"
|
|
48346
48391
|
}) {
|
|
48347
|
-
const [showCookiePreferences, setShowCookiePreferences] =
|
|
48392
|
+
const [showCookiePreferences, setShowCookiePreferences] = useState27(false);
|
|
48348
48393
|
return /* @__PURE__ */ jsxs36(Fragment11, { children: [
|
|
48349
48394
|
/* @__PURE__ */ jsx45("footer", { role: "contentinfo", className: "semiont-footer", children: /* @__PURE__ */ jsx45("div", { className: "semiont-footer__container", children: /* @__PURE__ */ jsxs36("div", { className: "semiont-footer__content", children: [
|
|
48350
48395
|
/* @__PURE__ */ jsx45("div", { className: "semiont-footer__copyright", children: t12("copyright", { year: (/* @__PURE__ */ new Date()).getFullYear() }) }),
|
|
@@ -48482,7 +48527,7 @@ function NavigationMenu({
|
|
|
48482
48527
|
}
|
|
48483
48528
|
|
|
48484
48529
|
// src/components/navigation/ObservableLink.tsx
|
|
48485
|
-
import { useCallback as
|
|
48530
|
+
import { useCallback as useCallback24, useRef as useRef25, useEffect as useEffect34 } from "react";
|
|
48486
48531
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
48487
48532
|
function ObservableLink({
|
|
48488
48533
|
href,
|
|
@@ -48492,11 +48537,11 @@ function ObservableLink({
|
|
|
48492
48537
|
...anchorProps
|
|
48493
48538
|
}) {
|
|
48494
48539
|
const eventBus = useEventBus();
|
|
48495
|
-
const onClickRef =
|
|
48496
|
-
|
|
48540
|
+
const onClickRef = useRef25(onClick);
|
|
48541
|
+
useEffect34(() => {
|
|
48497
48542
|
onClickRef.current = onClick;
|
|
48498
48543
|
});
|
|
48499
|
-
const handleClick =
|
|
48544
|
+
const handleClick = useCallback24((e6) => {
|
|
48500
48545
|
eventBus.get("browse:link-clicked").next({
|
|
48501
48546
|
href,
|
|
48502
48547
|
label
|
|
@@ -48515,7 +48560,7 @@ function ObservableLink({
|
|
|
48515
48560
|
}
|
|
48516
48561
|
|
|
48517
48562
|
// src/components/navigation/SimpleNavigation.tsx
|
|
48518
|
-
import { useState as
|
|
48563
|
+
import { useState as useState28, useRef as useRef26, useEffect as useEffect35 } from "react";
|
|
48519
48564
|
import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
48520
48565
|
function SimpleNavigation({
|
|
48521
48566
|
title,
|
|
@@ -48530,12 +48575,12 @@ function SimpleNavigation({
|
|
|
48530
48575
|
}) {
|
|
48531
48576
|
const ChevronLeftIcon = icons.chevronLeft;
|
|
48532
48577
|
const BarsIcon = icons.bars;
|
|
48533
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
48534
|
-
const dropdownRef =
|
|
48578
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState28(false);
|
|
48579
|
+
const dropdownRef = useRef26(null);
|
|
48535
48580
|
const eventBus = useEventBus();
|
|
48536
48581
|
const toggleDropdown = () => setIsDropdownOpen(!isDropdownOpen);
|
|
48537
48582
|
const closeDropdown = () => setIsDropdownOpen(false);
|
|
48538
|
-
|
|
48583
|
+
useEffect35(() => {
|
|
48539
48584
|
const handleClickOutside = (event) => {
|
|
48540
48585
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
48541
48586
|
closeDropdown();
|
|
@@ -48611,14 +48656,14 @@ function SimpleNavigation({
|
|
|
48611
48656
|
}
|
|
48612
48657
|
|
|
48613
48658
|
// src/components/navigation/CollapsibleResourceNavigation.tsx
|
|
48614
|
-
import { useCallback as
|
|
48659
|
+
import { useCallback as useCallback30, useState as useState32, useRef as useRef31, useEffect as useEffect40 } from "react";
|
|
48615
48660
|
|
|
48616
48661
|
// ../../node_modules/@dnd-kit/core/dist/core.esm.js
|
|
48617
|
-
import React20, { createContext as createContext7, useContext as useContext7, useEffect as
|
|
48662
|
+
import React20, { createContext as createContext7, useContext as useContext7, useEffect as useEffect37, useState as useState30, useCallback as useCallback27, useMemo as useMemo12, useRef as useRef28, memo as memo2, useReducer, cloneElement, forwardRef as forwardRef6 } from "react";
|
|
48618
48663
|
import { createPortal, unstable_batchedUpdates } from "react-dom";
|
|
48619
48664
|
|
|
48620
48665
|
// ../../node_modules/@dnd-kit/utilities/dist/utilities.esm.js
|
|
48621
|
-
import { useMemo as useMemo11, useLayoutEffect, useEffect as
|
|
48666
|
+
import { useMemo as useMemo11, useLayoutEffect, useEffect as useEffect36, useRef as useRef27, useCallback as useCallback25 } from "react";
|
|
48622
48667
|
function useCombinedRefs() {
|
|
48623
48668
|
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48624
48669
|
refs[_key] = arguments[_key];
|
|
@@ -48686,13 +48731,13 @@ function getOwnerDocument(target) {
|
|
|
48686
48731
|
}
|
|
48687
48732
|
return document;
|
|
48688
48733
|
}
|
|
48689
|
-
var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect :
|
|
48734
|
+
var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect36;
|
|
48690
48735
|
function useEvent(handler) {
|
|
48691
|
-
const handlerRef =
|
|
48736
|
+
const handlerRef = useRef27(handler);
|
|
48692
48737
|
useIsomorphicLayoutEffect(() => {
|
|
48693
48738
|
handlerRef.current = handler;
|
|
48694
48739
|
});
|
|
48695
|
-
return
|
|
48740
|
+
return useCallback25(function() {
|
|
48696
48741
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48697
48742
|
args[_key] = arguments[_key];
|
|
48698
48743
|
}
|
|
@@ -48700,11 +48745,11 @@ function useEvent(handler) {
|
|
|
48700
48745
|
}, []);
|
|
48701
48746
|
}
|
|
48702
48747
|
function useInterval() {
|
|
48703
|
-
const intervalRef =
|
|
48704
|
-
const set =
|
|
48748
|
+
const intervalRef = useRef27(null);
|
|
48749
|
+
const set = useCallback25((listener, duration) => {
|
|
48705
48750
|
intervalRef.current = setInterval(listener, duration);
|
|
48706
48751
|
}, []);
|
|
48707
|
-
const clear =
|
|
48752
|
+
const clear = useCallback25(() => {
|
|
48708
48753
|
if (intervalRef.current !== null) {
|
|
48709
48754
|
clearInterval(intervalRef.current);
|
|
48710
48755
|
intervalRef.current = null;
|
|
@@ -48716,7 +48761,7 @@ function useLatestValue(value, dependencies) {
|
|
|
48716
48761
|
if (dependencies === void 0) {
|
|
48717
48762
|
dependencies = [value];
|
|
48718
48763
|
}
|
|
48719
|
-
const valueRef =
|
|
48764
|
+
const valueRef = useRef27(value);
|
|
48720
48765
|
useIsomorphicLayoutEffect(() => {
|
|
48721
48766
|
if (valueRef.current !== value) {
|
|
48722
48767
|
valueRef.current = value;
|
|
@@ -48725,7 +48770,7 @@ function useLatestValue(value, dependencies) {
|
|
|
48725
48770
|
return valueRef;
|
|
48726
48771
|
}
|
|
48727
48772
|
function useLazyMemo(callback, dependencies) {
|
|
48728
|
-
const valueRef =
|
|
48773
|
+
const valueRef = useRef27();
|
|
48729
48774
|
return useMemo11(
|
|
48730
48775
|
() => {
|
|
48731
48776
|
const newValue = callback(valueRef.current);
|
|
@@ -48738,8 +48783,8 @@ function useLazyMemo(callback, dependencies) {
|
|
|
48738
48783
|
}
|
|
48739
48784
|
function useNodeRef(onChange) {
|
|
48740
48785
|
const onChangeHandler = useEvent(onChange);
|
|
48741
|
-
const node2 =
|
|
48742
|
-
const setNodeRef =
|
|
48786
|
+
const node2 = useRef27(null);
|
|
48787
|
+
const setNodeRef = useCallback25(
|
|
48743
48788
|
(element2) => {
|
|
48744
48789
|
if (element2 !== node2.current) {
|
|
48745
48790
|
onChangeHandler == null ? void 0 : onChangeHandler(element2, node2.current);
|
|
@@ -48752,8 +48797,8 @@ function useNodeRef(onChange) {
|
|
|
48752
48797
|
return [node2, setNodeRef];
|
|
48753
48798
|
}
|
|
48754
48799
|
function usePrevious(value) {
|
|
48755
|
-
const ref =
|
|
48756
|
-
|
|
48800
|
+
const ref = useRef27();
|
|
48801
|
+
useEffect36(() => {
|
|
48757
48802
|
ref.current = value;
|
|
48758
48803
|
}, [value]);
|
|
48759
48804
|
return ref.current;
|
|
@@ -48894,7 +48939,7 @@ function findFirstFocusableNode(element2) {
|
|
|
48894
48939
|
}
|
|
48895
48940
|
|
|
48896
48941
|
// ../../node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js
|
|
48897
|
-
import React19, { useState as
|
|
48942
|
+
import React19, { useState as useState29, useCallback as useCallback26 } from "react";
|
|
48898
48943
|
var hiddenStyles = {
|
|
48899
48944
|
display: "none"
|
|
48900
48945
|
};
|
|
@@ -48937,8 +48982,8 @@ function LiveRegion(_ref) {
|
|
|
48937
48982
|
}, announcement);
|
|
48938
48983
|
}
|
|
48939
48984
|
function useAnnouncement() {
|
|
48940
|
-
const [announcement, setAnnouncement] =
|
|
48941
|
-
const announce =
|
|
48985
|
+
const [announcement, setAnnouncement] = useState29("");
|
|
48986
|
+
const announce = useCallback26((value) => {
|
|
48942
48987
|
if (value != null) {
|
|
48943
48988
|
setAnnouncement(value);
|
|
48944
48989
|
}
|
|
@@ -48953,7 +48998,7 @@ function useAnnouncement() {
|
|
|
48953
48998
|
var DndMonitorContext = /* @__PURE__ */ createContext7(null);
|
|
48954
48999
|
function useDndMonitor(listener) {
|
|
48955
49000
|
const registerListener = useContext7(DndMonitorContext);
|
|
48956
|
-
|
|
49001
|
+
useEffect37(() => {
|
|
48957
49002
|
if (!registerListener) {
|
|
48958
49003
|
throw new Error("useDndMonitor must be used within a children of <DndContext>");
|
|
48959
49004
|
}
|
|
@@ -48962,12 +49007,12 @@ function useDndMonitor(listener) {
|
|
|
48962
49007
|
}, [listener, registerListener]);
|
|
48963
49008
|
}
|
|
48964
49009
|
function useDndMonitorProvider() {
|
|
48965
|
-
const [listeners] =
|
|
48966
|
-
const registerListener =
|
|
49010
|
+
const [listeners] = useState30(() => /* @__PURE__ */ new Set());
|
|
49011
|
+
const registerListener = useCallback27((listener) => {
|
|
48967
49012
|
listeners.add(listener);
|
|
48968
49013
|
return () => listeners.delete(listener);
|
|
48969
49014
|
}, [listeners]);
|
|
48970
|
-
const dispatch =
|
|
49015
|
+
const dispatch = useCallback27((_ref) => {
|
|
48971
49016
|
let {
|
|
48972
49017
|
type,
|
|
48973
49018
|
event
|
|
@@ -49028,8 +49073,8 @@ function Accessibility(_ref) {
|
|
|
49028
49073
|
announcement
|
|
49029
49074
|
} = useAnnouncement();
|
|
49030
49075
|
const liveRegionId = useUniqueId("DndLiveRegion");
|
|
49031
|
-
const [mounted, setMounted] =
|
|
49032
|
-
|
|
49076
|
+
const [mounted, setMounted] = useState30(false);
|
|
49077
|
+
useEffect37(() => {
|
|
49033
49078
|
setMounted(true);
|
|
49034
49079
|
}, []);
|
|
49035
49080
|
useDndMonitor(useMemo12(() => ({
|
|
@@ -50365,11 +50410,11 @@ function useAutoScroller(_ref) {
|
|
|
50365
50410
|
disabled: !enabled
|
|
50366
50411
|
});
|
|
50367
50412
|
const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();
|
|
50368
|
-
const scrollSpeed =
|
|
50413
|
+
const scrollSpeed = useRef28({
|
|
50369
50414
|
x: 0,
|
|
50370
50415
|
y: 0
|
|
50371
50416
|
});
|
|
50372
|
-
const scrollDirection =
|
|
50417
|
+
const scrollDirection = useRef28({
|
|
50373
50418
|
x: 0,
|
|
50374
50419
|
y: 0
|
|
50375
50420
|
});
|
|
@@ -50386,8 +50431,8 @@ function useAutoScroller(_ref) {
|
|
|
50386
50431
|
return draggingRect;
|
|
50387
50432
|
}
|
|
50388
50433
|
}, [activator, draggingRect, pointerCoordinates]);
|
|
50389
|
-
const scrollContainerRef =
|
|
50390
|
-
const autoScroll =
|
|
50434
|
+
const scrollContainerRef = useRef28(null);
|
|
50435
|
+
const autoScroll = useCallback27(() => {
|
|
50391
50436
|
const scrollContainer = scrollContainerRef.current;
|
|
50392
50437
|
if (!scrollContainer) {
|
|
50393
50438
|
return;
|
|
@@ -50397,7 +50442,7 @@ function useAutoScroller(_ref) {
|
|
|
50397
50442
|
scrollContainer.scrollBy(scrollLeft, scrollTop);
|
|
50398
50443
|
}, []);
|
|
50399
50444
|
const sortedScrollableAncestors = useMemo12(() => order2 === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order2, scrollableAncestors]);
|
|
50400
|
-
|
|
50445
|
+
useEffect37(
|
|
50401
50446
|
() => {
|
|
50402
50447
|
if (!enabled || !scrollableAncestors.length || !rect) {
|
|
50403
50448
|
clearAutoScrollInterval();
|
|
@@ -50538,16 +50583,16 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
50538
50583
|
dependencies,
|
|
50539
50584
|
config
|
|
50540
50585
|
} = _ref;
|
|
50541
|
-
const [queue, setQueue] =
|
|
50586
|
+
const [queue, setQueue] = useState30(null);
|
|
50542
50587
|
const {
|
|
50543
50588
|
frequency,
|
|
50544
50589
|
measure,
|
|
50545
50590
|
strategy
|
|
50546
50591
|
} = config;
|
|
50547
|
-
const containersRef =
|
|
50592
|
+
const containersRef = useRef28(containers);
|
|
50548
50593
|
const disabled = isDisabled();
|
|
50549
50594
|
const disabledRef = useLatestValue(disabled);
|
|
50550
|
-
const measureDroppableContainers =
|
|
50595
|
+
const measureDroppableContainers = useCallback27(function(ids2) {
|
|
50551
50596
|
if (ids2 === void 0) {
|
|
50552
50597
|
ids2 = [];
|
|
50553
50598
|
}
|
|
@@ -50561,7 +50606,7 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
50561
50606
|
return value.concat(ids2.filter((id2) => !value.includes(id2)));
|
|
50562
50607
|
});
|
|
50563
50608
|
}, [disabledRef]);
|
|
50564
|
-
const timeoutId =
|
|
50609
|
+
const timeoutId = useRef28(null);
|
|
50565
50610
|
const droppableRects = useLazyMemo((previousValue) => {
|
|
50566
50611
|
if (disabled && !dragging) {
|
|
50567
50612
|
return defaultValue;
|
|
@@ -50587,10 +50632,10 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
50587
50632
|
}
|
|
50588
50633
|
return previousValue;
|
|
50589
50634
|
}, [containers, queue, dragging, disabled, measure]);
|
|
50590
|
-
|
|
50635
|
+
useEffect37(() => {
|
|
50591
50636
|
containersRef.current = containers;
|
|
50592
50637
|
}, [containers]);
|
|
50593
|
-
|
|
50638
|
+
useEffect37(
|
|
50594
50639
|
() => {
|
|
50595
50640
|
if (disabled) {
|
|
50596
50641
|
return;
|
|
@@ -50600,7 +50645,7 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
50600
50645
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50601
50646
|
[dragging, disabled]
|
|
50602
50647
|
);
|
|
50603
|
-
|
|
50648
|
+
useEffect37(
|
|
50604
50649
|
() => {
|
|
50605
50650
|
if (queue && queue.length > 0) {
|
|
50606
50651
|
setQueue(null);
|
|
@@ -50609,7 +50654,7 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
50609
50654
|
//eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50610
50655
|
[JSON.stringify(queue)]
|
|
50611
50656
|
);
|
|
50612
|
-
|
|
50657
|
+
useEffect37(
|
|
50613
50658
|
() => {
|
|
50614
50659
|
if (disabled || typeof frequency !== "number" || timeoutId.current !== null) {
|
|
50615
50660
|
return;
|
|
@@ -50667,7 +50712,7 @@ function useMutationObserver(_ref) {
|
|
|
50667
50712
|
} = window;
|
|
50668
50713
|
return new MutationObserver2(handleMutations);
|
|
50669
50714
|
}, [handleMutations, disabled]);
|
|
50670
|
-
|
|
50715
|
+
useEffect37(() => {
|
|
50671
50716
|
return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
50672
50717
|
}, [mutationObserver]);
|
|
50673
50718
|
return mutationObserver;
|
|
@@ -50691,7 +50736,7 @@ function useResizeObserver(_ref) {
|
|
|
50691
50736
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50692
50737
|
[disabled]
|
|
50693
50738
|
);
|
|
50694
|
-
|
|
50739
|
+
useEffect37(() => {
|
|
50695
50740
|
return () => resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
50696
50741
|
}, [resizeObserver]);
|
|
50697
50742
|
return resizeObserver;
|
|
@@ -50703,7 +50748,7 @@ function useRect(element2, measure, fallbackRect2) {
|
|
|
50703
50748
|
if (measure === void 0) {
|
|
50704
50749
|
measure = defaultMeasure;
|
|
50705
50750
|
}
|
|
50706
|
-
const [rect, setRect] =
|
|
50751
|
+
const [rect, setRect] = useState30(null);
|
|
50707
50752
|
function measureRect() {
|
|
50708
50753
|
setRect((currentRect) => {
|
|
50709
50754
|
if (!element2) {
|
|
@@ -50761,7 +50806,7 @@ function useRectDelta(rect) {
|
|
|
50761
50806
|
}
|
|
50762
50807
|
var defaultValue$1 = [];
|
|
50763
50808
|
function useScrollableAncestors(node2) {
|
|
50764
|
-
const previousNode =
|
|
50809
|
+
const previousNode = useRef28(node2);
|
|
50765
50810
|
const ancestors = useLazyMemo((previousValue) => {
|
|
50766
50811
|
if (!node2) {
|
|
50767
50812
|
return defaultValue$1;
|
|
@@ -50771,15 +50816,15 @@ function useScrollableAncestors(node2) {
|
|
|
50771
50816
|
}
|
|
50772
50817
|
return getScrollableAncestors(node2);
|
|
50773
50818
|
}, [node2]);
|
|
50774
|
-
|
|
50819
|
+
useEffect37(() => {
|
|
50775
50820
|
previousNode.current = node2;
|
|
50776
50821
|
}, [node2]);
|
|
50777
50822
|
return ancestors;
|
|
50778
50823
|
}
|
|
50779
50824
|
function useScrollOffsets(elements) {
|
|
50780
|
-
const [scrollCoordinates, setScrollCoordinates] =
|
|
50781
|
-
const prevElements =
|
|
50782
|
-
const handleScroll =
|
|
50825
|
+
const [scrollCoordinates, setScrollCoordinates] = useState30(null);
|
|
50826
|
+
const prevElements = useRef28(elements);
|
|
50827
|
+
const handleScroll = useCallback27((event) => {
|
|
50783
50828
|
const scrollingElement = getScrollableElement(event.target);
|
|
50784
50829
|
if (!scrollingElement) {
|
|
50785
50830
|
return;
|
|
@@ -50792,7 +50837,7 @@ function useScrollOffsets(elements) {
|
|
|
50792
50837
|
return new Map(scrollCoordinates2);
|
|
50793
50838
|
});
|
|
50794
50839
|
}, []);
|
|
50795
|
-
|
|
50840
|
+
useEffect37(() => {
|
|
50796
50841
|
const previousElements = prevElements.current;
|
|
50797
50842
|
if (elements !== previousElements) {
|
|
50798
50843
|
cleanup(previousElements);
|
|
@@ -50831,15 +50876,15 @@ function useScrollOffsetsDelta(scrollOffsets, dependencies) {
|
|
|
50831
50876
|
if (dependencies === void 0) {
|
|
50832
50877
|
dependencies = [];
|
|
50833
50878
|
}
|
|
50834
|
-
const initialScrollOffsets =
|
|
50835
|
-
|
|
50879
|
+
const initialScrollOffsets = useRef28(null);
|
|
50880
|
+
useEffect37(
|
|
50836
50881
|
() => {
|
|
50837
50882
|
initialScrollOffsets.current = null;
|
|
50838
50883
|
},
|
|
50839
50884
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50840
50885
|
dependencies
|
|
50841
50886
|
);
|
|
50842
|
-
|
|
50887
|
+
useEffect37(() => {
|
|
50843
50888
|
const hasScrollOffsets = scrollOffsets !== defaultCoordinates;
|
|
50844
50889
|
if (hasScrollOffsets && !initialScrollOffsets.current) {
|
|
50845
50890
|
initialScrollOffsets.current = scrollOffsets;
|
|
@@ -50851,7 +50896,7 @@ function useScrollOffsetsDelta(scrollOffsets, dependencies) {
|
|
|
50851
50896
|
return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;
|
|
50852
50897
|
}
|
|
50853
50898
|
function useSensorSetup(sensors) {
|
|
50854
|
-
|
|
50899
|
+
useEffect37(
|
|
50855
50900
|
() => {
|
|
50856
50901
|
if (!canUseDOM) {
|
|
50857
50902
|
return;
|
|
@@ -50902,7 +50947,7 @@ function useRects(elements, measure) {
|
|
|
50902
50947
|
}
|
|
50903
50948
|
const [firstElement] = elements;
|
|
50904
50949
|
const windowRect2 = useWindowRect(firstElement ? getWindow(firstElement) : null);
|
|
50905
|
-
const [rects, setRects] =
|
|
50950
|
+
const [rects, setRects] = useState30(defaultValue$2);
|
|
50906
50951
|
function measureRects() {
|
|
50907
50952
|
setRects(() => {
|
|
50908
50953
|
if (!elements.length) {
|
|
@@ -50935,8 +50980,8 @@ function useDragOverlayMeasuring(_ref) {
|
|
|
50935
50980
|
let {
|
|
50936
50981
|
measure
|
|
50937
50982
|
} = _ref;
|
|
50938
|
-
const [rect, setRect] =
|
|
50939
|
-
const handleResize =
|
|
50983
|
+
const [rect, setRect] = useState30(null);
|
|
50984
|
+
const handleResize = useCallback27((entries) => {
|
|
50940
50985
|
for (const {
|
|
50941
50986
|
target
|
|
50942
50987
|
} of entries) {
|
|
@@ -50956,7 +51001,7 @@ function useDragOverlayMeasuring(_ref) {
|
|
|
50956
51001
|
const resizeObserver = useResizeObserver({
|
|
50957
51002
|
callback: handleResize
|
|
50958
51003
|
});
|
|
50959
|
-
const handleNodeChange =
|
|
51004
|
+
const handleNodeChange = useCallback27((element2) => {
|
|
50960
51005
|
const node2 = getMeasurableNode(element2);
|
|
50961
51006
|
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
50962
51007
|
if (node2) {
|
|
@@ -51191,7 +51236,7 @@ function RestoreFocus(_ref) {
|
|
|
51191
51236
|
} = useContext7(InternalContext);
|
|
51192
51237
|
const previousActivatorEvent = usePrevious(activatorEvent);
|
|
51193
51238
|
const previousActiveId = usePrevious(active == null ? void 0 : active.id);
|
|
51194
|
-
|
|
51239
|
+
useEffect37(() => {
|
|
51195
51240
|
if (disabled) {
|
|
51196
51241
|
return;
|
|
51197
51242
|
}
|
|
@@ -51268,7 +51313,7 @@ function useLayoutShiftScrollCompensation(_ref) {
|
|
|
51268
51313
|
initialRect,
|
|
51269
51314
|
config = true
|
|
51270
51315
|
} = _ref;
|
|
51271
|
-
const initialized =
|
|
51316
|
+
const initialized = useRef28(false);
|
|
51272
51317
|
const {
|
|
51273
51318
|
x: x8,
|
|
51274
51319
|
y: y4
|
|
@@ -51336,7 +51381,7 @@ var DndContext = /* @__PURE__ */ memo2(function DndContext2(_ref) {
|
|
|
51336
51381
|
const store = useReducer(reducer, void 0, getInitialState);
|
|
51337
51382
|
const [state, dispatch] = store;
|
|
51338
51383
|
const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();
|
|
51339
|
-
const [status, setStatus] =
|
|
51384
|
+
const [status, setStatus] = useState30(Status.Uninitialized);
|
|
51340
51385
|
const isInitialized = status === Status.Initialized;
|
|
51341
51386
|
const {
|
|
51342
51387
|
draggable: {
|
|
@@ -51349,7 +51394,7 @@ var DndContext = /* @__PURE__ */ memo2(function DndContext2(_ref) {
|
|
|
51349
51394
|
}
|
|
51350
51395
|
} = state;
|
|
51351
51396
|
const node2 = activeId != null ? draggableNodes.get(activeId) : null;
|
|
51352
|
-
const activeRects =
|
|
51397
|
+
const activeRects = useRef28({
|
|
51353
51398
|
initial: null,
|
|
51354
51399
|
translated: null
|
|
51355
51400
|
});
|
|
@@ -51362,9 +51407,9 @@ var DndContext = /* @__PURE__ */ memo2(function DndContext2(_ref) {
|
|
|
51362
51407
|
rect: activeRects
|
|
51363
51408
|
} : null;
|
|
51364
51409
|
}, [activeId, node2]);
|
|
51365
|
-
const activeRef =
|
|
51366
|
-
const [activeSensor, setActiveSensor] =
|
|
51367
|
-
const [activatorEvent, setActivatorEvent] =
|
|
51410
|
+
const activeRef = useRef28(null);
|
|
51411
|
+
const [activeSensor, setActiveSensor] = useState30(null);
|
|
51412
|
+
const [activatorEvent, setActivatorEvent] = useState30(null);
|
|
51368
51413
|
const latestProps = useLatestValue(props, Object.values(props));
|
|
51369
51414
|
const draggableDescribedById = useUniqueId("DndDescribedBy", id2);
|
|
51370
51415
|
const enabledDroppableContainers = useMemo12(() => droppableContainers.getEnabled(), [droppableContainers]);
|
|
@@ -51390,7 +51435,7 @@ var DndContext = /* @__PURE__ */ memo2(function DndContext2(_ref) {
|
|
|
51390
51435
|
});
|
|
51391
51436
|
const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);
|
|
51392
51437
|
const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null);
|
|
51393
|
-
const sensorContext =
|
|
51438
|
+
const sensorContext = useRef28({
|
|
51394
51439
|
activatorEvent: null,
|
|
51395
51440
|
active: null,
|
|
51396
51441
|
activeNode,
|
|
@@ -51448,11 +51493,11 @@ var DndContext = /* @__PURE__ */ memo2(function DndContext2(_ref) {
|
|
|
51448
51493
|
pointerCoordinates
|
|
51449
51494
|
}) : null;
|
|
51450
51495
|
const overId = getFirstCollision(collisions, "id");
|
|
51451
|
-
const [over, setOver] =
|
|
51496
|
+
const [over, setOver] = useState30(null);
|
|
51452
51497
|
const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
|
|
51453
51498
|
const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
|
|
51454
|
-
const activeSensorRef =
|
|
51455
|
-
const instantiateSensor =
|
|
51499
|
+
const activeSensorRef = useRef28(null);
|
|
51500
|
+
const instantiateSensor = useCallback27(
|
|
51456
51501
|
(event, _ref2) => {
|
|
51457
51502
|
let {
|
|
51458
51503
|
sensor: Sensor,
|
|
@@ -51610,7 +51655,7 @@ var DndContext = /* @__PURE__ */ memo2(function DndContext2(_ref) {
|
|
|
51610
51655
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51611
51656
|
[draggableNodes]
|
|
51612
51657
|
);
|
|
51613
|
-
const bindActivatorToSensorInstantiator =
|
|
51658
|
+
const bindActivatorToSensorInstantiator = useCallback27((handler, sensor) => {
|
|
51614
51659
|
return (event, active2) => {
|
|
51615
51660
|
const nativeEvent = event.nativeEvent;
|
|
51616
51661
|
const activeDraggableNode = draggableNodes.get(active2);
|
|
@@ -51642,7 +51687,7 @@ var DndContext = /* @__PURE__ */ memo2(function DndContext2(_ref) {
|
|
|
51642
51687
|
setStatus(Status.Initialized);
|
|
51643
51688
|
}
|
|
51644
51689
|
}, [activeNodeRect, status]);
|
|
51645
|
-
|
|
51690
|
+
useEffect37(
|
|
51646
51691
|
() => {
|
|
51647
51692
|
const {
|
|
51648
51693
|
onDragMove
|
|
@@ -51677,7 +51722,7 @@ var DndContext = /* @__PURE__ */ memo2(function DndContext2(_ref) {
|
|
|
51677
51722
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51678
51723
|
[scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]
|
|
51679
51724
|
);
|
|
51680
|
-
|
|
51725
|
+
useEffect37(
|
|
51681
51726
|
() => {
|
|
51682
51727
|
const {
|
|
51683
51728
|
active: active2,
|
|
@@ -51910,12 +51955,12 @@ function useDroppable(_ref) {
|
|
|
51910
51955
|
over,
|
|
51911
51956
|
measureDroppableContainers
|
|
51912
51957
|
} = useContext7(InternalContext);
|
|
51913
|
-
const previous3 =
|
|
51958
|
+
const previous3 = useRef28({
|
|
51914
51959
|
disabled
|
|
51915
51960
|
});
|
|
51916
|
-
const resizeObserverConnected =
|
|
51917
|
-
const rect =
|
|
51918
|
-
const callbackId =
|
|
51961
|
+
const resizeObserverConnected = useRef28(false);
|
|
51962
|
+
const rect = useRef28(null);
|
|
51963
|
+
const callbackId = useRef28(null);
|
|
51919
51964
|
const {
|
|
51920
51965
|
disabled: resizeObserverDisabled,
|
|
51921
51966
|
updateMeasurementsFor,
|
|
@@ -51925,7 +51970,7 @@ function useDroppable(_ref) {
|
|
|
51925
51970
|
...resizeObserverConfig
|
|
51926
51971
|
};
|
|
51927
51972
|
const ids2 = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id2);
|
|
51928
|
-
const handleResize =
|
|
51973
|
+
const handleResize = useCallback27(
|
|
51929
51974
|
() => {
|
|
51930
51975
|
if (!resizeObserverConnected.current) {
|
|
51931
51976
|
resizeObserverConnected.current = true;
|
|
@@ -51946,7 +51991,7 @@ function useDroppable(_ref) {
|
|
|
51946
51991
|
callback: handleResize,
|
|
51947
51992
|
disabled: resizeObserverDisabled || !active
|
|
51948
51993
|
});
|
|
51949
|
-
const handleNodeChange =
|
|
51994
|
+
const handleNodeChange = useCallback27((newElement, previousElement) => {
|
|
51950
51995
|
if (!resizeObserver) {
|
|
51951
51996
|
return;
|
|
51952
51997
|
}
|
|
@@ -51960,7 +52005,7 @@ function useDroppable(_ref) {
|
|
|
51960
52005
|
}, [resizeObserver]);
|
|
51961
52006
|
const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);
|
|
51962
52007
|
const dataRef = useLatestValue(data2);
|
|
51963
|
-
|
|
52008
|
+
useEffect37(() => {
|
|
51964
52009
|
if (!resizeObserver || !nodeRef.current) {
|
|
51965
52010
|
return;
|
|
51966
52011
|
}
|
|
@@ -51968,7 +52013,7 @@ function useDroppable(_ref) {
|
|
|
51968
52013
|
resizeObserverConnected.current = false;
|
|
51969
52014
|
resizeObserver.observe(nodeRef.current);
|
|
51970
52015
|
}, [nodeRef, resizeObserver]);
|
|
51971
|
-
|
|
52016
|
+
useEffect37(
|
|
51972
52017
|
() => {
|
|
51973
52018
|
dispatch({
|
|
51974
52019
|
type: Action.RegisterDroppable,
|
|
@@ -51990,7 +52035,7 @@ function useDroppable(_ref) {
|
|
|
51990
52035
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51991
52036
|
[id2]
|
|
51992
52037
|
);
|
|
51993
|
-
|
|
52038
|
+
useEffect37(() => {
|
|
51994
52039
|
if (disabled !== previous3.current.disabled) {
|
|
51995
52040
|
dispatch({
|
|
51996
52041
|
type: Action.SetDroppableDisabled,
|
|
@@ -52012,7 +52057,7 @@ function useDroppable(_ref) {
|
|
|
52012
52057
|
}
|
|
52013
52058
|
|
|
52014
52059
|
// ../../node_modules/@dnd-kit/sortable/dist/sortable.esm.js
|
|
52015
|
-
import React21, { useMemo as useMemo13, useRef as
|
|
52060
|
+
import React21, { useMemo as useMemo13, useRef as useRef29, useEffect as useEffect38, useState as useState31, useContext as useContext8 } from "react";
|
|
52016
52061
|
function arrayMove(array, from, to) {
|
|
52017
52062
|
const newArray = array.slice();
|
|
52018
52063
|
newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]);
|
|
@@ -52170,7 +52215,7 @@ function SortableContext(_ref) {
|
|
|
52170
52215
|
const isDragging = active != null;
|
|
52171
52216
|
const activeIndex = active ? items.indexOf(active.id) : -1;
|
|
52172
52217
|
const overIndex = over ? items.indexOf(over.id) : -1;
|
|
52173
|
-
const previousItemsRef =
|
|
52218
|
+
const previousItemsRef = useRef29(items);
|
|
52174
52219
|
const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
|
|
52175
52220
|
const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
|
|
52176
52221
|
const disabled = normalizeDisabled(disabledProp);
|
|
@@ -52179,7 +52224,7 @@ function SortableContext(_ref) {
|
|
|
52179
52224
|
measureDroppableContainers(items);
|
|
52180
52225
|
}
|
|
52181
52226
|
}, [itemsHaveChanged, items, isDragging, measureDroppableContainers]);
|
|
52182
|
-
|
|
52227
|
+
useEffect38(() => {
|
|
52183
52228
|
previousItemsRef.current = items;
|
|
52184
52229
|
}, [items]);
|
|
52185
52230
|
const contextValue = useMemo13(
|
|
@@ -52253,8 +52298,8 @@ function useDerivedTransform(_ref) {
|
|
|
52253
52298
|
node: node2,
|
|
52254
52299
|
rect
|
|
52255
52300
|
} = _ref;
|
|
52256
|
-
const [derivedTransform, setDerivedtransform] =
|
|
52257
|
-
const previousIndex =
|
|
52301
|
+
const [derivedTransform, setDerivedtransform] = useState31(null);
|
|
52302
|
+
const previousIndex = useRef29(index2);
|
|
52258
52303
|
useIsomorphicLayoutEffect(() => {
|
|
52259
52304
|
if (!disabled && index2 !== previousIndex.current && node2.current) {
|
|
52260
52305
|
const initial = rect.current;
|
|
@@ -52277,7 +52322,7 @@ function useDerivedTransform(_ref) {
|
|
|
52277
52322
|
previousIndex.current = index2;
|
|
52278
52323
|
}
|
|
52279
52324
|
}, [disabled, index2, node2, rect]);
|
|
52280
|
-
|
|
52325
|
+
useEffect38(() => {
|
|
52281
52326
|
if (derivedTransform) {
|
|
52282
52327
|
setDerivedtransform(null);
|
|
52283
52328
|
}
|
|
@@ -52372,7 +52417,7 @@ function useSortable(_ref) {
|
|
|
52372
52417
|
overIndex
|
|
52373
52418
|
}) : index2;
|
|
52374
52419
|
const activeId = active == null ? void 0 : active.id;
|
|
52375
|
-
const previous3 =
|
|
52420
|
+
const previous3 = useRef29({
|
|
52376
52421
|
activeId,
|
|
52377
52422
|
items,
|
|
52378
52423
|
newIndex,
|
|
@@ -52399,7 +52444,7 @@ function useSortable(_ref) {
|
|
|
52399
52444
|
node: node2,
|
|
52400
52445
|
rect
|
|
52401
52446
|
});
|
|
52402
|
-
|
|
52447
|
+
useEffect38(() => {
|
|
52403
52448
|
if (isSorting && previous3.current.newIndex !== newIndex) {
|
|
52404
52449
|
previous3.current.newIndex = newIndex;
|
|
52405
52450
|
}
|
|
@@ -52410,7 +52455,7 @@ function useSortable(_ref) {
|
|
|
52410
52455
|
previous3.current.items = items;
|
|
52411
52456
|
}
|
|
52412
52457
|
}, [isSorting, newIndex, containerId, items]);
|
|
52413
|
-
|
|
52458
|
+
useEffect38(() => {
|
|
52414
52459
|
if (activeId === previous3.current.activeId) {
|
|
52415
52460
|
return;
|
|
52416
52461
|
}
|
|
@@ -52595,7 +52640,7 @@ function isAfter(a15, b8) {
|
|
|
52595
52640
|
}
|
|
52596
52641
|
|
|
52597
52642
|
// src/components/navigation/SortableResourceTab.tsx
|
|
52598
|
-
import { useCallback as
|
|
52643
|
+
import { useCallback as useCallback28, useRef as useRef30, useEffect as useEffect39 } from "react";
|
|
52599
52644
|
import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
52600
52645
|
function SortableResourceTab({
|
|
52601
52646
|
resource,
|
|
@@ -52618,8 +52663,8 @@ function SortableResourceTab({
|
|
|
52618
52663
|
transition,
|
|
52619
52664
|
isDragging: isSortableDragging
|
|
52620
52665
|
} = useSortable({ id: resource.id });
|
|
52621
|
-
const onReorderRef =
|
|
52622
|
-
|
|
52666
|
+
const onReorderRef = useRef30(onReorder);
|
|
52667
|
+
useEffect39(() => {
|
|
52623
52668
|
onReorderRef.current = onReorder;
|
|
52624
52669
|
});
|
|
52625
52670
|
const style = {
|
|
@@ -52629,7 +52674,7 @@ function SortableResourceTab({
|
|
|
52629
52674
|
};
|
|
52630
52675
|
const iconEmoji = getResourceIcon(resource.mediaType);
|
|
52631
52676
|
const isCurrentlyDragging = isSortableDragging || isDragging;
|
|
52632
|
-
const handleKeyDown =
|
|
52677
|
+
const handleKeyDown = useCallback28((e6) => {
|
|
52633
52678
|
if (onReorderRef.current && e6.altKey) {
|
|
52634
52679
|
if (e6.key === "ArrowUp") {
|
|
52635
52680
|
e6.preventDefault();
|
|
@@ -52682,37 +52727,37 @@ function SortableResourceTab({
|
|
|
52682
52727
|
}
|
|
52683
52728
|
|
|
52684
52729
|
// src/hooks/useDragAnnouncements.ts
|
|
52685
|
-
import { useCallback as
|
|
52730
|
+
import { useCallback as useCallback29 } from "react";
|
|
52686
52731
|
function useDragAnnouncements() {
|
|
52687
52732
|
const { announce } = useLiveRegion();
|
|
52688
|
-
const announceReorder =
|
|
52733
|
+
const announceReorder = useCallback29((message) => {
|
|
52689
52734
|
announce(message, "assertive");
|
|
52690
52735
|
}, [announce]);
|
|
52691
|
-
const announcePickup =
|
|
52736
|
+
const announcePickup = useCallback29((resourceName, position3, total) => {
|
|
52692
52737
|
announce(
|
|
52693
52738
|
`Picked up ${resourceName}. Position ${position3} of ${total}. Use arrow keys to move, space to drop.`,
|
|
52694
52739
|
"assertive"
|
|
52695
52740
|
);
|
|
52696
52741
|
}, [announce]);
|
|
52697
|
-
const announceDrop =
|
|
52742
|
+
const announceDrop = useCallback29((resourceName, newPosition, total) => {
|
|
52698
52743
|
announce(
|
|
52699
52744
|
`Dropped ${resourceName} at position ${newPosition} of ${total}.`,
|
|
52700
52745
|
"assertive"
|
|
52701
52746
|
);
|
|
52702
52747
|
}, [announce]);
|
|
52703
|
-
const announceMove =
|
|
52748
|
+
const announceMove = useCallback29((resourceName, direction, newPosition, total) => {
|
|
52704
52749
|
announce(
|
|
52705
52750
|
`Moved ${resourceName} ${direction} to position ${newPosition} of ${total}.`,
|
|
52706
52751
|
"polite"
|
|
52707
52752
|
);
|
|
52708
52753
|
}, [announce]);
|
|
52709
|
-
const announceKeyboardReorder =
|
|
52754
|
+
const announceKeyboardReorder = useCallback29((resourceName, direction, newPosition, total) => {
|
|
52710
52755
|
announce(
|
|
52711
52756
|
`${resourceName} moved ${direction} to position ${newPosition} of ${total}.`,
|
|
52712
52757
|
"assertive"
|
|
52713
52758
|
);
|
|
52714
52759
|
}, [announce]);
|
|
52715
|
-
const announceCannotMove =
|
|
52760
|
+
const announceCannotMove = useCallback29((direction) => {
|
|
52716
52761
|
announce(
|
|
52717
52762
|
`Cannot move ${direction}. Already at the ${direction === "up" ? "top" : "bottom"} of the list.`,
|
|
52718
52763
|
"polite"
|
|
@@ -52745,8 +52790,8 @@ function CollapsibleResourceNavigation({
|
|
|
52745
52790
|
}) {
|
|
52746
52791
|
const ChevronLeftIcon = icons.chevronLeft;
|
|
52747
52792
|
const BarsIcon = icons.bars;
|
|
52748
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
52749
|
-
const dropdownRef =
|
|
52793
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState32(false);
|
|
52794
|
+
const dropdownRef = useRef31(null);
|
|
52750
52795
|
const { announcePickup, announceDrop, announceKeyboardReorder, announceCannotMove } = useDragAnnouncements();
|
|
52751
52796
|
const t12 = useTranslations("CollapsibleResourceNavigation");
|
|
52752
52797
|
const eventBus = useEventBus();
|
|
@@ -52761,7 +52806,7 @@ function CollapsibleResourceNavigation({
|
|
|
52761
52806
|
};
|
|
52762
52807
|
const toggleDropdown = () => setIsDropdownOpen(!isDropdownOpen);
|
|
52763
52808
|
const closeDropdown = () => setIsDropdownOpen(false);
|
|
52764
|
-
|
|
52809
|
+
useEffect40(() => {
|
|
52765
52810
|
const handleClickOutside = (event) => {
|
|
52766
52811
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
52767
52812
|
closeDropdown();
|
|
@@ -52783,7 +52828,7 @@ function CollapsibleResourceNavigation({
|
|
|
52783
52828
|
coordinateGetter: sortableKeyboardCoordinates
|
|
52784
52829
|
})
|
|
52785
52830
|
);
|
|
52786
|
-
const handleKeyboardReorder =
|
|
52831
|
+
const handleKeyboardReorder = useCallback30((resourceId, direction) => {
|
|
52787
52832
|
const currentIndex = resources.findIndex((r14) => r14.id === resourceId);
|
|
52788
52833
|
if (currentIndex === -1) return;
|
|
52789
52834
|
const newIndex = direction === "up" ? currentIndex - 1 : currentIndex + 1;
|
|
@@ -52959,16 +53004,16 @@ function CollapsibleResourceNavigation({
|
|
|
52959
53004
|
}
|
|
52960
53005
|
|
|
52961
53006
|
// src/components/modals/SearchModal.tsx
|
|
52962
|
-
import { useState as
|
|
53007
|
+
import { useState as useState33, useEffect as useEffect41, Fragment as Fragment13 } from "react";
|
|
52963
53008
|
|
|
52964
53009
|
// src/hooks/useSearchAnnouncements.ts
|
|
52965
|
-
import { useCallback as
|
|
53010
|
+
import { useCallback as useCallback31 } from "react";
|
|
52966
53011
|
function useSearchAnnouncements2() {
|
|
52967
53012
|
const { announce } = useLiveRegion();
|
|
52968
|
-
const announceSearching =
|
|
53013
|
+
const announceSearching = useCallback31(() => {
|
|
52969
53014
|
announce("Searching...", "polite");
|
|
52970
53015
|
}, [announce]);
|
|
52971
|
-
const announceSearchResults =
|
|
53016
|
+
const announceSearchResults = useCallback31((count2, query) => {
|
|
52972
53017
|
if (count2 === 0) {
|
|
52973
53018
|
announce(`No results found for ${query}`, "polite");
|
|
52974
53019
|
} else if (count2 === 1) {
|
|
@@ -52977,10 +53022,10 @@ function useSearchAnnouncements2() {
|
|
|
52977
53022
|
announce(`${count2} results found for ${query}`, "polite");
|
|
52978
53023
|
}
|
|
52979
53024
|
}, [announce]);
|
|
52980
|
-
const announceSelection =
|
|
53025
|
+
const announceSelection = useCallback31((name3, type) => {
|
|
52981
53026
|
announce(`Selected ${type}: ${name3}. Press Enter to navigate.`, "polite");
|
|
52982
53027
|
}, [announce]);
|
|
52983
|
-
const announceNavigation =
|
|
53028
|
+
const announceNavigation = useCallback31((name3, type) => {
|
|
52984
53029
|
announce(`Navigating to ${type}: ${name3}`, "assertive");
|
|
52985
53030
|
}, [announce]);
|
|
52986
53031
|
return {
|
|
@@ -53001,10 +53046,10 @@ function SearchModal({
|
|
|
53001
53046
|
translations = {}
|
|
53002
53047
|
}) {
|
|
53003
53048
|
const { announceSearchResults, announceSearching } = useSearchAnnouncements2();
|
|
53004
|
-
const [query, setQuery] =
|
|
53005
|
-
const [debouncedQuery, setDebouncedQuery] =
|
|
53006
|
-
const [results, setResults] =
|
|
53007
|
-
const [selectedIndex, setSelectedIndex] =
|
|
53049
|
+
const [query, setQuery] = useState33("");
|
|
53050
|
+
const [debouncedQuery, setDebouncedQuery] = useState33("");
|
|
53051
|
+
const [results, setResults] = useState33([]);
|
|
53052
|
+
const [selectedIndex, setSelectedIndex] = useState33(0);
|
|
53008
53053
|
const t12 = {
|
|
53009
53054
|
placeholder: translations.placeholder || "Search resources, entities...",
|
|
53010
53055
|
searching: translations.searching || "Searching...",
|
|
@@ -53016,7 +53061,7 @@ function SearchModal({
|
|
|
53016
53061
|
enter: translations.enter || "Enter",
|
|
53017
53062
|
esc: translations.esc || "ESC"
|
|
53018
53063
|
};
|
|
53019
|
-
|
|
53064
|
+
useEffect41(() => {
|
|
53020
53065
|
const timer = setTimeout(() => {
|
|
53021
53066
|
setDebouncedQuery(query);
|
|
53022
53067
|
}, 300);
|
|
@@ -53024,7 +53069,7 @@ function SearchModal({
|
|
|
53024
53069
|
}, [query]);
|
|
53025
53070
|
const searchData = { resources: [], entities: [] };
|
|
53026
53071
|
const loading = false;
|
|
53027
|
-
|
|
53072
|
+
useEffect41(() => {
|
|
53028
53073
|
if (isOpen) {
|
|
53029
53074
|
setQuery("");
|
|
53030
53075
|
setDebouncedQuery("");
|
|
@@ -53032,7 +53077,7 @@ function SearchModal({
|
|
|
53032
53077
|
setSelectedIndex(0);
|
|
53033
53078
|
}
|
|
53034
53079
|
}, [isOpen]);
|
|
53035
|
-
|
|
53080
|
+
useEffect41(() => {
|
|
53036
53081
|
if (!debouncedQuery.trim()) {
|
|
53037
53082
|
setResults([]);
|
|
53038
53083
|
return;
|
|
@@ -53163,7 +53208,7 @@ function SearchModal({
|
|
|
53163
53208
|
}
|
|
53164
53209
|
|
|
53165
53210
|
// src/components/modals/ResourceSearchModal.tsx
|
|
53166
|
-
import { useState as
|
|
53211
|
+
import { useState as useState34, useEffect as useEffect42, Fragment as Fragment14 } from "react";
|
|
53167
53212
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
53168
53213
|
function ResourceSearchModal({
|
|
53169
53214
|
isOpen,
|
|
@@ -53173,8 +53218,8 @@ function ResourceSearchModal({
|
|
|
53173
53218
|
translations = {}
|
|
53174
53219
|
}) {
|
|
53175
53220
|
const { announceSearchResults, announceSearching, announceNavigation } = useSearchAnnouncements2();
|
|
53176
|
-
const [search2, setSearch] =
|
|
53177
|
-
const [debouncedSearch, setDebouncedSearch] =
|
|
53221
|
+
const [search2, setSearch] = useState34(searchTerm);
|
|
53222
|
+
const [debouncedSearch, setDebouncedSearch] = useState34(searchTerm);
|
|
53178
53223
|
const t12 = {
|
|
53179
53224
|
title: translations.title || "Search Resources",
|
|
53180
53225
|
placeholder: translations.placeholder || "Search for resources...",
|
|
@@ -53182,7 +53227,7 @@ function ResourceSearchModal({
|
|
|
53182
53227
|
noResults: translations.noResults || "No documents found",
|
|
53183
53228
|
close: translations.close || "\u2715"
|
|
53184
53229
|
};
|
|
53185
|
-
|
|
53230
|
+
useEffect42(() => {
|
|
53186
53231
|
const timer = setTimeout(() => {
|
|
53187
53232
|
setDebouncedSearch(search2);
|
|
53188
53233
|
}, 300);
|
|
@@ -53204,17 +53249,17 @@ function ResourceSearchModal({
|
|
|
53204
53249
|
mediaType
|
|
53205
53250
|
};
|
|
53206
53251
|
}) || [];
|
|
53207
|
-
|
|
53252
|
+
useEffect42(() => {
|
|
53208
53253
|
if (!loading && debouncedSearch) {
|
|
53209
53254
|
announceSearchResults(results.length, debouncedSearch);
|
|
53210
53255
|
}
|
|
53211
53256
|
}, [loading, results.length, debouncedSearch]);
|
|
53212
|
-
|
|
53257
|
+
useEffect42(() => {
|
|
53213
53258
|
if (loading && debouncedSearch) {
|
|
53214
53259
|
announceSearching();
|
|
53215
53260
|
}
|
|
53216
53261
|
}, [loading, debouncedSearch]);
|
|
53217
|
-
|
|
53262
|
+
useEffect42(() => {
|
|
53218
53263
|
if (isOpen && searchTerm) {
|
|
53219
53264
|
setSearch(searchTerm);
|
|
53220
53265
|
setDebouncedSearch(searchTerm);
|
|
@@ -53418,11 +53463,11 @@ function SessionTimer() {
|
|
|
53418
53463
|
}
|
|
53419
53464
|
|
|
53420
53465
|
// src/components/SessionExpiryBanner.tsx
|
|
53421
|
-
import { useState as
|
|
53466
|
+
import { useState as useState35 } from "react";
|
|
53422
53467
|
import { jsx as jsx55, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
53423
53468
|
function SessionExpiryBanner() {
|
|
53424
53469
|
const { timeRemaining, isExpiringSoon } = useSessionExpiry();
|
|
53425
|
-
const [dismissed, setDismissed] =
|
|
53470
|
+
const [dismissed, setDismissed] = useState35(false);
|
|
53426
53471
|
const formattedTime = formatTime(timeRemaining);
|
|
53427
53472
|
if (!isExpiringSoon || dismissed || !formattedTime) {
|
|
53428
53473
|
return null;
|
|
@@ -53643,7 +53688,7 @@ function UnifiedHeader({
|
|
|
53643
53688
|
}
|
|
53644
53689
|
|
|
53645
53690
|
// src/components/layout/LeftSidebar.tsx
|
|
53646
|
-
import { useState as
|
|
53691
|
+
import { useState as useState36, useEffect as useEffect43 } from "react";
|
|
53647
53692
|
import { jsx as jsx59, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
53648
53693
|
function LeftSidebar({
|
|
53649
53694
|
Link,
|
|
@@ -53658,7 +53703,7 @@ function LeftSidebar({
|
|
|
53658
53703
|
isModerator = false,
|
|
53659
53704
|
currentPath
|
|
53660
53705
|
}) {
|
|
53661
|
-
const [isCollapsed, setIsCollapsed] =
|
|
53706
|
+
const [isCollapsed, setIsCollapsed] = useState36(false);
|
|
53662
53707
|
const { width, setWidth, minWidth, maxWidth } = usePanelWidth({
|
|
53663
53708
|
defaultWidth: 256,
|
|
53664
53709
|
// 16rem
|
|
@@ -53668,7 +53713,7 @@ function LeftSidebar({
|
|
|
53668
53713
|
// 25rem
|
|
53669
53714
|
storageKey: "semiont-left-sidebar-width"
|
|
53670
53715
|
});
|
|
53671
|
-
|
|
53716
|
+
useEffect43(() => {
|
|
53672
53717
|
if (collapsible) {
|
|
53673
53718
|
const saved = localStorage.getItem(storageKey);
|
|
53674
53719
|
if (saved === "true") {
|
|
@@ -54715,21 +54760,21 @@ var ForwardRef17 = /* @__PURE__ */ React44.forwardRef(UserCircleIcon);
|
|
|
54715
54760
|
var UserCircleIcon_default = ForwardRef17;
|
|
54716
54761
|
|
|
54717
54762
|
// src/hooks/usePanelBrowse.ts
|
|
54718
|
-
import { useState as
|
|
54763
|
+
import { useState as useState37, useCallback as useCallback32, useEffect as useEffect44 } from "react";
|
|
54719
54764
|
var COMMON_PANELS = ["user", "settings"];
|
|
54720
54765
|
var RESOURCE_PANELS = ["history", "info", "annotations", "collaboration", "jsonld"];
|
|
54721
54766
|
var tabGenerationCounter = 0;
|
|
54722
54767
|
function usePanelBrowse() {
|
|
54723
|
-
const [activePanel, setActivePanel] =
|
|
54768
|
+
const [activePanel, setActivePanel] = useState37(() => {
|
|
54724
54769
|
if (typeof window !== "undefined") {
|
|
54725
54770
|
const saved = localStorage.getItem("activeToolbarPanel");
|
|
54726
54771
|
return saved || null;
|
|
54727
54772
|
}
|
|
54728
54773
|
return null;
|
|
54729
54774
|
});
|
|
54730
|
-
const [scrollToAnnotationId, setScrollToAnnotationId] =
|
|
54731
|
-
const [panelInitialTab, setPanelInitialTab] =
|
|
54732
|
-
|
|
54775
|
+
const [scrollToAnnotationId, setScrollToAnnotationId] = useState37(null);
|
|
54776
|
+
const [panelInitialTab, setPanelInitialTab] = useState37(null);
|
|
54777
|
+
useEffect44(() => {
|
|
54733
54778
|
if (typeof window === "undefined") return;
|
|
54734
54779
|
if (activePanel) {
|
|
54735
54780
|
localStorage.setItem("activeToolbarPanel", activePanel);
|
|
@@ -54737,13 +54782,13 @@ function usePanelBrowse() {
|
|
|
54737
54782
|
localStorage.removeItem("activeToolbarPanel");
|
|
54738
54783
|
}
|
|
54739
54784
|
}, [activePanel]);
|
|
54740
|
-
const handleScrollCompleted =
|
|
54785
|
+
const handleScrollCompleted = useCallback32(() => {
|
|
54741
54786
|
setScrollToAnnotationId(null);
|
|
54742
54787
|
}, []);
|
|
54743
|
-
const handlePanelToggle =
|
|
54788
|
+
const handlePanelToggle = useCallback32(({ panel }) => {
|
|
54744
54789
|
setActivePanel((current) => current === panel ? null : panel);
|
|
54745
54790
|
}, []);
|
|
54746
|
-
const handlePanelOpen =
|
|
54791
|
+
const handlePanelOpen = useCallback32(({ panel, scrollToAnnotationId: scrollTarget, motivation }) => {
|
|
54747
54792
|
if (scrollTarget) {
|
|
54748
54793
|
setScrollToAnnotationId(scrollTarget);
|
|
54749
54794
|
}
|
|
@@ -54760,7 +54805,7 @@ function usePanelBrowse() {
|
|
|
54760
54805
|
}
|
|
54761
54806
|
setActivePanel(panel);
|
|
54762
54807
|
}, []);
|
|
54763
|
-
const handlePanelClose =
|
|
54808
|
+
const handlePanelClose = useCallback32(() => {
|
|
54764
54809
|
setActivePanel(null);
|
|
54765
54810
|
}, []);
|
|
54766
54811
|
useEventSubscriptions({
|
|
@@ -54944,7 +54989,7 @@ function AdminSecurityPage({
|
|
|
54944
54989
|
}
|
|
54945
54990
|
|
|
54946
54991
|
// src/features/admin-users/components/AdminUsersPage.tsx
|
|
54947
|
-
import { useState as
|
|
54992
|
+
import { useState as useState38 } from "react";
|
|
54948
54993
|
import { Fragment as Fragment15, jsx as jsx68, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
54949
54994
|
function UserTableRow({
|
|
54950
54995
|
user,
|
|
@@ -55026,9 +55071,9 @@ function AdminUsersPage({
|
|
|
55026
55071
|
Toolbar: Toolbar2,
|
|
55027
55072
|
buttonStyles: buttonStyles2
|
|
55028
55073
|
}) {
|
|
55029
|
-
const [searchTerm, setSearchTerm] =
|
|
55030
|
-
const [selectedRole, setSelectedRole] =
|
|
55031
|
-
const [selectedStatus, setSelectedStatus] =
|
|
55074
|
+
const [searchTerm, setSearchTerm] = useState38("");
|
|
55075
|
+
const [selectedRole, setSelectedRole] = useState38("all");
|
|
55076
|
+
const [selectedStatus, setSelectedStatus] = useState38("all");
|
|
55032
55077
|
const filteredUsers = users.filter((user) => {
|
|
55033
55078
|
const matchesSearch = (user.name || "").toLowerCase().includes(searchTerm.toLowerCase()) || user.email.toLowerCase().includes(searchTerm.toLowerCase());
|
|
55034
55079
|
const userRole = user.isAdmin ? "admin" : "user";
|
|
@@ -55343,7 +55388,7 @@ function SignInForm({
|
|
|
55343
55388
|
}
|
|
55344
55389
|
|
|
55345
55390
|
// src/features/auth/components/SignUpForm.tsx
|
|
55346
|
-
import { useState as
|
|
55391
|
+
import { useState as useState39 } from "react";
|
|
55347
55392
|
import { jsx as jsx70, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
55348
55393
|
function GoogleIcon2() {
|
|
55349
55394
|
return /* @__PURE__ */ jsxs58("svg", { className: "semiont-icon semiont-icon--small semiont-icon--inline", viewBox: "0 0 24 24", children: [
|
|
@@ -55378,7 +55423,7 @@ function GoogleIcon2() {
|
|
|
55378
55423
|
] });
|
|
55379
55424
|
}
|
|
55380
55425
|
function SignUpForm({ onSignUp, Link, translations: t12 }) {
|
|
55381
|
-
const [isLoading, setIsLoading] =
|
|
55426
|
+
const [isLoading, setIsLoading] = useState39(false);
|
|
55382
55427
|
const handleSignUp = async () => {
|
|
55383
55428
|
setIsLoading(true);
|
|
55384
55429
|
try {
|
|
@@ -55835,7 +55880,7 @@ function TagSchemasPage({
|
|
|
55835
55880
|
}
|
|
55836
55881
|
|
|
55837
55882
|
// src/features/resource-compose/components/ResourceComposePage.tsx
|
|
55838
|
-
import { useState as
|
|
55883
|
+
import { useState as useState40, useEffect as useEffect45 } from "react";
|
|
55839
55884
|
import { isImageMimeType, isPdfMimeType as isPdfMimeType4, LOCALES as LOCALES2 } from "@semiont/api-client";
|
|
55840
55885
|
import { jsx as jsx76, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
55841
55886
|
function ResourceComposePage({
|
|
@@ -55855,19 +55900,19 @@ function ResourceComposePage({
|
|
|
55855
55900
|
Toolbar: Toolbar2
|
|
55856
55901
|
}) {
|
|
55857
55902
|
const { announceFormSubmitting, announceFormSuccess, announceFormError } = useFormAnnouncements();
|
|
55858
|
-
const [newResourceName, setNewResourceName] =
|
|
55859
|
-
const [newResourceContent, setNewResourceContent] =
|
|
55860
|
-
const [selectedEntityTypes, setSelectedEntityTypes] =
|
|
55861
|
-
const [isCreating, setIsCreating] =
|
|
55862
|
-
const [inputMethod, setInputMethod] =
|
|
55863
|
-
const [uploadedFile, setUploadedFile] =
|
|
55864
|
-
const [fileMimeType, setFileMimeType] =
|
|
55865
|
-
const [filePreviewUrl, setFilePreviewUrl] =
|
|
55866
|
-
const [selectedFormat, setSelectedFormat] =
|
|
55867
|
-
const [selectedLanguage, setSelectedLanguage] =
|
|
55868
|
-
const [selectedCharset, setSelectedCharset] =
|
|
55869
|
-
const [archiveOriginal, setArchiveOriginal] =
|
|
55870
|
-
|
|
55903
|
+
const [newResourceName, setNewResourceName] = useState40("");
|
|
55904
|
+
const [newResourceContent, setNewResourceContent] = useState40("");
|
|
55905
|
+
const [selectedEntityTypes, setSelectedEntityTypes] = useState40([]);
|
|
55906
|
+
const [isCreating, setIsCreating] = useState40(false);
|
|
55907
|
+
const [inputMethod, setInputMethod] = useState40("write");
|
|
55908
|
+
const [uploadedFile, setUploadedFile] = useState40(null);
|
|
55909
|
+
const [fileMimeType, setFileMimeType] = useState40("text/markdown");
|
|
55910
|
+
const [filePreviewUrl, setFilePreviewUrl] = useState40(null);
|
|
55911
|
+
const [selectedFormat, setSelectedFormat] = useState40("text/markdown");
|
|
55912
|
+
const [selectedLanguage, setSelectedLanguage] = useState40(initialLocale);
|
|
55913
|
+
const [selectedCharset, setSelectedCharset] = useState40("");
|
|
55914
|
+
const [archiveOriginal, setArchiveOriginal] = useState40(true);
|
|
55915
|
+
useEffect45(() => {
|
|
55871
55916
|
if (mode === "clone" && cloneData) {
|
|
55872
55917
|
setNewResourceName(cloneData.sourceResource.name);
|
|
55873
55918
|
setNewResourceContent(cloneData.sourceContent);
|
|
@@ -55900,7 +55945,7 @@ function ResourceComposePage({
|
|
|
55900
55945
|
reader.readAsText(file);
|
|
55901
55946
|
}
|
|
55902
55947
|
};
|
|
55903
|
-
|
|
55948
|
+
useEffect45(() => {
|
|
55904
55949
|
return () => {
|
|
55905
55950
|
if (filePreviewUrl) {
|
|
55906
55951
|
URL.revokeObjectURL(filePreviewUrl);
|
|
@@ -56249,7 +56294,7 @@ function ResourceComposePage({
|
|
|
56249
56294
|
}
|
|
56250
56295
|
|
|
56251
56296
|
// src/features/resource-discovery/components/ResourceDiscoveryPage.tsx
|
|
56252
|
-
import { useState as
|
|
56297
|
+
import { useState as useState41, useCallback as useCallback33, useRef as useRef32 } from "react";
|
|
56253
56298
|
import { getResourceId as getResourceId2 } from "@semiont/api-client";
|
|
56254
56299
|
|
|
56255
56300
|
// src/features/resource-discovery/components/ResourceCard.tsx
|
|
@@ -56322,8 +56367,8 @@ function ResourceDiscoveryPage({
|
|
|
56322
56367
|
translations: t12,
|
|
56323
56368
|
ToolbarPanels
|
|
56324
56369
|
}) {
|
|
56325
|
-
const [searchQuery2, setSearchQuery] =
|
|
56326
|
-
const [selectedEntityType, setSelectedEntityType] =
|
|
56370
|
+
const [searchQuery2, setSearchQuery] = useState41("");
|
|
56371
|
+
const [selectedEntityType, setSelectedEntityType] = useState41("");
|
|
56327
56372
|
const hasSearchQuery = searchQuery2.trim() !== "";
|
|
56328
56373
|
const hasSearchResults = searchDocuments.length > 0;
|
|
56329
56374
|
const baseDocuments = hasSearchResults ? searchDocuments : recentDocuments;
|
|
@@ -56340,18 +56385,18 @@ function ResourceDiscoveryPage({
|
|
|
56340
56385
|
{ orientation: "grid", cols: 2 }
|
|
56341
56386
|
// 2 columns on medium+ screens
|
|
56342
56387
|
);
|
|
56343
|
-
const onNavigateToResourceRef =
|
|
56388
|
+
const onNavigateToResourceRef = useRef32(onNavigateToResource);
|
|
56344
56389
|
onNavigateToResourceRef.current = onNavigateToResource;
|
|
56345
|
-
const handleEntityTypeFilter =
|
|
56390
|
+
const handleEntityTypeFilter = useCallback33((entityType3) => {
|
|
56346
56391
|
setSelectedEntityType(entityType3);
|
|
56347
56392
|
}, []);
|
|
56348
|
-
const openResource =
|
|
56393
|
+
const openResource = useCallback33((resource) => {
|
|
56349
56394
|
const resourceId = getResourceId2(resource);
|
|
56350
56395
|
if (resourceId) {
|
|
56351
56396
|
onNavigateToResourceRef.current(resourceId);
|
|
56352
56397
|
}
|
|
56353
56398
|
}, []);
|
|
56354
|
-
const handleSearchSubmit =
|
|
56399
|
+
const handleSearchSubmit = useCallback33((e6) => {
|
|
56355
56400
|
e6.preventDefault();
|
|
56356
56401
|
}, []);
|
|
56357
56402
|
if (isLoadingRecent) {
|
|
@@ -56483,42 +56528,42 @@ function ResourceDiscoveryPage({
|
|
|
56483
56528
|
}
|
|
56484
56529
|
|
|
56485
56530
|
// src/features/resource-viewer/components/ResourceViewerPage.tsx
|
|
56486
|
-
import { useState as
|
|
56487
|
-
import { useQueryClient as
|
|
56531
|
+
import { useState as useState46, useEffect as useEffect50, useCallback as useCallback37, useMemo as useMemo14 } from "react";
|
|
56532
|
+
import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
56488
56533
|
import { resourceAnnotationUri as resourceAnnotationUri3 } from "@semiont/core";
|
|
56489
56534
|
import { getLanguage, getPrimaryRepresentation, getPrimaryMediaType as getPrimaryMediaType2 } from "@semiont/api-client";
|
|
56490
56535
|
import { uriToAnnotationId as uriToAnnotationId2 } from "@semiont/core";
|
|
56491
56536
|
|
|
56492
56537
|
// src/hooks/useBindFlow.ts
|
|
56493
|
-
import { useCallback as
|
|
56494
|
-
import { resourceAnnotationUri, accessToken as
|
|
56538
|
+
import { useCallback as useCallback34, useEffect as useEffect46, useRef as useRef33, useState as useState42 } from "react";
|
|
56539
|
+
import { resourceAnnotationUri, accessToken as accessToken4 } from "@semiont/core";
|
|
56495
56540
|
import { uriToAnnotationIdOrPassthrough } from "@semiont/core";
|
|
56496
56541
|
function toAccessToken2(token) {
|
|
56497
|
-
return token ?
|
|
56542
|
+
return token ? accessToken4(token) : void 0;
|
|
56498
56543
|
}
|
|
56499
56544
|
function useBindFlow(rUri) {
|
|
56500
56545
|
const eventBus = useEventBus();
|
|
56501
56546
|
const client = useApiClient();
|
|
56502
56547
|
const token = useAuthToken();
|
|
56503
56548
|
const { showError } = useToast();
|
|
56504
|
-
const [searchModalOpen, setSearchModalOpen] =
|
|
56505
|
-
const [pendingReferenceId, setPendingReferenceId] =
|
|
56506
|
-
const onCloseSearchModal =
|
|
56549
|
+
const [searchModalOpen, setSearchModalOpen] = useState42(false);
|
|
56550
|
+
const [pendingReferenceId, setPendingReferenceId] = useState42(null);
|
|
56551
|
+
const onCloseSearchModal = useCallback34(() => {
|
|
56507
56552
|
setSearchModalOpen(false);
|
|
56508
56553
|
}, []);
|
|
56509
|
-
const rUriRef =
|
|
56510
|
-
|
|
56554
|
+
const rUriRef = useRef33(rUri);
|
|
56555
|
+
useEffect46(() => {
|
|
56511
56556
|
rUriRef.current = rUri;
|
|
56512
56557
|
});
|
|
56513
|
-
const clientRef =
|
|
56514
|
-
|
|
56558
|
+
const clientRef = useRef33(client);
|
|
56559
|
+
useEffect46(() => {
|
|
56515
56560
|
clientRef.current = client;
|
|
56516
56561
|
});
|
|
56517
|
-
const tokenRef =
|
|
56518
|
-
|
|
56562
|
+
const tokenRef = useRef33(token);
|
|
56563
|
+
useEffect46(() => {
|
|
56519
56564
|
tokenRef.current = token;
|
|
56520
56565
|
});
|
|
56521
|
-
|
|
56566
|
+
useEffect46(() => {
|
|
56522
56567
|
const handleAnnotationUpdateBody = async (event) => {
|
|
56523
56568
|
try {
|
|
56524
56569
|
const annotationIdSegment = uriToAnnotationIdOrPassthrough(event.annotationUri);
|
|
@@ -56546,7 +56591,7 @@ function useBindFlow(rUri) {
|
|
|
56546
56591
|
subscription2.unsubscribe();
|
|
56547
56592
|
};
|
|
56548
56593
|
}, [eventBus]);
|
|
56549
|
-
|
|
56594
|
+
useEffect46(() => {
|
|
56550
56595
|
const handleResolutionSearchRequested = (event) => {
|
|
56551
56596
|
setPendingReferenceId(event.referenceId);
|
|
56552
56597
|
setSearchModalOpen(true);
|
|
@@ -56561,31 +56606,31 @@ function useBindFlow(rUri) {
|
|
|
56561
56606
|
}
|
|
56562
56607
|
|
|
56563
56608
|
// src/hooks/useMarkFlow.ts
|
|
56564
|
-
import { useState as
|
|
56565
|
-
import { resourceAnnotationUri as resourceAnnotationUri2, accessToken as
|
|
56609
|
+
import { useState as useState43, useRef as useRef34, useEffect as useEffect47, useCallback as useCallback35 } from "react";
|
|
56610
|
+
import { resourceAnnotationUri as resourceAnnotationUri2, accessToken as accessToken5, entityType as entityType2, annotationId } from "@semiont/core";
|
|
56566
56611
|
import { uriToAnnotationIdOrPassthrough as uriToAnnotationIdOrPassthrough2 } from "@semiont/core";
|
|
56567
56612
|
function toAccessToken3(token) {
|
|
56568
|
-
return token ?
|
|
56613
|
+
return token ? accessToken5(token) : void 0;
|
|
56569
56614
|
}
|
|
56570
56615
|
function useMarkFlow(rUri) {
|
|
56571
56616
|
const eventBus = useEventBus();
|
|
56572
56617
|
const client = useApiClient();
|
|
56573
56618
|
const token = useAuthToken();
|
|
56574
56619
|
const { showSuccess, showError, showInfo } = useToast();
|
|
56575
|
-
const clientRef =
|
|
56576
|
-
const rUriRef =
|
|
56577
|
-
const tokenRef =
|
|
56578
|
-
|
|
56620
|
+
const clientRef = useRef34(client);
|
|
56621
|
+
const rUriRef = useRef34(rUri);
|
|
56622
|
+
const tokenRef = useRef34(token);
|
|
56623
|
+
useEffect47(() => {
|
|
56579
56624
|
clientRef.current = client;
|
|
56580
56625
|
});
|
|
56581
|
-
|
|
56626
|
+
useEffect47(() => {
|
|
56582
56627
|
rUriRef.current = rUri;
|
|
56583
56628
|
});
|
|
56584
|
-
|
|
56629
|
+
useEffect47(() => {
|
|
56585
56630
|
tokenRef.current = token;
|
|
56586
56631
|
});
|
|
56587
|
-
const [pendingAnnotation, setPendingAnnotation] =
|
|
56588
|
-
const handleAnnotationRequested =
|
|
56632
|
+
const [pendingAnnotation, setPendingAnnotation] = useState43(null);
|
|
56633
|
+
const handleAnnotationRequested = useCallback35((pending) => {
|
|
56589
56634
|
const MOTIVATION_TO_TAB = {
|
|
56590
56635
|
highlighting: "annotations",
|
|
56591
56636
|
commenting: "annotations",
|
|
@@ -56604,7 +56649,7 @@ function useMarkFlow(rUri) {
|
|
|
56604
56649
|
eventBus.get("browse:panel-open").next({ panel: MOTIVATION_TO_TAB[pending.motivation] || "annotations" });
|
|
56605
56650
|
setPendingAnnotation(pending);
|
|
56606
56651
|
}, []);
|
|
56607
|
-
const selectionToSelector =
|
|
56652
|
+
const selectionToSelector = useCallback35((selection2) => {
|
|
56608
56653
|
if (selection2.svgSelector) {
|
|
56609
56654
|
return {
|
|
56610
56655
|
type: "SvgSelector",
|
|
@@ -56636,29 +56681,29 @@ function useMarkFlow(rUri) {
|
|
|
56636
56681
|
...selection2.suffix && { suffix: selection2.suffix }
|
|
56637
56682
|
};
|
|
56638
56683
|
}, []);
|
|
56639
|
-
const handleCommentRequested =
|
|
56684
|
+
const handleCommentRequested = useCallback35((selection2) => {
|
|
56640
56685
|
handleAnnotationRequested({ selector: selectionToSelector(selection2), motivation: "commenting" });
|
|
56641
56686
|
}, [handleAnnotationRequested, selectionToSelector]);
|
|
56642
|
-
const handleTagRequested =
|
|
56687
|
+
const handleTagRequested = useCallback35((selection2) => {
|
|
56643
56688
|
handleAnnotationRequested({ selector: selectionToSelector(selection2), motivation: "tagging" });
|
|
56644
56689
|
}, [handleAnnotationRequested, selectionToSelector]);
|
|
56645
|
-
const handleAssessmentRequested =
|
|
56690
|
+
const handleAssessmentRequested = useCallback35((selection2) => {
|
|
56646
56691
|
handleAnnotationRequested({ selector: selectionToSelector(selection2), motivation: "assessing" });
|
|
56647
56692
|
}, [handleAnnotationRequested, selectionToSelector]);
|
|
56648
|
-
const handleReferenceRequested =
|
|
56693
|
+
const handleReferenceRequested = useCallback35((selection2) => {
|
|
56649
56694
|
handleAnnotationRequested({ selector: selectionToSelector(selection2), motivation: "linking" });
|
|
56650
56695
|
}, [handleAnnotationRequested, selectionToSelector]);
|
|
56651
|
-
const handleAnnotationCancelPending =
|
|
56696
|
+
const handleAnnotationCancelPending = useCallback35(() => {
|
|
56652
56697
|
setPendingAnnotation(null);
|
|
56653
56698
|
}, []);
|
|
56654
|
-
const [assistingMotivation, setAssistingMotivation] =
|
|
56655
|
-
const [progress, setProgress] =
|
|
56656
|
-
const assistStreamRef =
|
|
56657
|
-
const progressDismissTimeoutRef =
|
|
56658
|
-
const handleMarkProgress =
|
|
56699
|
+
const [assistingMotivation, setAssistingMotivation] = useState43(null);
|
|
56700
|
+
const [progress, setProgress] = useState43(null);
|
|
56701
|
+
const assistStreamRef = useRef34(null);
|
|
56702
|
+
const progressDismissTimeoutRef = useRef34(null);
|
|
56703
|
+
const handleMarkProgress = useCallback35((chunk) => {
|
|
56659
56704
|
setProgress(chunk);
|
|
56660
56705
|
}, []);
|
|
56661
|
-
const handleAnnotationComplete =
|
|
56706
|
+
const handleAnnotationComplete = useCallback35((event) => {
|
|
56662
56707
|
setAssistingMotivation((prev) => {
|
|
56663
56708
|
if (!event.motivation || event.motivation !== prev) return prev;
|
|
56664
56709
|
return null;
|
|
@@ -56672,7 +56717,7 @@ function useMarkFlow(rUri) {
|
|
|
56672
56717
|
progressDismissTimeoutRef.current = null;
|
|
56673
56718
|
}, 5e3);
|
|
56674
56719
|
}, [showSuccess]);
|
|
56675
|
-
const handleAnnotationFailed =
|
|
56720
|
+
const handleAnnotationFailed = useCallback35((event) => {
|
|
56676
56721
|
if (progressDismissTimeoutRef.current) {
|
|
56677
56722
|
clearTimeout(progressDismissTimeoutRef.current);
|
|
56678
56723
|
progressDismissTimeoutRef.current = null;
|
|
@@ -56682,15 +56727,15 @@ function useMarkFlow(rUri) {
|
|
|
56682
56727
|
const errorMessage = event.payload.error || "Annotation failed";
|
|
56683
56728
|
showError(errorMessage);
|
|
56684
56729
|
}, [showError]);
|
|
56685
|
-
const handleProgressDismiss =
|
|
56730
|
+
const handleProgressDismiss = useCallback35(() => {
|
|
56686
56731
|
if (progressDismissTimeoutRef.current) {
|
|
56687
56732
|
clearTimeout(progressDismissTimeoutRef.current);
|
|
56688
56733
|
progressDismissTimeoutRef.current = null;
|
|
56689
56734
|
}
|
|
56690
56735
|
setProgress(null);
|
|
56691
56736
|
}, []);
|
|
56692
|
-
|
|
56693
|
-
const
|
|
56737
|
+
useEffect47(() => {
|
|
56738
|
+
const handleAnnotationSubmit = async (event) => {
|
|
56694
56739
|
const currentClient = clientRef.current;
|
|
56695
56740
|
const currentRUri = rUriRef.current;
|
|
56696
56741
|
if (!currentClient || !currentRUri) return;
|
|
@@ -56703,10 +56748,9 @@ function useMarkFlow(rUri) {
|
|
|
56703
56748
|
},
|
|
56704
56749
|
body: event.body
|
|
56705
56750
|
}, { auth: toAccessToken3(tokenRef.current) });
|
|
56706
|
-
|
|
56707
|
-
|
|
56708
|
-
|
|
56709
|
-
}
|
|
56751
|
+
setPendingAnnotation(null);
|
|
56752
|
+
const idSegment = uriToAnnotationIdOrPassthrough2(result.annotationId);
|
|
56753
|
+
eventBus.get("mark:created").next({ annotationId: annotationId(idSegment) });
|
|
56710
56754
|
} catch (error) {
|
|
56711
56755
|
console.error("Failed to create annotation:", error);
|
|
56712
56756
|
eventBus.get("mark:create-failed").next({ error });
|
|
@@ -56789,7 +56833,7 @@ function useMarkFlow(rUri) {
|
|
|
56789
56833
|
assistStreamRef.current = null;
|
|
56790
56834
|
}
|
|
56791
56835
|
};
|
|
56792
|
-
const subscription1 = eventBus.get("mark:
|
|
56836
|
+
const subscription1 = eventBus.get("mark:submit").subscribe(handleAnnotationSubmit);
|
|
56793
56837
|
const subscription2 = eventBus.get("mark:delete").subscribe(handleAnnotationDelete);
|
|
56794
56838
|
const subscription3 = eventBus.get("mark:assist-request").subscribe(handleAssistStart);
|
|
56795
56839
|
const subscription4 = eventBus.get("job:cancel-requested").subscribe(handleJobCancelRequested);
|
|
@@ -56819,7 +56863,7 @@ function useMarkFlow(rUri) {
|
|
|
56819
56863
|
"mark:create-failed": ({ error }) => showError(`Failed to create annotation: ${error.message}`),
|
|
56820
56864
|
"mark:delete-failed": ({ error }) => showError(`Failed to delete annotation: ${error.message}`)
|
|
56821
56865
|
});
|
|
56822
|
-
|
|
56866
|
+
useEffect47(() => {
|
|
56823
56867
|
return () => {
|
|
56824
56868
|
if (progressDismissTimeoutRef.current) {
|
|
56825
56869
|
clearTimeout(progressDismissTimeoutRef.current);
|
|
@@ -56835,38 +56879,38 @@ function useMarkFlow(rUri) {
|
|
|
56835
56879
|
}
|
|
56836
56880
|
|
|
56837
56881
|
// src/hooks/useYieldFlow.ts
|
|
56838
|
-
import { useState as
|
|
56839
|
-
import { annotationUri, accessToken as
|
|
56882
|
+
import { useState as useState44, useCallback as useCallback36, useEffect as useEffect48, useRef as useRef35 } from "react";
|
|
56883
|
+
import { annotationUri, accessToken as accessToken6 } from "@semiont/core";
|
|
56840
56884
|
function toAccessToken4(token) {
|
|
56841
|
-
return token ?
|
|
56885
|
+
return token ? accessToken6(token) : void 0;
|
|
56842
56886
|
}
|
|
56843
56887
|
function useYieldFlow(locale, resourceId, clearNewAnnotationId) {
|
|
56844
56888
|
const eventBus = useEventBus();
|
|
56845
56889
|
const client = useApiClient();
|
|
56846
56890
|
const token = useAuthToken();
|
|
56847
56891
|
const { showSuccess, showError } = useToast();
|
|
56848
|
-
const clientRef =
|
|
56849
|
-
const tokenRef =
|
|
56850
|
-
|
|
56892
|
+
const clientRef = useRef35(client);
|
|
56893
|
+
const tokenRef = useRef35(token);
|
|
56894
|
+
useEffect48(() => {
|
|
56851
56895
|
clientRef.current = client;
|
|
56852
56896
|
});
|
|
56853
|
-
|
|
56897
|
+
useEffect48(() => {
|
|
56854
56898
|
tokenRef.current = token;
|
|
56855
56899
|
});
|
|
56856
|
-
const generationStreamRef =
|
|
56857
|
-
const [isGenerating, setIsGenerating] =
|
|
56858
|
-
const [generationProgress, setYieldProgress] =
|
|
56859
|
-
const handleProgressEvent =
|
|
56900
|
+
const generationStreamRef = useRef35(null);
|
|
56901
|
+
const [isGenerating, setIsGenerating] = useState44(false);
|
|
56902
|
+
const [generationProgress, setYieldProgress] = useState44(null);
|
|
56903
|
+
const handleProgressEvent = useCallback36((chunk) => {
|
|
56860
56904
|
setYieldProgress(chunk);
|
|
56861
56905
|
setIsGenerating(true);
|
|
56862
56906
|
}, []);
|
|
56863
|
-
const clearProgress =
|
|
56907
|
+
const clearProgress = useCallback36(() => {
|
|
56864
56908
|
setYieldProgress(null);
|
|
56865
56909
|
}, []);
|
|
56866
|
-
const [generationModalOpen, setGenerationModalOpen] =
|
|
56867
|
-
const [generationReferenceId, setGenerationReferenceId] =
|
|
56868
|
-
const [generationDefaultTitle, setGenerationDefaultTitle] =
|
|
56869
|
-
const handleGenerateDocument =
|
|
56910
|
+
const [generationModalOpen, setGenerationModalOpen] = useState44(false);
|
|
56911
|
+
const [generationReferenceId, setGenerationReferenceId] = useState44(null);
|
|
56912
|
+
const [generationDefaultTitle, setGenerationDefaultTitle] = useState44("");
|
|
56913
|
+
const handleGenerateDocument = useCallback36((referenceId, options) => {
|
|
56870
56914
|
if (!options.context) {
|
|
56871
56915
|
setGenerationReferenceId(referenceId);
|
|
56872
56916
|
setGenerationDefaultTitle(options.title);
|
|
@@ -56887,16 +56931,16 @@ function useYieldFlow(locale, resourceId, clearNewAnnotationId) {
|
|
|
56887
56931
|
}
|
|
56888
56932
|
});
|
|
56889
56933
|
}, [resourceId, clearNewAnnotationId, locale]);
|
|
56890
|
-
const handleCloseGenerationModal =
|
|
56934
|
+
const handleCloseGenerationModal = useCallback36(() => {
|
|
56891
56935
|
setGenerationModalOpen(false);
|
|
56892
56936
|
}, []);
|
|
56893
|
-
const handleGenerationModalOpen =
|
|
56937
|
+
const handleGenerationModalOpen = useCallback36(({ annotationUri: annUri, resourceUri: resourceUri2, defaultTitle }) => {
|
|
56894
56938
|
setGenerationReferenceId(annUri);
|
|
56895
56939
|
setGenerationDefaultTitle(defaultTitle);
|
|
56896
56940
|
setGenerationModalOpen(true);
|
|
56897
56941
|
eventBus.get("gather:requested").next({ annotationUri: annUri, resourceUri: resourceUri2 });
|
|
56898
56942
|
}, []);
|
|
56899
|
-
const handleGenerationComplete =
|
|
56943
|
+
const handleGenerationComplete = useCallback36((progress) => {
|
|
56900
56944
|
setYieldProgress(progress);
|
|
56901
56945
|
setIsGenerating(false);
|
|
56902
56946
|
if (progress.resourceName) {
|
|
@@ -56906,12 +56950,12 @@ function useYieldFlow(locale, resourceId, clearNewAnnotationId) {
|
|
|
56906
56950
|
}
|
|
56907
56951
|
setTimeout(() => clearProgress(), 2e3);
|
|
56908
56952
|
}, [showSuccess, clearProgress]);
|
|
56909
|
-
const handleGenerationFailed =
|
|
56953
|
+
const handleGenerationFailed = useCallback36(({ error }) => {
|
|
56910
56954
|
setYieldProgress(null);
|
|
56911
56955
|
setIsGenerating(false);
|
|
56912
56956
|
showError(`Resource generation failed: ${error.message}`);
|
|
56913
56957
|
}, [showError]);
|
|
56914
|
-
|
|
56958
|
+
useEffect48(() => {
|
|
56915
56959
|
const handleGenerationStart = async (event) => {
|
|
56916
56960
|
try {
|
|
56917
56961
|
generationStreamRef.current?.abort();
|
|
@@ -56974,26 +57018,26 @@ function useYieldFlow(locale, resourceId, clearNewAnnotationId) {
|
|
|
56974
57018
|
}
|
|
56975
57019
|
|
|
56976
57020
|
// src/hooks/useContextGatherFlow.ts
|
|
56977
|
-
import { useState as
|
|
56978
|
-
import { accessToken as
|
|
57021
|
+
import { useState as useState45, useEffect as useEffect49, useRef as useRef36 } from "react";
|
|
57022
|
+
import { accessToken as accessToken7 } from "@semiont/core";
|
|
56979
57023
|
function toAccessToken5(token) {
|
|
56980
|
-
return token ?
|
|
57024
|
+
return token ? accessToken7(token) : void 0;
|
|
56981
57025
|
}
|
|
56982
57026
|
function useContextGatherFlow(eventBus, config) {
|
|
56983
57027
|
const token = useAuthToken();
|
|
56984
|
-
const [gatherContext, setCorrelationContext] =
|
|
56985
|
-
const [gatherLoading, setCorrelationLoading] =
|
|
56986
|
-
const [gatherError, setCorrelationError] =
|
|
56987
|
-
const [gatherAnnotationUri, setCorrelationAnnotationUri] =
|
|
56988
|
-
const configRef =
|
|
56989
|
-
const tokenRef =
|
|
56990
|
-
|
|
57028
|
+
const [gatherContext, setCorrelationContext] = useState45(null);
|
|
57029
|
+
const [gatherLoading, setCorrelationLoading] = useState45(false);
|
|
57030
|
+
const [gatherError, setCorrelationError] = useState45(null);
|
|
57031
|
+
const [gatherAnnotationUri, setCorrelationAnnotationUri] = useState45(null);
|
|
57032
|
+
const configRef = useRef36(config);
|
|
57033
|
+
const tokenRef = useRef36(token);
|
|
57034
|
+
useEffect49(() => {
|
|
56991
57035
|
configRef.current = config;
|
|
56992
57036
|
});
|
|
56993
|
-
|
|
57037
|
+
useEffect49(() => {
|
|
56994
57038
|
tokenRef.current = token;
|
|
56995
57039
|
});
|
|
56996
|
-
|
|
57040
|
+
useEffect49(() => {
|
|
56997
57041
|
const handleGatherRequested = async (event) => {
|
|
56998
57042
|
setCorrelationLoading(true);
|
|
56999
57043
|
setCorrelationError(null);
|
|
@@ -57001,21 +57045,19 @@ function useContextGatherFlow(eventBus, config) {
|
|
|
57001
57045
|
setCorrelationAnnotationUri(event.annotationUri);
|
|
57002
57046
|
try {
|
|
57003
57047
|
const { client } = configRef.current;
|
|
57004
|
-
const
|
|
57048
|
+
const annotationId2 = event.annotationUri.split("/").pop() || "";
|
|
57005
57049
|
const response = await client.getAnnotationLLMContext(
|
|
57006
57050
|
event.resourceUri,
|
|
57007
|
-
|
|
57051
|
+
annotationId2,
|
|
57008
57052
|
{ contextWindow: 2e3, auth: toAccessToken5(tokenRef.current) }
|
|
57009
57053
|
);
|
|
57010
57054
|
const context = response.context ?? null;
|
|
57011
57055
|
setCorrelationContext(context);
|
|
57012
57056
|
setCorrelationLoading(false);
|
|
57013
|
-
|
|
57014
|
-
|
|
57015
|
-
|
|
57016
|
-
|
|
57017
|
-
});
|
|
57018
|
-
}
|
|
57057
|
+
eventBus.get("gather:complete").next({
|
|
57058
|
+
annotationUri: event.annotationUri,
|
|
57059
|
+
response
|
|
57060
|
+
});
|
|
57019
57061
|
} catch (error) {
|
|
57020
57062
|
const err = error;
|
|
57021
57063
|
setCorrelationError(err);
|
|
@@ -57047,7 +57089,7 @@ function ResourceViewerPage({
|
|
|
57047
57089
|
}) {
|
|
57048
57090
|
const eventBus = useEventBus();
|
|
57049
57091
|
const client = useApiClient();
|
|
57050
|
-
const queryClient =
|
|
57092
|
+
const queryClient = useQueryClient3();
|
|
57051
57093
|
const { showError, showSuccess } = useToast();
|
|
57052
57094
|
const { theme: theme2, setTheme } = useTheme();
|
|
57053
57095
|
const { showLineNumbers, toggleLineNumbers } = useLineNumbers();
|
|
@@ -57086,7 +57128,7 @@ function ResourceViewerPage({
|
|
|
57086
57128
|
},
|
|
57087
57129
|
500
|
|
57088
57130
|
);
|
|
57089
|
-
|
|
57131
|
+
useEffect50(() => {
|
|
57090
57132
|
if (resource && rUri) {
|
|
57091
57133
|
const resourceIdSegment = rUri.split("/").pop() || "";
|
|
57092
57134
|
const mediaType = getPrimaryMediaType2(resource);
|
|
@@ -57100,13 +57142,13 @@ function ResourceViewerPage({
|
|
|
57100
57142
|
rUri,
|
|
57101
57143
|
autoConnect: true,
|
|
57102
57144
|
// Annotation events - use debounced invalidation to batch rapid updates
|
|
57103
|
-
onAnnotationAdded:
|
|
57145
|
+
onAnnotationAdded: useCallback37((_event) => {
|
|
57104
57146
|
debouncedInvalidateAnnotations();
|
|
57105
57147
|
}, [debouncedInvalidateAnnotations]),
|
|
57106
|
-
onAnnotationRemoved:
|
|
57148
|
+
onAnnotationRemoved: useCallback37((_event) => {
|
|
57107
57149
|
debouncedInvalidateAnnotations();
|
|
57108
57150
|
}, [debouncedInvalidateAnnotations]),
|
|
57109
|
-
onAnnotationBodyUpdated:
|
|
57151
|
+
onAnnotationBodyUpdated: useCallback37((event) => {
|
|
57110
57152
|
queryClient.setQueryData(QUERY_KEYS.resources.annotations(rUri), (old) => {
|
|
57111
57153
|
if (!old) return old;
|
|
57112
57154
|
return {
|
|
@@ -57143,32 +57185,32 @@ function ResourceViewerPage({
|
|
|
57143
57185
|
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.events(rUri) });
|
|
57144
57186
|
}, [queryClient, rUri]),
|
|
57145
57187
|
// Document status events
|
|
57146
|
-
onDocumentArchived:
|
|
57188
|
+
onDocumentArchived: useCallback37((_event) => {
|
|
57147
57189
|
refetchDocument();
|
|
57148
57190
|
showSuccess("This document has been archived");
|
|
57149
57191
|
debouncedInvalidateAnnotations();
|
|
57150
57192
|
}, [refetchDocument, showSuccess, debouncedInvalidateAnnotations]),
|
|
57151
|
-
onDocumentUnarchived:
|
|
57193
|
+
onDocumentUnarchived: useCallback37((_event) => {
|
|
57152
57194
|
refetchDocument();
|
|
57153
57195
|
showSuccess("This document has been unarchived");
|
|
57154
57196
|
debouncedInvalidateAnnotations();
|
|
57155
57197
|
}, [refetchDocument, showSuccess, debouncedInvalidateAnnotations]),
|
|
57156
57198
|
// Entity tag events
|
|
57157
|
-
onEntityTagAdded:
|
|
57199
|
+
onEntityTagAdded: useCallback37((_event) => {
|
|
57158
57200
|
refetchDocument();
|
|
57159
57201
|
debouncedInvalidateAnnotations();
|
|
57160
57202
|
}, [refetchDocument, debouncedInvalidateAnnotations]),
|
|
57161
|
-
onEntityTagRemoved:
|
|
57203
|
+
onEntityTagRemoved: useCallback37((_event) => {
|
|
57162
57204
|
refetchDocument();
|
|
57163
57205
|
debouncedInvalidateAnnotations();
|
|
57164
57206
|
}, [refetchDocument, debouncedInvalidateAnnotations]),
|
|
57165
|
-
onError:
|
|
57207
|
+
onError: useCallback37((error) => {
|
|
57166
57208
|
console.error("[RealTime] Event stream error:", error);
|
|
57167
57209
|
}, [])
|
|
57168
57210
|
});
|
|
57169
57211
|
const updateMutation = resources.update.useMutation();
|
|
57170
57212
|
const generateCloneTokenMutation = resources.generateCloneToken.useMutation();
|
|
57171
|
-
const handleResourceArchive =
|
|
57213
|
+
const handleResourceArchive = useCallback37(async () => {
|
|
57172
57214
|
try {
|
|
57173
57215
|
await updateMutation.mutateAsync({ rUri, data: { archived: true } });
|
|
57174
57216
|
await refetchDocument();
|
|
@@ -57177,7 +57219,7 @@ function ResourceViewerPage({
|
|
|
57177
57219
|
showError("Failed to archive document");
|
|
57178
57220
|
}
|
|
57179
57221
|
}, [updateMutation, rUri, refetchDocument, showError]);
|
|
57180
|
-
const handleResourceUnarchive =
|
|
57222
|
+
const handleResourceUnarchive = useCallback37(async () => {
|
|
57181
57223
|
try {
|
|
57182
57224
|
await updateMutation.mutateAsync({ rUri, data: { archived: false } });
|
|
57183
57225
|
await refetchDocument();
|
|
@@ -57186,7 +57228,7 @@ function ResourceViewerPage({
|
|
|
57186
57228
|
showError("Failed to unarchive document");
|
|
57187
57229
|
}
|
|
57188
57230
|
}, [updateMutation, rUri, refetchDocument, showError]);
|
|
57189
|
-
const handleResourceClone =
|
|
57231
|
+
const handleResourceClone = useCallback37(async () => {
|
|
57190
57232
|
try {
|
|
57191
57233
|
const result = await generateCloneTokenMutation.mutateAsync(rUri);
|
|
57192
57234
|
const token = result.token;
|
|
@@ -57196,44 +57238,48 @@ function ResourceViewerPage({
|
|
|
57196
57238
|
showError("Failed to generate clone link");
|
|
57197
57239
|
}
|
|
57198
57240
|
}, [generateCloneTokenMutation, rUri, showError]);
|
|
57199
|
-
const handleAnnotationSparkle =
|
|
57200
|
-
triggerSparkleAnimation(
|
|
57241
|
+
const handleAnnotationSparkle = useCallback37(({ annotationId: annotationId2 }) => {
|
|
57242
|
+
triggerSparkleAnimation(annotationId2);
|
|
57201
57243
|
}, [triggerSparkleAnimation]);
|
|
57202
|
-
const handleAnnotationAdded =
|
|
57244
|
+
const handleAnnotationAdded = useCallback37((event) => {
|
|
57203
57245
|
triggerSparkleAnimation(event.payload.annotation.id);
|
|
57204
57246
|
debouncedInvalidateAnnotations();
|
|
57205
57247
|
}, [triggerSparkleAnimation, debouncedInvalidateAnnotations]);
|
|
57206
|
-
const handleAnnotationCreateFailed =
|
|
57207
|
-
const handleAnnotationDeleteFailed =
|
|
57208
|
-
const handleAnnotateBodyUpdated =
|
|
57248
|
+
const handleAnnotationCreateFailed = useCallback37(() => showError("Failed to create annotation"), [showError]);
|
|
57249
|
+
const handleAnnotationDeleteFailed = useCallback37(() => showError("Failed to delete annotation"), [showError]);
|
|
57250
|
+
const handleAnnotateBodyUpdated = useCallback37(() => {
|
|
57209
57251
|
}, []);
|
|
57210
|
-
const handleAnnotateBodyUpdateFailed =
|
|
57211
|
-
const handleSettingsThemeChanged =
|
|
57212
|
-
const handleDetectionComplete =
|
|
57252
|
+
const handleAnnotateBodyUpdateFailed = useCallback37(() => showError("Failed to update annotation"), [showError]);
|
|
57253
|
+
const handleSettingsThemeChanged = useCallback37(({ theme: theme3 }) => setTheme(theme3), [setTheme]);
|
|
57254
|
+
const handleDetectionComplete = useCallback37(() => {
|
|
57213
57255
|
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.annotations(rUri) });
|
|
57214
57256
|
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.events(rUri) });
|
|
57215
57257
|
}, [queryClient, rUri]);
|
|
57216
|
-
const handleDetectionFailed =
|
|
57258
|
+
const handleDetectionFailed = useCallback37(() => {
|
|
57217
57259
|
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.annotations(rUri) });
|
|
57218
57260
|
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.events(rUri) });
|
|
57219
57261
|
}, [queryClient, rUri]);
|
|
57220
|
-
const handleGenerationComplete =
|
|
57262
|
+
const handleGenerationComplete = useCallback37(() => {
|
|
57221
57263
|
}, []);
|
|
57222
|
-
const handleGenerationFailed =
|
|
57264
|
+
const handleGenerationFailed = useCallback37(() => {
|
|
57223
57265
|
}, []);
|
|
57224
|
-
const handleReferenceNavigate =
|
|
57266
|
+
const handleReferenceNavigate = useCallback37(({ documentId }) => {
|
|
57225
57267
|
if (routes.resource) {
|
|
57226
57268
|
const path2 = routes.resource.replace("[resourceId]", encodeURIComponent(documentId));
|
|
57227
57269
|
eventBus.get("browse:router-push").next({ path: path2, reason: "reference-link" });
|
|
57228
57270
|
}
|
|
57229
57271
|
}, [routes.resource]);
|
|
57230
|
-
const handleEntityTypeClicked =
|
|
57272
|
+
const handleEntityTypeClicked = useCallback37(({ entityType: entityType3 }) => {
|
|
57231
57273
|
if (routes.know) {
|
|
57232
57274
|
const path2 = `${routes.know}?entityType=${encodeURIComponent(entityType3)}`;
|
|
57233
57275
|
eventBus.get("browse:router-push").next({ path: path2, reason: "entity-type-filter" });
|
|
57234
57276
|
}
|
|
57235
57277
|
}, [routes.know]);
|
|
57278
|
+
const handleModeToggled = useCallback37(() => {
|
|
57279
|
+
setAnnotateMode((prev) => !prev);
|
|
57280
|
+
}, []);
|
|
57236
57281
|
useEventSubscriptions({
|
|
57282
|
+
"mark:mode-toggled": handleModeToggled,
|
|
57237
57283
|
"mark:archive": handleResourceArchive,
|
|
57238
57284
|
"mark:unarchive": handleResourceUnarchive,
|
|
57239
57285
|
"yield:clone": handleResourceClone,
|
|
@@ -57257,7 +57303,7 @@ function ResourceViewerPage({
|
|
|
57257
57303
|
announceResourceLoading,
|
|
57258
57304
|
announceResourceLoaded
|
|
57259
57305
|
} = useResourceLoadingAnnouncements();
|
|
57260
|
-
|
|
57306
|
+
useEffect50(() => {
|
|
57261
57307
|
if (contentLoading) {
|
|
57262
57308
|
announceResourceLoading(resource.name);
|
|
57263
57309
|
} else if (content4) {
|
|
@@ -57268,7 +57314,7 @@ function ResourceViewerPage({
|
|
|
57268
57314
|
const primaryRep = getPrimaryRepresentation(resource);
|
|
57269
57315
|
const primaryMediaType = primaryRep?.mediaType;
|
|
57270
57316
|
const primaryByteSize = primaryRep?.byteSize;
|
|
57271
|
-
const [annotateMode,
|
|
57317
|
+
const [annotateMode, setAnnotateMode] = useState46(() => {
|
|
57272
57318
|
if (typeof window !== "undefined") {
|
|
57273
57319
|
return localStorage.getItem("annotateMode") === "true";
|
|
57274
57320
|
}
|
|
@@ -57294,12 +57340,12 @@ function ResourceViewerPage({
|
|
|
57294
57340
|
return result;
|
|
57295
57341
|
}, [annotations]);
|
|
57296
57342
|
const resourceWithContent = { ...resource, content: content4 };
|
|
57297
|
-
const handleEventHover =
|
|
57298
|
-
if (
|
|
57299
|
-
eventBus.get("beckon:sparkle").next({ annotationId });
|
|
57343
|
+
const handleEventHover = useCallback37((annotationId2) => {
|
|
57344
|
+
if (annotationId2) {
|
|
57345
|
+
eventBus.get("beckon:sparkle").next({ annotationId: annotationId2 });
|
|
57300
57346
|
}
|
|
57301
57347
|
}, []);
|
|
57302
|
-
const handleEventClick =
|
|
57348
|
+
const handleEventClick = useCallback37((_annotationId) => {
|
|
57303
57349
|
}, []);
|
|
57304
57350
|
return /* @__PURE__ */ jsxs67("div", { className: `semiont-document-viewer${activePanel ? " semiont-document-viewer--panel-open" : ""}`, children: [
|
|
57305
57351
|
/* @__PURE__ */ jsxs67("div", { className: "semiont-document-viewer__main", children: [
|
|
@@ -57622,6 +57668,7 @@ export {
|
|
|
57622
57668
|
useEventSubscription,
|
|
57623
57669
|
useEventSubscriptions,
|
|
57624
57670
|
useFormAnnouncements,
|
|
57671
|
+
useGlobalEvents,
|
|
57625
57672
|
useHealth,
|
|
57626
57673
|
useHoverDelay,
|
|
57627
57674
|
useHoverEmitter,
|