@semiont/react-ui 0.2.34-build.91 → 0.2.34-build.92
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/{EventBusContext-BmzEcGHZ.d.mts → EventBusContext-DMI4uwYk.d.mts} +2 -2
- package/dist/{PdfAnnotationCanvas.client-VLNA5O5M.mjs → PdfAnnotationCanvas.client-HNYRKFDS.mjs} +10 -9
- package/dist/PdfAnnotationCanvas.client-HNYRKFDS.mjs.map +1 -0
- package/dist/{ar-4ZEORRW2.mjs → ar-MDB7HC5S.mjs} +45 -49
- package/dist/ar-MDB7HC5S.mjs.map +1 -0
- package/dist/{bn-SEDE5BQJ.mjs → bn-3SAV2ZEM.mjs} +45 -49
- package/dist/bn-3SAV2ZEM.mjs.map +1 -0
- package/dist/{chunk-C63BARI7.mjs → chunk-3FIQXKQF.mjs} +31 -31
- package/dist/{chunk-D7NBW4RV.mjs → chunk-JH7BXE2P.mjs} +45 -49
- package/dist/chunk-JH7BXE2P.mjs.map +1 -0
- package/dist/{chunk-M7SZRRIE.mjs → chunk-MWQ5CNKW.mjs} +13 -13
- package/dist/chunk-MWQ5CNKW.mjs.map +1 -0
- package/dist/{chunk-ULIET3MW.mjs → chunk-YI5IX5ZA.mjs} +1 -1
- package/dist/{chunk-ULIET3MW.mjs.map → chunk-YI5IX5ZA.mjs.map} +1 -1
- package/dist/{cs-7W4WF5WD.mjs → cs-AWCETEUV.mjs} +45 -49
- package/dist/cs-AWCETEUV.mjs.map +1 -0
- package/dist/{da-75XGBCBK.mjs → da-UZZHXYLC.mjs} +45 -49
- package/dist/da-UZZHXYLC.mjs.map +1 -0
- package/dist/{de-ODJVFLHM.mjs → de-LQFWN6S5.mjs} +45 -49
- package/dist/de-LQFWN6S5.mjs.map +1 -0
- package/dist/{el-C4PM4WB3.mjs → el-IWOETBJ7.mjs} +45 -49
- package/dist/el-IWOETBJ7.mjs.map +1 -0
- package/dist/{en-KJCJQ4OO.mjs → en-XWEPVTB4.mjs} +2 -6
- package/dist/{es-WD33R7QL.mjs → es-726NTS53.mjs} +45 -49
- package/dist/es-726NTS53.mjs.map +1 -0
- package/dist/{fa-2BP6V56P.mjs → fa-BVEJZT5S.mjs} +45 -49
- package/dist/fa-BVEJZT5S.mjs.map +1 -0
- package/dist/{fi-USRRW24J.mjs → fi-JBNCGGA6.mjs} +45 -49
- package/dist/fi-JBNCGGA6.mjs.map +1 -0
- package/dist/{fr-EC5S6WVF.mjs → fr-OLH7PNGI.mjs} +45 -49
- package/dist/fr-OLH7PNGI.mjs.map +1 -0
- package/dist/{he-7TBVIKAA.mjs → he-KOJQ4HMA.mjs} +45 -49
- package/dist/he-KOJQ4HMA.mjs.map +1 -0
- package/dist/{hi-FO4VIZLA.mjs → hi-BKJFZXAY.mjs} +45 -49
- package/dist/hi-BKJFZXAY.mjs.map +1 -0
- package/dist/{id-7U7GGVWY.mjs → id-DPLHJVNP.mjs} +45 -49
- package/dist/id-DPLHJVNP.mjs.map +1 -0
- package/dist/index.css +80 -80
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +215 -201
- package/dist/index.mjs +810 -748
- package/dist/index.mjs.map +1 -1
- package/dist/{it-Y4OPL6I2.mjs → it-JXHAM7NL.mjs} +45 -49
- package/dist/it-JXHAM7NL.mjs.map +1 -0
- package/dist/{ja-PK7SQL55.mjs → ja-DQRAO3PU.mjs} +45 -49
- package/dist/ja-DQRAO3PU.mjs.map +1 -0
- package/dist/{ko-L25PXMYD.mjs → ko-6IFCOP6F.mjs} +45 -49
- package/dist/ko-6IFCOP6F.mjs.map +1 -0
- package/dist/{ms-STH777QM.mjs → ms-KF5S2TLL.mjs} +45 -49
- package/dist/ms-KF5S2TLL.mjs.map +1 -0
- package/dist/{nl-Y7LECDDR.mjs → nl-2GUUZLQM.mjs} +45 -49
- package/dist/nl-2GUUZLQM.mjs.map +1 -0
- package/dist/{no-KEKCEWU6.mjs → no-2IBCZGEF.mjs} +45 -49
- package/dist/no-2IBCZGEF.mjs.map +1 -0
- package/dist/{pl-7A7OC75O.mjs → pl-ZEUBJ7YU.mjs} +45 -49
- package/dist/pl-ZEUBJ7YU.mjs.map +1 -0
- package/dist/{pt-35HTM7RA.mjs → pt-WLAFIZWQ.mjs} +45 -49
- package/dist/pt-WLAFIZWQ.mjs.map +1 -0
- package/dist/{ro-VAWL5KQA.mjs → ro-K56IXFGU.mjs} +45 -49
- package/dist/ro-K56IXFGU.mjs.map +1 -0
- package/dist/{sv-7ZK5EQEB.mjs → sv-VFJLMJRY.mjs} +45 -49
- package/dist/sv-VFJLMJRY.mjs.map +1 -0
- package/dist/test-utils.d.mts +2 -2
- package/dist/test-utils.mjs +3 -3
- package/dist/{th-UDWZ4X34.mjs → th-RICLQ2GW.mjs} +45 -49
- package/dist/th-RICLQ2GW.mjs.map +1 -0
- package/dist/{tr-4WMPK3UX.mjs → tr-SALXWE2M.mjs} +45 -49
- package/dist/tr-SALXWE2M.mjs.map +1 -0
- package/dist/{uk-SSLASQYJ.mjs → uk-3U3T3O2E.mjs} +45 -49
- package/dist/uk-3U3T3O2E.mjs.map +1 -0
- package/dist/{vi-IF42Z5PU.mjs → vi-LIVNZXOB.mjs} +45 -49
- package/dist/vi-LIVNZXOB.mjs.map +1 -0
- package/dist/{zh-HRQTNTAI.mjs → zh-KDUAZPX3.mjs} +45 -49
- package/dist/zh-KDUAZPX3.mjs.map +1 -0
- package/package.json +1 -1
- package/src/components/AnnotateReferencesProgressWidget.tsx +113 -0
- package/src/components/CodeMirrorRenderer.tsx +9 -27
- package/src/components/Toolbar.tsx +2 -2
- package/src/components/annotation/AnnotateToolbar.tsx +9 -9
- package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +17 -17
- package/src/components/image-annotation/AnnotationOverlay.tsx +13 -11
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +8 -4
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +11 -9
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +1 -1
- package/src/components/resource/AnnotateView.tsx +17 -12
- package/src/components/resource/BrowseView.tsx +19 -50
- package/src/components/resource/ResourceViewer.tsx +28 -24
- package/src/components/resource/__tests__/BrowseView.test.tsx +27 -27
- package/src/components/resource/panels/AssessmentEntry.tsx +1 -1
- package/src/components/resource/panels/AssessmentPanel.tsx +16 -16
- package/src/components/resource/panels/{DetectSection.css → AssistSection.css} +79 -79
- package/src/components/resource/panels/{DetectSection.tsx → AssistSection.tsx} +46 -46
- package/src/components/resource/panels/CommentEntry.tsx +1 -1
- package/src/components/resource/panels/CommentsPanel.tsx +16 -16
- package/src/components/resource/panels/HighlightEntry.tsx +1 -1
- package/src/components/resource/panels/HighlightPanel.tsx +14 -14
- package/src/components/resource/panels/ReferenceEntry.tsx +5 -5
- package/src/components/resource/panels/ReferencesPanel.tsx +90 -103
- package/src/components/resource/panels/ResourceInfoPanel.tsx +2 -2
- package/src/components/resource/panels/TagEntry.tsx +1 -1
- package/src/components/resource/panels/TaggingPanel.tsx +53 -53
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +12 -20
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +12 -12
- package/src/components/resource/panels/__tests__/{DetectSection.test.tsx → AssistSection.test.tsx} +109 -108
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +8 -8
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +3 -3
- package/src/components/resource/panels/__tests__/{HighlightPanel.detectionProgress.test.tsx → HighlightPanel.annotationProgress.test.tsx} +56 -56
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +98 -95
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +3 -3
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +16 -16
- package/src/components/settings/SettingsPanel.tsx +29 -1
- package/src/features/resource-compose/components/ResourceComposePage.tsx +3 -0
- package/src/features/resource-viewer/__tests__/AnnotationCreationPending.test.tsx +36 -26
- package/src/features/resource-viewer/__tests__/AnnotationDeletionIntegration.test.tsx +26 -16
- package/src/features/resource-viewer/__tests__/{DetectionProgressDismissal.test.tsx → AnnotationProgressDismissal.test.tsx} +48 -38
- package/src/features/resource-viewer/__tests__/DetectionFlowBug.test.tsx +59 -49
- package/src/features/resource-viewer/__tests__/DetectionFlowIntegration.test.tsx +55 -33
- package/src/features/resource-viewer/__tests__/GenerationFlowIntegration.test.tsx +24 -16
- package/src/features/resource-viewer/__tests__/ResolutionFlowIntegration.test.tsx +41 -31
- package/src/features/resource-viewer/__tests__/ResourceMutations.test.tsx +10 -10
- package/src/features/resource-viewer/__tests__/ToastNotifications.test.tsx +196 -0
- package/src/features/resource-viewer/__tests__/{detection-progress-flow.test.tsx → annotation-progress-flow.test.tsx} +51 -28
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +56 -45
- package/src/styles/core/buttons.css +3 -3
- package/src/styles/core/forms.css +2 -2
- package/src/styles/index.css +1 -1
- package/src/styles/motivations/motivation-assessment.css +9 -9
- package/src/styles/motivations/motivation-comment.css +9 -9
- package/src/styles/motivations/motivation-highlight.css +9 -9
- package/src/styles/motivations/motivation-reference.css +9 -9
- package/src/styles/motivations/motivation-tag.css +9 -9
- package/src/styles/utilities/focus-extended.css +6 -6
- package/translations/ar.json +44 -44
- package/translations/bn.json +44 -44
- package/translations/cs.json +44 -44
- package/translations/da.json +44 -44
- package/translations/de.json +44 -44
- package/translations/el.json +44 -44
- package/translations/en.json +44 -44
- package/translations/es.json +44 -44
- package/translations/fa.json +44 -44
- package/translations/fi.json +44 -44
- package/translations/fr.json +44 -44
- package/translations/he.json +44 -44
- package/translations/hi.json +44 -44
- package/translations/id.json +44 -44
- package/translations/it.json +44 -44
- package/translations/ja.json +44 -44
- package/translations/ko.json +44 -44
- package/translations/ms.json +44 -44
- package/translations/nl.json +44 -44
- package/translations/no.json +44 -44
- package/translations/pl.json +44 -44
- package/translations/pt.json +44 -44
- package/translations/ro.json +44 -44
- package/translations/sv.json +44 -44
- package/translations/th.json +44 -44
- package/translations/tr.json +44 -44
- package/translations/uk.json +44 -44
- package/translations/vi.json +44 -44
- package/translations/zh.json +44 -44
- package/dist/PdfAnnotationCanvas.client-VLNA5O5M.mjs.map +0 -1
- package/dist/ar-4ZEORRW2.mjs.map +0 -1
- package/dist/bn-SEDE5BQJ.mjs.map +0 -1
- package/dist/chunk-D7NBW4RV.mjs.map +0 -1
- package/dist/chunk-M7SZRRIE.mjs.map +0 -1
- package/dist/cs-7W4WF5WD.mjs.map +0 -1
- package/dist/da-75XGBCBK.mjs.map +0 -1
- package/dist/de-ODJVFLHM.mjs.map +0 -1
- package/dist/el-C4PM4WB3.mjs.map +0 -1
- package/dist/es-WD33R7QL.mjs.map +0 -1
- package/dist/fa-2BP6V56P.mjs.map +0 -1
- package/dist/fi-USRRW24J.mjs.map +0 -1
- package/dist/fr-EC5S6WVF.mjs.map +0 -1
- package/dist/he-7TBVIKAA.mjs.map +0 -1
- package/dist/hi-FO4VIZLA.mjs.map +0 -1
- package/dist/id-7U7GGVWY.mjs.map +0 -1
- package/dist/it-Y4OPL6I2.mjs.map +0 -1
- package/dist/ja-PK7SQL55.mjs.map +0 -1
- package/dist/ko-L25PXMYD.mjs.map +0 -1
- package/dist/ms-STH777QM.mjs.map +0 -1
- package/dist/nl-Y7LECDDR.mjs.map +0 -1
- package/dist/no-KEKCEWU6.mjs.map +0 -1
- package/dist/pl-7A7OC75O.mjs.map +0 -1
- package/dist/pt-35HTM7RA.mjs.map +0 -1
- package/dist/ro-VAWL5KQA.mjs.map +0 -1
- package/dist/sv-7ZK5EQEB.mjs.map +0 -1
- package/dist/th-UDWZ4X34.mjs.map +0 -1
- package/dist/tr-4WMPK3UX.mjs.map +0 -1
- package/dist/uk-SSLASQYJ.mjs.map +0 -1
- package/dist/vi-IF42Z5PU.mjs.map +0 -1
- package/dist/zh-HRQTNTAI.mjs.map +0 -1
- package/src/components/DetectionProgressWidget.tsx +0 -113
- /package/dist/{chunk-C63BARI7.mjs.map → chunk-3FIQXKQF.mjs.map} +0 -0
- /package/dist/{en-KJCJQ4OO.mjs.map → en-XWEPVTB4.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useEventSubscription,
|
|
7
7
|
useEventSubscriptions,
|
|
8
8
|
useHoverEmitter
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MWQ5CNKW.mjs";
|
|
10
10
|
import {
|
|
11
11
|
AVAILABLE_LOCALES,
|
|
12
12
|
ApiClientProvider,
|
|
@@ -21,13 +21,13 @@ import {
|
|
|
21
21
|
useSessionContext,
|
|
22
22
|
useToast,
|
|
23
23
|
useTranslations
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-3FIQXKQF.mjs";
|
|
25
25
|
import {
|
|
26
26
|
EventBusProvider,
|
|
27
27
|
resetEventBusForTesting,
|
|
28
28
|
useEventBus
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-YI5IX5ZA.mjs";
|
|
30
|
+
import "./chunk-JH7BXE2P.mjs";
|
|
31
31
|
import {
|
|
32
32
|
__commonJS,
|
|
33
33
|
__export,
|
|
@@ -17261,7 +17261,7 @@ var ReferenceResolutionWidget = class extends WidgetType {
|
|
|
17261
17261
|
indicator.addEventListener("click", (e6) => {
|
|
17262
17262
|
e6.preventDefault();
|
|
17263
17263
|
e6.stopPropagation();
|
|
17264
|
-
eventBus.get("
|
|
17264
|
+
eventBus.get("attend:click").next({ annotationId: annotation.id, motivation: annotation.motivation });
|
|
17265
17265
|
});
|
|
17266
17266
|
}
|
|
17267
17267
|
}
|
|
@@ -18269,18 +18269,37 @@ function useLineNumbers() {
|
|
|
18269
18269
|
return { showLineNumbers, toggleLineNumbers };
|
|
18270
18270
|
}
|
|
18271
18271
|
|
|
18272
|
+
// src/hooks/useHoverDelay.ts
|
|
18273
|
+
import { useState as useState3, useCallback as useCallback4 } from "react";
|
|
18274
|
+
function useHoverDelay() {
|
|
18275
|
+
const [hoverDelayMs, setHoverDelayMsState] = useState3(() => {
|
|
18276
|
+
if (typeof window !== "undefined") {
|
|
18277
|
+
const stored = localStorage.getItem("hoverDelayMs");
|
|
18278
|
+
return stored ? Number(stored) : HOVER_DELAY_MS;
|
|
18279
|
+
}
|
|
18280
|
+
return HOVER_DELAY_MS;
|
|
18281
|
+
});
|
|
18282
|
+
const setHoverDelayMs = useCallback4((delayMs) => {
|
|
18283
|
+
setHoverDelayMsState(delayMs);
|
|
18284
|
+
if (typeof window !== "undefined") {
|
|
18285
|
+
localStorage.setItem("hoverDelayMs", delayMs.toString());
|
|
18286
|
+
}
|
|
18287
|
+
}, []);
|
|
18288
|
+
return { hoverDelayMs, setHoverDelayMs };
|
|
18289
|
+
}
|
|
18290
|
+
|
|
18272
18291
|
// src/hooks/useObservableNavigation.tsx
|
|
18273
|
-
import { useCallback as
|
|
18292
|
+
import { useCallback as useCallback5 } from "react";
|
|
18274
18293
|
function useObservableRouter(baseRouter) {
|
|
18275
18294
|
const eventBus = useEventBus();
|
|
18276
|
-
const push2 =
|
|
18295
|
+
const push2 = useCallback5((path2, options) => {
|
|
18277
18296
|
eventBus.get("navigation:router-push").next({
|
|
18278
18297
|
path: path2,
|
|
18279
18298
|
reason: options?.reason
|
|
18280
18299
|
});
|
|
18281
18300
|
baseRouter.push(path2);
|
|
18282
18301
|
}, []);
|
|
18283
|
-
const replace3 =
|
|
18302
|
+
const replace3 = useCallback5((path2, options) => {
|
|
18284
18303
|
if (!baseRouter.replace) return;
|
|
18285
18304
|
eventBus.get("navigation:router-push").next({
|
|
18286
18305
|
path: path2,
|
|
@@ -18296,7 +18315,7 @@ function useObservableRouter(baseRouter) {
|
|
|
18296
18315
|
}
|
|
18297
18316
|
function useObservableExternalNavigation() {
|
|
18298
18317
|
const eventBus = useEventBus();
|
|
18299
|
-
return
|
|
18318
|
+
return useCallback5((url, metadata) => {
|
|
18300
18319
|
const fallbackTimer = setTimeout(() => {
|
|
18301
18320
|
console.warn(
|
|
18302
18321
|
"[Observable Navigation] No handler cancelled navigation:external-navigate fallback. Falling back to window.location.href. For better UX, subscribe to this event in your app, call cancelFallback(), and use client-side routing."
|
|
@@ -18312,7 +18331,7 @@ function useObservableExternalNavigation() {
|
|
|
18312
18331
|
}
|
|
18313
18332
|
|
|
18314
18333
|
// src/hooks/usePanelWidth.ts
|
|
18315
|
-
import { useState as
|
|
18334
|
+
import { useState as useState4, useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
18316
18335
|
function usePanelWidth({
|
|
18317
18336
|
defaultWidth = 384,
|
|
18318
18337
|
// 24rem
|
|
@@ -18322,7 +18341,7 @@ function usePanelWidth({
|
|
|
18322
18341
|
// 50rem
|
|
18323
18342
|
storageKey = "semiont-panel-width"
|
|
18324
18343
|
} = {}) {
|
|
18325
|
-
const [width, setWidthInternal] =
|
|
18344
|
+
const [width, setWidthInternal] = useState4(defaultWidth);
|
|
18326
18345
|
const userChangedRef = useRef3(false);
|
|
18327
18346
|
useEffect3(() => {
|
|
18328
18347
|
if (typeof window === "undefined") return;
|
|
@@ -18346,7 +18365,7 @@ function usePanelWidth({
|
|
|
18346
18365
|
}
|
|
18347
18366
|
|
|
18348
18367
|
// src/hooks/useResourceEvents.ts
|
|
18349
|
-
import { useEffect as useEffect4, useState as
|
|
18368
|
+
import { useEffect as useEffect4, useState as useState5, useRef as useRef4, useCallback as useCallback6 } from "react";
|
|
18350
18369
|
import { accessToken as accessToken2 } from "@semiont/core";
|
|
18351
18370
|
function useResourceEvents({
|
|
18352
18371
|
rUri,
|
|
@@ -18364,9 +18383,9 @@ function useResourceEvents({
|
|
|
18364
18383
|
const client = useApiClient();
|
|
18365
18384
|
const token = useAuthToken();
|
|
18366
18385
|
const eventBus = useEventBus();
|
|
18367
|
-
const [status, setStatus] =
|
|
18368
|
-
const [lastEvent, setLastEvent] =
|
|
18369
|
-
const [eventCount, setEventCount] =
|
|
18386
|
+
const [status, setStatus] = useState5("disconnected");
|
|
18387
|
+
const [lastEvent, setLastEvent] = useState5(null);
|
|
18388
|
+
const [eventCount, setEventCount] = useState5(0);
|
|
18370
18389
|
const streamRef = useRef4(null);
|
|
18371
18390
|
const reconnectTimeoutRef = useRef4(null);
|
|
18372
18391
|
const reconnectAttemptsRef = useRef4(0);
|
|
@@ -18391,7 +18410,7 @@ function useResourceEvents({
|
|
|
18391
18410
|
onDocumentUnarchivedRef.current = onDocumentUnarchived;
|
|
18392
18411
|
onErrorRef.current = onError;
|
|
18393
18412
|
});
|
|
18394
|
-
const handleEvent =
|
|
18413
|
+
const handleEvent = useCallback6((event) => {
|
|
18395
18414
|
setLastEvent(event);
|
|
18396
18415
|
setEventCount((prev) => prev + 1);
|
|
18397
18416
|
onEventRef.current?.(event);
|
|
@@ -18425,7 +18444,7 @@ function useResourceEvents({
|
|
|
18425
18444
|
});
|
|
18426
18445
|
return () => subscription.unsubscribe();
|
|
18427
18446
|
}, [eventBus, handleEvent]);
|
|
18428
|
-
const connect =
|
|
18447
|
+
const connect = useCallback6(async () => {
|
|
18429
18448
|
if (connectingRef.current || streamRef.current) {
|
|
18430
18449
|
return;
|
|
18431
18450
|
}
|
|
@@ -18460,7 +18479,7 @@ function useResourceEvents({
|
|
|
18460
18479
|
connectingRef.current = false;
|
|
18461
18480
|
}
|
|
18462
18481
|
}, [rUri, client, token, eventBus]);
|
|
18463
|
-
const disconnect =
|
|
18482
|
+
const disconnect = useCallback6(() => {
|
|
18464
18483
|
if (streamRef.current) {
|
|
18465
18484
|
streamRef.current.close();
|
|
18466
18485
|
streamRef.current = null;
|
|
@@ -18492,12 +18511,12 @@ function useResourceEvents({
|
|
|
18492
18511
|
}
|
|
18493
18512
|
|
|
18494
18513
|
// src/hooks/useRovingTabIndex.ts
|
|
18495
|
-
import { useRef as useRef5, useEffect as useEffect5, useCallback as
|
|
18514
|
+
import { useRef as useRef5, useEffect as useEffect5, useCallback as useCallback7 } from "react";
|
|
18496
18515
|
function useRovingTabIndex(itemCount, options = {}) {
|
|
18497
18516
|
const { orientation = "horizontal", loop = true, cols = 1 } = options;
|
|
18498
18517
|
const containerRef = useRef5(null);
|
|
18499
18518
|
const currentIndexRef = useRef5(0);
|
|
18500
|
-
const getFocusableItems =
|
|
18519
|
+
const getFocusableItems = useCallback7(() => {
|
|
18501
18520
|
if (!containerRef.current) return [];
|
|
18502
18521
|
return Array.from(
|
|
18503
18522
|
containerRef.current.querySelectorAll(
|
|
@@ -18505,7 +18524,7 @@ function useRovingTabIndex(itemCount, options = {}) {
|
|
|
18505
18524
|
)
|
|
18506
18525
|
);
|
|
18507
18526
|
}, []);
|
|
18508
|
-
const focusItem =
|
|
18527
|
+
const focusItem = useCallback7((index2) => {
|
|
18509
18528
|
const items = getFocusableItems();
|
|
18510
18529
|
if (items.length === 0) return;
|
|
18511
18530
|
let targetIndex = index2;
|
|
@@ -18520,7 +18539,7 @@ function useRovingTabIndex(itemCount, options = {}) {
|
|
|
18520
18539
|
items[targetIndex]?.focus();
|
|
18521
18540
|
currentIndexRef.current = targetIndex;
|
|
18522
18541
|
}, [getFocusableItems, loop]);
|
|
18523
|
-
const handleKeyDown =
|
|
18542
|
+
const handleKeyDown = useCallback7(
|
|
18524
18543
|
(event) => {
|
|
18525
18544
|
const items = getFocusableItems();
|
|
18526
18545
|
if (items.length === 0) return;
|
|
@@ -18607,11 +18626,11 @@ function useRovingTabIndex(itemCount, options = {}) {
|
|
|
18607
18626
|
}
|
|
18608
18627
|
|
|
18609
18628
|
// src/hooks/useSessionExpiry.ts
|
|
18610
|
-
import { useState as
|
|
18629
|
+
import { useState as useState6, useEffect as useEffect6 } from "react";
|
|
18611
18630
|
function useSessionExpiry() {
|
|
18612
18631
|
const { expiresAt } = useSessionContext();
|
|
18613
|
-
const [timeRemaining, setTimeRemaining] =
|
|
18614
|
-
const [isExpiringSoon, setIsExpiringSoon] =
|
|
18632
|
+
const [timeRemaining, setTimeRemaining] = useState6(null);
|
|
18633
|
+
const [isExpiringSoon, setIsExpiringSoon] = useState6(false);
|
|
18615
18634
|
useEffect6(() => {
|
|
18616
18635
|
if (!expiresAt) {
|
|
18617
18636
|
setTimeRemaining(null);
|
|
@@ -18631,17 +18650,17 @@ function useSessionExpiry() {
|
|
|
18631
18650
|
}
|
|
18632
18651
|
|
|
18633
18652
|
// src/contexts/ThemeContext.tsx
|
|
18634
|
-
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect7, useState as
|
|
18653
|
+
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect7, useState as useState7 } from "react";
|
|
18635
18654
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
18636
18655
|
var ThemeContext = createContext2(null);
|
|
18637
18656
|
function ThemeProvider({ children }) {
|
|
18638
|
-
const [theme2, setThemeState] =
|
|
18657
|
+
const [theme2, setThemeState] = useState7(() => {
|
|
18639
18658
|
if (typeof window !== "undefined") {
|
|
18640
18659
|
return localStorage.getItem("theme") || "system";
|
|
18641
18660
|
}
|
|
18642
18661
|
return "system";
|
|
18643
18662
|
});
|
|
18644
|
-
const [systemTheme, setSystemTheme] =
|
|
18663
|
+
const [systemTheme, setSystemTheme] = useState7(() => {
|
|
18645
18664
|
if (typeof window !== "undefined") {
|
|
18646
18665
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
18647
18666
|
}
|
|
@@ -18677,17 +18696,17 @@ function useTheme() {
|
|
|
18677
18696
|
}
|
|
18678
18697
|
|
|
18679
18698
|
// src/hooks/useUI.ts
|
|
18680
|
-
import { useState as
|
|
18699
|
+
import { useState as useState8, useEffect as useEffect8, useCallback as useCallback8, useRef as useRef6 } from "react";
|
|
18681
18700
|
function useDropdown() {
|
|
18682
|
-
const [isOpen, setIsOpen] =
|
|
18701
|
+
const [isOpen, setIsOpen] = useState8(false);
|
|
18683
18702
|
const dropdownRef = useRef6(null);
|
|
18684
|
-
const toggle =
|
|
18703
|
+
const toggle = useCallback8(() => {
|
|
18685
18704
|
setIsOpen((prev) => !prev);
|
|
18686
18705
|
}, []);
|
|
18687
|
-
const open =
|
|
18706
|
+
const open = useCallback8(() => {
|
|
18688
18707
|
setIsOpen(true);
|
|
18689
18708
|
}, []);
|
|
18690
|
-
const close =
|
|
18709
|
+
const close = useCallback8(() => {
|
|
18691
18710
|
setIsOpen(false);
|
|
18692
18711
|
}, []);
|
|
18693
18712
|
useEffect8(() => {
|
|
@@ -18723,14 +18742,14 @@ function useDropdown() {
|
|
|
18723
18742
|
};
|
|
18724
18743
|
}
|
|
18725
18744
|
function useLoadingState(minLoadingTime = 500) {
|
|
18726
|
-
const [isLoading, setIsLoading] =
|
|
18727
|
-
const [showLoading, setShowLoading] =
|
|
18745
|
+
const [isLoading, setIsLoading] = useState8(false);
|
|
18746
|
+
const [showLoading, setShowLoading] = useState8(false);
|
|
18728
18747
|
const timeoutRef = useRef6(null);
|
|
18729
|
-
const startLoading =
|
|
18748
|
+
const startLoading = useCallback8(() => {
|
|
18730
18749
|
setIsLoading(true);
|
|
18731
18750
|
setShowLoading(true);
|
|
18732
18751
|
}, []);
|
|
18733
|
-
const stopLoading =
|
|
18752
|
+
const stopLoading = useCallback8(() => {
|
|
18734
18753
|
setIsLoading(false);
|
|
18735
18754
|
timeoutRef.current = setTimeout(() => {
|
|
18736
18755
|
setShowLoading(false);
|
|
@@ -18751,7 +18770,7 @@ function useLoadingState(minLoadingTime = 500) {
|
|
|
18751
18770
|
};
|
|
18752
18771
|
}
|
|
18753
18772
|
function useLocalStorage(key, initialValue) {
|
|
18754
|
-
const [storedValue, setStoredValue] =
|
|
18773
|
+
const [storedValue, setStoredValue] = useState8(() => {
|
|
18755
18774
|
if (typeof window === "undefined") {
|
|
18756
18775
|
return initialValue;
|
|
18757
18776
|
}
|
|
@@ -18763,7 +18782,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
18763
18782
|
return initialValue;
|
|
18764
18783
|
}
|
|
18765
18784
|
});
|
|
18766
|
-
const setValue =
|
|
18785
|
+
const setValue = useCallback8((value) => {
|
|
18767
18786
|
try {
|
|
18768
18787
|
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
18769
18788
|
setStoredValue(valueToStore);
|
|
@@ -18828,10 +18847,10 @@ function useCacheManager() {
|
|
|
18828
18847
|
}
|
|
18829
18848
|
|
|
18830
18849
|
// src/contexts/ResourceAnnotationsContext.tsx
|
|
18831
|
-
import { createContext as createContext6, useContext as useContext6, useState as
|
|
18850
|
+
import { createContext as createContext6, useContext as useContext6, useState as useState10, useCallback as useCallback10, useMemo } from "react";
|
|
18832
18851
|
|
|
18833
18852
|
// src/components/LiveRegion.tsx
|
|
18834
|
-
import { useState as
|
|
18853
|
+
import { useState as useState9, createContext as createContext5, useContext as useContext5, useCallback as useCallback9 } from "react";
|
|
18835
18854
|
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
18836
18855
|
var LiveRegionContext = createContext5(null);
|
|
18837
18856
|
function useLiveRegion() {
|
|
@@ -18843,9 +18862,9 @@ function useLiveRegion() {
|
|
|
18843
18862
|
return context;
|
|
18844
18863
|
}
|
|
18845
18864
|
function LiveRegionProvider({ children }) {
|
|
18846
|
-
const [politeMessage, setPoliteMessage] =
|
|
18847
|
-
const [assertiveMessage, setAssertiveMessage] =
|
|
18848
|
-
const announce =
|
|
18865
|
+
const [politeMessage, setPoliteMessage] = useState9("");
|
|
18866
|
+
const [assertiveMessage, setAssertiveMessage] = useState9("");
|
|
18867
|
+
const announce = useCallback9((message, priority = "polite") => {
|
|
18849
18868
|
if (priority === "assertive") {
|
|
18850
18869
|
setAssertiveMessage(message);
|
|
18851
18870
|
setTimeout(() => setAssertiveMessage(""), 1e3);
|
|
@@ -18880,14 +18899,14 @@ function LiveRegionProvider({ children }) {
|
|
|
18880
18899
|
}
|
|
18881
18900
|
function useSearchAnnouncements() {
|
|
18882
18901
|
const { announce } = useLiveRegion();
|
|
18883
|
-
const announceSearchResults =
|
|
18902
|
+
const announceSearchResults = useCallback9((count2, query) => {
|
|
18884
18903
|
if (count2 === 0) {
|
|
18885
18904
|
announce(`No results found for ${query}`, "polite");
|
|
18886
18905
|
} else {
|
|
18887
18906
|
announce(`${count2} result${count2 === 1 ? "" : "s"} found for ${query}`, "polite");
|
|
18888
18907
|
}
|
|
18889
18908
|
}, [announce]);
|
|
18890
|
-
const announceSearching =
|
|
18909
|
+
const announceSearching = useCallback9(() => {
|
|
18891
18910
|
announce("Searching...", "polite");
|
|
18892
18911
|
}, [announce]);
|
|
18893
18912
|
return {
|
|
@@ -18897,26 +18916,26 @@ function useSearchAnnouncements() {
|
|
|
18897
18916
|
}
|
|
18898
18917
|
function useDocumentAnnouncements(annotators) {
|
|
18899
18918
|
const { announce } = useLiveRegion();
|
|
18900
|
-
const announceDocumentSaved =
|
|
18919
|
+
const announceDocumentSaved = useCallback9(() => {
|
|
18901
18920
|
announce("Document saved successfully", "polite");
|
|
18902
18921
|
}, [announce]);
|
|
18903
|
-
const announceDocumentDeleted =
|
|
18922
|
+
const announceDocumentDeleted = useCallback9(() => {
|
|
18904
18923
|
announce("Document deleted", "polite");
|
|
18905
18924
|
}, [announce]);
|
|
18906
|
-
const announceAnnotationCreated =
|
|
18925
|
+
const announceAnnotationCreated = useCallback9((annotation) => {
|
|
18907
18926
|
const metadata = annotators ? Object.values(annotators).find((a15) => a15.matchesAnnotation(annotation)) : null;
|
|
18908
18927
|
const message = metadata?.announceOnCreate ?? "Annotation created";
|
|
18909
18928
|
announce(message, "polite");
|
|
18910
18929
|
}, [announce, annotators]);
|
|
18911
|
-
const announceAnnotationDeleted =
|
|
18930
|
+
const announceAnnotationDeleted = useCallback9(() => {
|
|
18912
18931
|
announce("Annotation deleted", "polite");
|
|
18913
18932
|
}, [announce]);
|
|
18914
|
-
const announceAnnotationUpdated =
|
|
18933
|
+
const announceAnnotationUpdated = useCallback9((annotation) => {
|
|
18915
18934
|
const metadata = annotators ? Object.values(annotators).find((a15) => a15.matchesAnnotation(annotation)) : null;
|
|
18916
18935
|
const message = `${metadata?.displayName ?? "Annotation"} updated`;
|
|
18917
18936
|
announce(message, "polite");
|
|
18918
18937
|
}, [announce, annotators]);
|
|
18919
|
-
const announceError =
|
|
18938
|
+
const announceError = useCallback9((message) => {
|
|
18920
18939
|
announce(`Error: ${message}`, "assertive");
|
|
18921
18940
|
}, [announce]);
|
|
18922
18941
|
return {
|
|
@@ -18930,18 +18949,18 @@ function useDocumentAnnouncements(annotators) {
|
|
|
18930
18949
|
}
|
|
18931
18950
|
function useResourceLoadingAnnouncements() {
|
|
18932
18951
|
const { announce } = useLiveRegion();
|
|
18933
|
-
const announceResourceLoading =
|
|
18952
|
+
const announceResourceLoading = useCallback9((resourceName) => {
|
|
18934
18953
|
const message = resourceName ? `Loading ${resourceName}...` : "Loading resource...";
|
|
18935
18954
|
announce(message, "polite");
|
|
18936
18955
|
}, [announce]);
|
|
18937
|
-
const announceResourceLoaded =
|
|
18956
|
+
const announceResourceLoaded = useCallback9((resourceName) => {
|
|
18938
18957
|
announce(`${resourceName} loaded successfully`, "polite");
|
|
18939
18958
|
}, [announce]);
|
|
18940
|
-
const announceResourceLoadError =
|
|
18959
|
+
const announceResourceLoadError = useCallback9((resourceName) => {
|
|
18941
18960
|
const message = resourceName ? `Failed to load ${resourceName}` : "Failed to load resource";
|
|
18942
18961
|
announce(message, "assertive");
|
|
18943
18962
|
}, [announce]);
|
|
18944
|
-
const announceResourceUpdating =
|
|
18963
|
+
const announceResourceUpdating = useCallback9((resourceName) => {
|
|
18945
18964
|
announce(`Updating ${resourceName}...`, "polite");
|
|
18946
18965
|
}, [announce]);
|
|
18947
18966
|
return {
|
|
@@ -18953,16 +18972,16 @@ function useResourceLoadingAnnouncements() {
|
|
|
18953
18972
|
}
|
|
18954
18973
|
function useFormAnnouncements() {
|
|
18955
18974
|
const { announce } = useLiveRegion();
|
|
18956
|
-
const announceFormSubmitting =
|
|
18975
|
+
const announceFormSubmitting = useCallback9(() => {
|
|
18957
18976
|
announce("Submitting form...", "polite");
|
|
18958
18977
|
}, [announce]);
|
|
18959
|
-
const announceFormSuccess =
|
|
18978
|
+
const announceFormSuccess = useCallback9((message) => {
|
|
18960
18979
|
announce(message || "Form submitted successfully", "polite");
|
|
18961
18980
|
}, [announce]);
|
|
18962
|
-
const announceFormError =
|
|
18981
|
+
const announceFormError = useCallback9((message) => {
|
|
18963
18982
|
announce(message || "Form submission failed. Please check your entries and try again.", "assertive");
|
|
18964
18983
|
}, [announce]);
|
|
18965
|
-
const announceFormValidationError =
|
|
18984
|
+
const announceFormValidationError = useCallback9((fieldCount) => {
|
|
18966
18985
|
const message = fieldCount === 1 ? "There is 1 field with an error" : `There are ${fieldCount} fields with errors`;
|
|
18967
18986
|
announce(message, "assertive");
|
|
18968
18987
|
}, [announce]);
|
|
@@ -18975,10 +18994,10 @@ function useFormAnnouncements() {
|
|
|
18975
18994
|
}
|
|
18976
18995
|
function useLanguageChangeAnnouncements() {
|
|
18977
18996
|
const { announce } = useLiveRegion();
|
|
18978
|
-
const announceLanguageChanging =
|
|
18997
|
+
const announceLanguageChanging = useCallback9((newLanguage) => {
|
|
18979
18998
|
announce(`Changing language to ${newLanguage}...`, "polite");
|
|
18980
18999
|
}, [announce]);
|
|
18981
|
-
const announceLanguageChanged =
|
|
19000
|
+
const announceLanguageChanged = useCallback9((newLanguage) => {
|
|
18982
19001
|
announce(`Language changed to ${newLanguage}`, "polite");
|
|
18983
19002
|
}, [announce]);
|
|
18984
19003
|
return {
|
|
@@ -18991,11 +19010,11 @@ function useLanguageChangeAnnouncements() {
|
|
|
18991
19010
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
18992
19011
|
var ResourceAnnotationsContext = createContext6(void 0);
|
|
18993
19012
|
function ResourceAnnotationsProvider({ children }) {
|
|
18994
|
-
const [newAnnotationIds, setNewAnnotationIds] =
|
|
19013
|
+
const [newAnnotationIds, setNewAnnotationIds] = useState10(/* @__PURE__ */ new Set());
|
|
18995
19014
|
const { announceAnnotationCreated, announceError } = useDocumentAnnouncements();
|
|
18996
19015
|
const annotations = useAnnotations();
|
|
18997
19016
|
const createAnnotationMutation = annotations.create.useMutation();
|
|
18998
|
-
const createAnnotation =
|
|
19017
|
+
const createAnnotation = useCallback10(async (rUri, motivation, selector, body = []) => {
|
|
18999
19018
|
try {
|
|
19000
19019
|
const createData = {
|
|
19001
19020
|
motivation,
|
|
@@ -19027,14 +19046,14 @@ function ResourceAnnotationsProvider({ children }) {
|
|
|
19027
19046
|
throw err;
|
|
19028
19047
|
}
|
|
19029
19048
|
}, [createAnnotationMutation, announceAnnotationCreated, announceError]);
|
|
19030
|
-
const clearNewAnnotationId =
|
|
19049
|
+
const clearNewAnnotationId = useCallback10((id2) => {
|
|
19031
19050
|
setNewAnnotationIds((prev) => {
|
|
19032
19051
|
const next = new Set(prev);
|
|
19033
19052
|
next.delete(id2);
|
|
19034
19053
|
return next;
|
|
19035
19054
|
});
|
|
19036
19055
|
}, []);
|
|
19037
|
-
const triggerSparkleAnimation =
|
|
19056
|
+
const triggerSparkleAnimation = useCallback10((annotationId) => {
|
|
19038
19057
|
setNewAnnotationIds((prev) => new Set(prev).add(annotationId));
|
|
19039
19058
|
setTimeout(() => {
|
|
19040
19059
|
setNewAnnotationIds((prev) => {
|
|
@@ -26382,6 +26401,36 @@ var pasteURLAsLink = /* @__PURE__ */ EditorView.domEventHandlers({
|
|
|
26382
26401
|
}
|
|
26383
26402
|
});
|
|
26384
26403
|
|
|
26404
|
+
// src/lib/scroll-utils.ts
|
|
26405
|
+
function scrollAnnotationIntoView(annotationId, rootElement, options = {}) {
|
|
26406
|
+
if (!annotationId) return false;
|
|
26407
|
+
const { pulse = false, behavior = "smooth" } = options;
|
|
26408
|
+
const element2 = rootElement.querySelector(
|
|
26409
|
+
`[data-annotation-id="${CSS.escape(annotationId)}"]`
|
|
26410
|
+
);
|
|
26411
|
+
if (!element2) return false;
|
|
26412
|
+
const scrollContainer = element2.closest(".semiont-browse-view__content") || element2.closest(".semiont-annotate-view__content") || element2.closest(".semiont-document-viewer__scrollable-body");
|
|
26413
|
+
if (scrollContainer) {
|
|
26414
|
+
const elementRect = element2.getBoundingClientRect();
|
|
26415
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
26416
|
+
const isVisible = elementRect.top >= containerRect.top && elementRect.bottom <= containerRect.bottom;
|
|
26417
|
+
if (!isVisible) {
|
|
26418
|
+
const elementTop = element2.offsetTop;
|
|
26419
|
+
const containerHeight = scrollContainer.clientHeight;
|
|
26420
|
+
const elementHeight = element2.offsetHeight;
|
|
26421
|
+
const scrollTo = elementTop - containerHeight / 2 + elementHeight / 2;
|
|
26422
|
+
scrollContainer.scrollTo({ top: scrollTo, behavior });
|
|
26423
|
+
}
|
|
26424
|
+
}
|
|
26425
|
+
if (pulse) {
|
|
26426
|
+
element2.classList.add("annotation-pulse");
|
|
26427
|
+
setTimeout(() => {
|
|
26428
|
+
element2.classList.remove("annotation-pulse");
|
|
26429
|
+
}, 2e3);
|
|
26430
|
+
}
|
|
26431
|
+
return true;
|
|
26432
|
+
}
|
|
26433
|
+
|
|
26385
26434
|
// src/components/CodeMirrorRenderer.tsx
|
|
26386
26435
|
import { isHighlight as isHighlight2, isReference as isReference2, isResolvedReference as isResolvedReference2, isComment as isComment2, isAssessment, isTag as isTag3, getBodySource as getBodySource2 } from "@semiont/api-client";
|
|
26387
26436
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
@@ -26537,7 +26586,8 @@ function CodeMirrorRenderer({
|
|
|
26537
26586
|
enableWidgets = false,
|
|
26538
26587
|
eventBus,
|
|
26539
26588
|
getTargetDocumentName,
|
|
26540
|
-
generatingReferenceId
|
|
26589
|
+
generatingReferenceId,
|
|
26590
|
+
hoverDelayMs
|
|
26541
26591
|
}) {
|
|
26542
26592
|
const containerRef = useRef7(null);
|
|
26543
26593
|
const viewRef = useRef7(null);
|
|
@@ -26580,7 +26630,7 @@ function CodeMirrorRenderer({
|
|
|
26580
26630
|
const segment = segmentsRef.current.find((s11) => s11.annotation?.id === annotationId);
|
|
26581
26631
|
if (segment?.annotation) {
|
|
26582
26632
|
event.preventDefault();
|
|
26583
|
-
eventBusRef.current.get("
|
|
26633
|
+
eventBusRef.current.get("attend:click").next({
|
|
26584
26634
|
annotationId,
|
|
26585
26635
|
motivation: segment.annotation.motivation
|
|
26586
26636
|
});
|
|
@@ -26641,7 +26691,8 @@ function CodeMirrorRenderer({
|
|
|
26641
26691
|
containerRef.current.__cmView = view;
|
|
26642
26692
|
const container = view.dom;
|
|
26643
26693
|
const { handleMouseEnter, handleMouseLeave, cleanup: cleanupHover } = createHoverHandlers(
|
|
26644
|
-
(annotationId) => eventBusRef.current?.get("
|
|
26694
|
+
(annotationId) => eventBusRef.current?.get("attend:hover").next({ annotationId }),
|
|
26695
|
+
hoverDelayMs
|
|
26645
26696
|
);
|
|
26646
26697
|
const handleMouseOver = (e6) => {
|
|
26647
26698
|
const target = e6.target;
|
|
@@ -26663,7 +26714,7 @@ function CodeMirrorRenderer({
|
|
|
26663
26714
|
view.destroy();
|
|
26664
26715
|
viewRef.current = null;
|
|
26665
26716
|
};
|
|
26666
|
-
}, []);
|
|
26717
|
+
}, [hoverDelayMs]);
|
|
26667
26718
|
useEffect10(() => {
|
|
26668
26719
|
if (!viewRef.current) return;
|
|
26669
26720
|
const currentContent = viewRef.current.state.doc.toString();
|
|
@@ -26762,61 +26813,49 @@ function CodeMirrorRenderer({
|
|
|
26762
26813
|
}, [hoveredCommentId]);
|
|
26763
26814
|
useEffect10(() => {
|
|
26764
26815
|
if (!viewRef.current || !scrollToAnnotationId) return;
|
|
26765
|
-
|
|
26766
|
-
const element2 = view.contentDOM.querySelector(
|
|
26767
|
-
`[data-annotation-id="${CSS.escape(scrollToAnnotationId)}"]`
|
|
26768
|
-
);
|
|
26769
|
-
if (!element2) return;
|
|
26770
|
-
const scrollContainer = element2.closest(".semiont-annotate-view__content") || element2.closest(".semiont-document-viewer__scrollable-body");
|
|
26771
|
-
if (scrollContainer) {
|
|
26772
|
-
const elementTop = element2.offsetTop;
|
|
26773
|
-
const containerHeight = scrollContainer.clientHeight;
|
|
26774
|
-
const elementHeight = element2.offsetHeight;
|
|
26775
|
-
const scrollTo = elementTop - containerHeight / 2 + elementHeight / 2;
|
|
26776
|
-
scrollContainer.scrollTo({ top: scrollTo, behavior: "smooth" });
|
|
26777
|
-
}
|
|
26816
|
+
scrollAnnotationIntoView(scrollToAnnotationId, viewRef.current.contentDOM);
|
|
26778
26817
|
}, [scrollToAnnotationId]);
|
|
26779
26818
|
const containerClasses = sourceView ? "semiont-codemirror semiont-codemirror--source" : "semiont-codemirror";
|
|
26780
26819
|
return /* @__PURE__ */ jsx8("div", { ref: containerRef, className: containerClasses, "data-markdown-container": true });
|
|
26781
26820
|
}
|
|
26782
26821
|
|
|
26783
|
-
// src/components/
|
|
26822
|
+
// src/components/AnnotateReferencesProgressWidget.tsx
|
|
26784
26823
|
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
26785
|
-
function
|
|
26786
|
-
const t12 = useTranslations("
|
|
26824
|
+
function AnnotateReferencesProgressWidget({ progress, annotationType = "reference" }) {
|
|
26825
|
+
const t12 = useTranslations("ReferencesPanel");
|
|
26787
26826
|
const eventBus = useEventBus();
|
|
26788
26827
|
const handleCancel = () => {
|
|
26789
|
-
eventBus.get("job:cancel-requested").next({ jobType: "
|
|
26828
|
+
eventBus.get("job:cancel-requested").next({ jobType: "annotation" });
|
|
26790
26829
|
};
|
|
26791
26830
|
if (!progress) return null;
|
|
26792
26831
|
return /* @__PURE__ */ jsxs2(
|
|
26793
26832
|
"div",
|
|
26794
26833
|
{
|
|
26795
|
-
className: "semiont-
|
|
26834
|
+
className: "semiont-annotation-progress",
|
|
26796
26835
|
"data-status": progress.status,
|
|
26797
26836
|
"data-type": annotationType,
|
|
26798
26837
|
children: [
|
|
26799
|
-
/* @__PURE__ */ jsxs2("div", { className: "semiont-
|
|
26800
|
-
/* @__PURE__ */ jsxs2("h3", { className: "semiont-
|
|
26801
|
-
/* @__PURE__ */ jsx9("span", { className: "semiont-
|
|
26802
|
-
t12("
|
|
26838
|
+
/* @__PURE__ */ jsxs2("div", { className: "semiont-annotation-header", children: [
|
|
26839
|
+
/* @__PURE__ */ jsxs2("h3", { className: "semiont-annotation-title", children: [
|
|
26840
|
+
/* @__PURE__ */ jsx9("span", { className: "semiont-annotation-sparkle", children: "\u2728" }),
|
|
26841
|
+
t12("annotationProgressTitle")
|
|
26803
26842
|
] }),
|
|
26804
26843
|
progress.status !== "complete" && /* @__PURE__ */ jsx9(
|
|
26805
26844
|
"button",
|
|
26806
26845
|
{
|
|
26807
26846
|
onClick: handleCancel,
|
|
26808
|
-
className: "semiont-
|
|
26809
|
-
title: t12("
|
|
26847
|
+
className: "semiont-annotation-cancel",
|
|
26848
|
+
title: t12("cancelAnnotation"),
|
|
26810
26849
|
children: "\u2715"
|
|
26811
26850
|
}
|
|
26812
26851
|
)
|
|
26813
26852
|
] }),
|
|
26814
26853
|
(() => {
|
|
26815
26854
|
const enrichedProgress = progress;
|
|
26816
|
-
return enrichedProgress.requestParams && enrichedProgress.requestParams.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "semiont-
|
|
26817
|
-
/* @__PURE__ */ jsx9("div", { className: "semiont-
|
|
26818
|
-
enrichedProgress.requestParams.map((param, idx) => /* @__PURE__ */ jsxs2("div", { className: "semiont-
|
|
26819
|
-
/* @__PURE__ */ jsxs2("span", { className: "semiont-
|
|
26855
|
+
return enrichedProgress.requestParams && enrichedProgress.requestParams.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "semiont-annotation-progress__params", children: [
|
|
26856
|
+
/* @__PURE__ */ jsx9("div", { className: "semiont-annotation-progress__params-title", children: "Request Parameters:" }),
|
|
26857
|
+
enrichedProgress.requestParams.map((param, idx) => /* @__PURE__ */ jsxs2("div", { className: "semiont-annotation-progress__param", children: [
|
|
26858
|
+
/* @__PURE__ */ jsxs2("span", { className: "semiont-annotation-progress__param-label", children: [
|
|
26820
26859
|
param.label,
|
|
26821
26860
|
":"
|
|
26822
26861
|
] }),
|
|
@@ -26825,26 +26864,26 @@ function DetectionProgressWidget({ progress, annotationType = "reference" }) {
|
|
|
26825
26864
|
] }, idx))
|
|
26826
26865
|
] });
|
|
26827
26866
|
})(),
|
|
26828
|
-
progress.completedEntityTypes && progress.completedEntityTypes.length > 0 && /* @__PURE__ */ jsx9("div", { className: "semiont-
|
|
26829
|
-
/* @__PURE__ */ jsx9("span", { className: "semiont-
|
|
26830
|
-
/* @__PURE__ */ jsxs2("span", { className: "semiont-
|
|
26867
|
+
progress.completedEntityTypes && progress.completedEntityTypes.length > 0 && /* @__PURE__ */ jsx9("div", { className: "semiont-annotation-log", children: progress.completedEntityTypes.map((item, index2) => /* @__PURE__ */ jsxs2("div", { className: "semiont-annotation-log-item", children: [
|
|
26868
|
+
/* @__PURE__ */ jsx9("span", { className: "semiont-annotation-check", children: "\u2713" }),
|
|
26869
|
+
/* @__PURE__ */ jsxs2("span", { className: "semiont-annotation-entity-type", children: [
|
|
26831
26870
|
item.entityType,
|
|
26832
26871
|
":"
|
|
26833
26872
|
] }),
|
|
26834
26873
|
/* @__PURE__ */ jsx9("span", { children: t12("found", { count: item.foundCount }) })
|
|
26835
26874
|
] }, index2)) }),
|
|
26836
|
-
/* @__PURE__ */ jsxs2("div", { className: "semiont-
|
|
26837
|
-
progress.status === "complete" ? /* @__PURE__ */ jsxs2("div", { className: "semiont-
|
|
26838
|
-
/* @__PURE__ */ jsx9("span", { className: "semiont-
|
|
26875
|
+
/* @__PURE__ */ jsxs2("div", { className: "semiont-annotation-progress__status", children: [
|
|
26876
|
+
progress.status === "complete" ? /* @__PURE__ */ jsxs2("div", { className: "semiont-annotation-progress__message", children: [
|
|
26877
|
+
/* @__PURE__ */ jsx9("span", { className: "semiont-annotation-progress__icon", children: "\u2705" }),
|
|
26839
26878
|
/* @__PURE__ */ jsx9("span", { children: t12("complete") })
|
|
26840
|
-
] }) : progress.status === "error" ? /* @__PURE__ */ jsxs2("div", { className: "semiont-
|
|
26841
|
-
/* @__PURE__ */ jsx9("span", { className: "semiont-
|
|
26879
|
+
] }) : progress.status === "error" ? /* @__PURE__ */ jsxs2("div", { className: "semiont-annotation-progress__message", children: [
|
|
26880
|
+
/* @__PURE__ */ jsx9("span", { className: "semiont-annotation-progress__icon", children: "\u274C" }),
|
|
26842
26881
|
/* @__PURE__ */ jsx9("span", { children: progress.message || t12("failed") })
|
|
26843
|
-
] }) : /* @__PURE__ */ jsxs2("div", { className: "semiont-
|
|
26844
|
-
/* @__PURE__ */ jsx9("span", { className: "semiont-
|
|
26845
|
-
/* @__PURE__ */ jsx9("span", { children: progress.message || (progress.currentEntityType ? t12("current", { entityType: progress.currentEntityType }) : t12("
|
|
26882
|
+
] }) : /* @__PURE__ */ jsxs2("div", { className: "semiont-annotation-progress__message", children: [
|
|
26883
|
+
/* @__PURE__ */ jsx9("span", { className: "semiont-annotation-progress__icon", children: "\u2728" }),
|
|
26884
|
+
/* @__PURE__ */ jsx9("span", { children: progress.message || (progress.currentEntityType ? t12("current", { entityType: progress.currentEntityType }) : t12("annotating")) })
|
|
26846
26885
|
] }),
|
|
26847
|
-
progress.currentEntityType && progress.status !== "complete" && progress.status !== "error" && /* @__PURE__ */ jsxs2("div", { className: "semiont-
|
|
26886
|
+
progress.currentEntityType && progress.status !== "complete" && progress.status !== "error" && /* @__PURE__ */ jsxs2("div", { className: "semiont-annotation-progress__details", children: [
|
|
26848
26887
|
"Processing: ",
|
|
26849
26888
|
progress.currentEntityType
|
|
26850
26889
|
] })
|
|
@@ -26959,7 +26998,7 @@ function AsyncErrorBoundary({ children }) {
|
|
|
26959
26998
|
}
|
|
26960
26999
|
|
|
26961
27000
|
// src/components/ResizeHandle.tsx
|
|
26962
|
-
import { useRef as useRef8, useCallback as
|
|
27001
|
+
import { useRef as useRef8, useCallback as useCallback11, useEffect as useEffect11, useState as useState11 } from "react";
|
|
26963
27002
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
26964
27003
|
function ResizeHandle({
|
|
26965
27004
|
onResize,
|
|
@@ -26968,14 +27007,14 @@ function ResizeHandle({
|
|
|
26968
27007
|
position: position3 = "left",
|
|
26969
27008
|
ariaLabel = "Resize panel"
|
|
26970
27009
|
}) {
|
|
26971
|
-
const [isDragging, setIsDragging] =
|
|
27010
|
+
const [isDragging, setIsDragging] = useState11(false);
|
|
26972
27011
|
const startXRef = useRef8(0);
|
|
26973
27012
|
const startWidthRef = useRef8(0);
|
|
26974
27013
|
const onResizeRef = useRef8(onResize);
|
|
26975
27014
|
useEffect11(() => {
|
|
26976
27015
|
onResizeRef.current = onResize;
|
|
26977
27016
|
});
|
|
26978
|
-
const handleMouseDown =
|
|
27017
|
+
const handleMouseDown = useCallback11((e6) => {
|
|
26979
27018
|
e6.preventDefault();
|
|
26980
27019
|
setIsDragging(true);
|
|
26981
27020
|
startXRef.current = e6.clientX;
|
|
@@ -26984,7 +27023,7 @@ function ResizeHandle({
|
|
|
26984
27023
|
startWidthRef.current = parent.offsetWidth;
|
|
26985
27024
|
}
|
|
26986
27025
|
}, []);
|
|
26987
|
-
const handleMouseMove =
|
|
27026
|
+
const handleMouseMove = useCallback11((e6) => {
|
|
26988
27027
|
if (!isDragging) return;
|
|
26989
27028
|
const deltaX = e6.clientX - startXRef.current;
|
|
26990
27029
|
const widthDelta = position3 === "left" ? -deltaX : deltaX;
|
|
@@ -26992,10 +27031,10 @@ function ResizeHandle({
|
|
|
26992
27031
|
const constrainedWidth = Math.max(minWidth, Math.min(maxWidth, newWidth));
|
|
26993
27032
|
onResizeRef.current(constrainedWidth);
|
|
26994
27033
|
}, [isDragging, minWidth, maxWidth, position3]);
|
|
26995
|
-
const handleMouseUp =
|
|
27034
|
+
const handleMouseUp = useCallback11(() => {
|
|
26996
27035
|
setIsDragging(false);
|
|
26997
27036
|
}, []);
|
|
26998
|
-
const handleKeyDown =
|
|
27037
|
+
const handleKeyDown = useCallback11((e6) => {
|
|
26999
27038
|
const parent = e6.target.parentElement;
|
|
27000
27039
|
if (!parent) return;
|
|
27001
27040
|
const currentWidth = parent.offsetWidth;
|
|
@@ -27081,7 +27120,7 @@ function Toolbar({
|
|
|
27081
27120
|
const t12 = useTranslations("Toolbar");
|
|
27082
27121
|
const eventBus = useEventBus();
|
|
27083
27122
|
const handlePanelToggle = (panel) => {
|
|
27084
|
-
eventBus.get("panel
|
|
27123
|
+
eventBus.get("attend:panel-toggle").next({ panel });
|
|
27085
27124
|
};
|
|
27086
27125
|
return /* @__PURE__ */ jsxs4("div", { className: "semiont-toolbar", "data-context": context, children: [
|
|
27087
27126
|
context === "document" && /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
@@ -27188,7 +27227,8 @@ function SettingsPanel({
|
|
|
27188
27227
|
showLineNumbers,
|
|
27189
27228
|
theme: theme2,
|
|
27190
27229
|
locale,
|
|
27191
|
-
isPendingLocaleChange = false
|
|
27230
|
+
isPendingLocaleChange = false,
|
|
27231
|
+
hoverDelayMs
|
|
27192
27232
|
}) {
|
|
27193
27233
|
const t12 = useTranslations("Settings");
|
|
27194
27234
|
const eventBus = useEventBus();
|
|
@@ -27290,13 +27330,35 @@ function SettingsPanel({
|
|
|
27290
27330
|
),
|
|
27291
27331
|
/* @__PURE__ */ jsx14("p", { id: "language-hint", className: "semiont-form__help", children: t12("languageHint") }),
|
|
27292
27332
|
isPendingLocaleChange && /* @__PURE__ */ jsx14("p", { className: "semiont-settings-panel__loading", role: "status", "aria-live": "polite", children: t12("languageChanging") })
|
|
27333
|
+
] }),
|
|
27334
|
+
/* @__PURE__ */ jsxs5("div", { className: "semiont-settings-panel__field", children: [
|
|
27335
|
+
/* @__PURE__ */ jsx14("label", { htmlFor: "hover-delay-slider", className: "semiont-form__label", children: t12("hoverDelay") }),
|
|
27336
|
+
/* @__PURE__ */ jsx14(
|
|
27337
|
+
"input",
|
|
27338
|
+
{
|
|
27339
|
+
id: "hover-delay-slider",
|
|
27340
|
+
type: "range",
|
|
27341
|
+
min: "0",
|
|
27342
|
+
max: "500",
|
|
27343
|
+
step: "50",
|
|
27344
|
+
value: hoverDelayMs,
|
|
27345
|
+
onChange: (e6) => eventBus.get("settings:hover-delay-changed").next({ hoverDelayMs: Number(e6.target.value) }),
|
|
27346
|
+
className: "semiont-slider",
|
|
27347
|
+
"aria-describedby": "hover-delay-description"
|
|
27348
|
+
}
|
|
27349
|
+
),
|
|
27350
|
+
/* @__PURE__ */ jsxs5("div", { className: "semiont-slider__labels", children: [
|
|
27351
|
+
/* @__PURE__ */ jsx14("span", { children: t12("hoverDelayFast") }),
|
|
27352
|
+
/* @__PURE__ */ jsx14("span", { children: t12("hoverDelaySlow") })
|
|
27353
|
+
] }),
|
|
27354
|
+
/* @__PURE__ */ jsx14("p", { id: "hover-delay-description", className: "semiont-form__help", children: t12("hoverDelayDescription", { delay: hoverDelayMs }) })
|
|
27293
27355
|
] })
|
|
27294
27356
|
] })
|
|
27295
27357
|
] });
|
|
27296
27358
|
}
|
|
27297
27359
|
|
|
27298
27360
|
// src/components/annotation/AnnotateToolbar.tsx
|
|
27299
|
-
import React7, { useState as
|
|
27361
|
+
import React7, { useState as useState12, useRef as useRef9, useEffect as useEffect13 } from "react";
|
|
27300
27362
|
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
27301
27363
|
function DropdownGroup({
|
|
27302
27364
|
label,
|
|
@@ -27370,14 +27432,14 @@ function AnnotateToolbar({
|
|
|
27370
27432
|
const annotator = Object.values(annotators).find((a15) => a15.motivation === motivation);
|
|
27371
27433
|
return annotator?.iconEmoji || "\u2753";
|
|
27372
27434
|
};
|
|
27373
|
-
const [modeHovered, setModeHovered] =
|
|
27374
|
-
const [modePinned, setModePinned] =
|
|
27375
|
-
const [clickHovered, setClickHovered] =
|
|
27376
|
-
const [clickPinned, setClickPinned] =
|
|
27377
|
-
const [selectionHovered, setSelectionHovered] =
|
|
27378
|
-
const [selectionPinned, setSelectionPinned] =
|
|
27379
|
-
const [shapeHovered, setShapeHovered] =
|
|
27380
|
-
const [shapePinned, setShapePinned] =
|
|
27435
|
+
const [modeHovered, setModeHovered] = useState12(false);
|
|
27436
|
+
const [modePinned, setModePinned] = useState12(false);
|
|
27437
|
+
const [clickHovered, setClickHovered] = useState12(false);
|
|
27438
|
+
const [clickPinned, setClickPinned] = useState12(false);
|
|
27439
|
+
const [selectionHovered, setSelectionHovered] = useState12(false);
|
|
27440
|
+
const [selectionPinned, setSelectionPinned] = useState12(false);
|
|
27441
|
+
const [shapeHovered, setShapeHovered] = useState12(false);
|
|
27442
|
+
const [shapePinned, setShapePinned] = useState12(false);
|
|
27381
27443
|
const modeRef = useRef9(null);
|
|
27382
27444
|
const clickRef = useRef9(null);
|
|
27383
27445
|
const selectionRef = useRef9(null);
|
|
@@ -27418,9 +27480,9 @@ function AnnotateToolbar({
|
|
|
27418
27480
|
}, []);
|
|
27419
27481
|
const handleSelectionClick = (motivation) => {
|
|
27420
27482
|
if (motivation === null) {
|
|
27421
|
-
eventBus.get("
|
|
27483
|
+
eventBus.get("annotate:selection-changed").next({ motivation: null });
|
|
27422
27484
|
} else {
|
|
27423
|
-
eventBus.get("
|
|
27485
|
+
eventBus.get("annotate:selection-changed").next({
|
|
27424
27486
|
motivation: selectedMotivation === motivation ? null : motivation
|
|
27425
27487
|
});
|
|
27426
27488
|
}
|
|
@@ -27428,17 +27490,17 @@ function AnnotateToolbar({
|
|
|
27428
27490
|
setSelectionHovered(false);
|
|
27429
27491
|
};
|
|
27430
27492
|
const handleClickClick = (action) => {
|
|
27431
|
-
eventBus.get("
|
|
27493
|
+
eventBus.get("annotate:click-changed").next({ action });
|
|
27432
27494
|
setClickPinned(false);
|
|
27433
27495
|
setClickHovered(false);
|
|
27434
27496
|
};
|
|
27435
27497
|
const handleShapeClick = (shape) => {
|
|
27436
|
-
eventBus.get("
|
|
27498
|
+
eventBus.get("annotate:shape-changed").next({ shape });
|
|
27437
27499
|
setShapePinned(false);
|
|
27438
27500
|
setShapeHovered(false);
|
|
27439
27501
|
};
|
|
27440
27502
|
const handleModeToggle = () => {
|
|
27441
|
-
eventBus.get("
|
|
27503
|
+
eventBus.get("annotate:mode-toggled").next(void 0);
|
|
27442
27504
|
setModePinned(false);
|
|
27443
27505
|
setModeHovered(false);
|
|
27444
27506
|
};
|
|
@@ -29518,13 +29580,14 @@ function AnnotationOverlay({
|
|
|
29518
29580
|
displayHeight,
|
|
29519
29581
|
eventBus,
|
|
29520
29582
|
hoveredAnnotationId,
|
|
29521
|
-
selectedAnnotationId
|
|
29583
|
+
selectedAnnotationId,
|
|
29584
|
+
hoverDelayMs
|
|
29522
29585
|
}) {
|
|
29523
29586
|
const scaleX = displayWidth / imageWidth;
|
|
29524
29587
|
const scaleY = displayHeight / imageHeight;
|
|
29525
29588
|
const { handleMouseEnter, handleMouseLeave } = useMemo2(
|
|
29526
|
-
() => createHoverHandlers((annotationId) => eventBus?.get("
|
|
29527
|
-
[eventBus]
|
|
29589
|
+
() => createHoverHandlers((annotationId) => eventBus?.get("attend:hover").next({ annotationId }), hoverDelayMs),
|
|
29590
|
+
[eventBus, hoverDelayMs]
|
|
29528
29591
|
);
|
|
29529
29592
|
return /* @__PURE__ */ jsx18(
|
|
29530
29593
|
"svg",
|
|
@@ -29564,7 +29627,7 @@ function AnnotationOverlay({
|
|
|
29564
29627
|
className: "semiont-annotation-overlay__shape",
|
|
29565
29628
|
"data-hovered": isHovered ? "true" : "false",
|
|
29566
29629
|
"data-selected": isSelected ? "true" : "false",
|
|
29567
|
-
onClick: () => eventBus?.get("
|
|
29630
|
+
onClick: () => eventBus?.get("attend:click").next({ annotationId: annotation.id, motivation: annotation.motivation }),
|
|
29568
29631
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29569
29632
|
onMouseLeave: handleMouseLeave
|
|
29570
29633
|
}
|
|
@@ -29579,7 +29642,7 @@ function AnnotationOverlay({
|
|
|
29579
29642
|
style: { userSelect: "none" },
|
|
29580
29643
|
onClick: (e6) => {
|
|
29581
29644
|
e6.stopPropagation();
|
|
29582
|
-
eventBus?.get("
|
|
29645
|
+
eventBus?.get("attend:click").next({ annotationId: annotation.id, motivation: annotation.motivation });
|
|
29583
29646
|
},
|
|
29584
29647
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29585
29648
|
onMouseLeave: handleMouseLeave,
|
|
@@ -29609,7 +29672,7 @@ function AnnotationOverlay({
|
|
|
29609
29672
|
className: "semiont-annotation-overlay__shape",
|
|
29610
29673
|
"data-hovered": isHovered ? "true" : "false",
|
|
29611
29674
|
"data-selected": isSelected ? "true" : "false",
|
|
29612
|
-
onClick: () => eventBus?.get("
|
|
29675
|
+
onClick: () => eventBus?.get("attend:click").next({ annotationId: annotation.id, motivation: annotation.motivation }),
|
|
29613
29676
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29614
29677
|
onMouseLeave: handleMouseLeave
|
|
29615
29678
|
}
|
|
@@ -29624,7 +29687,7 @@ function AnnotationOverlay({
|
|
|
29624
29687
|
style: { userSelect: "none" },
|
|
29625
29688
|
onClick: (e6) => {
|
|
29626
29689
|
e6.stopPropagation();
|
|
29627
|
-
eventBus?.get("
|
|
29690
|
+
eventBus?.get("attend:click").next({ annotationId: annotation.id, motivation: annotation.motivation });
|
|
29628
29691
|
},
|
|
29629
29692
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29630
29693
|
onMouseLeave: handleMouseLeave,
|
|
@@ -29658,7 +29721,7 @@ function AnnotationOverlay({
|
|
|
29658
29721
|
className: "semiont-annotation-overlay__shape",
|
|
29659
29722
|
"data-hovered": isHovered ? "true" : "false",
|
|
29660
29723
|
"data-selected": isSelected ? "true" : "false",
|
|
29661
|
-
onClick: () => eventBus?.get("
|
|
29724
|
+
onClick: () => eventBus?.get("attend:click").next({ annotationId: annotation.id, motivation: annotation.motivation }),
|
|
29662
29725
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29663
29726
|
onMouseLeave: handleMouseLeave
|
|
29664
29727
|
}
|
|
@@ -29673,7 +29736,7 @@ function AnnotationOverlay({
|
|
|
29673
29736
|
style: { userSelect: "none" },
|
|
29674
29737
|
onClick: (e6) => {
|
|
29675
29738
|
e6.stopPropagation();
|
|
29676
|
-
eventBus?.get("
|
|
29739
|
+
eventBus?.get("attend:click").next({ annotationId: annotation.id, motivation: annotation.motivation });
|
|
29677
29740
|
},
|
|
29678
29741
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29679
29742
|
onMouseLeave: handleMouseLeave,
|
|
@@ -29691,7 +29754,7 @@ function AnnotationOverlay({
|
|
|
29691
29754
|
}
|
|
29692
29755
|
|
|
29693
29756
|
// src/components/image-annotation/SvgDrawingCanvas.tsx
|
|
29694
|
-
import { useRef as useRef11, useState as
|
|
29757
|
+
import { useRef as useRef11, useState as useState14, useEffect as useEffect16, useCallback as useCallback12, useMemo as useMemo3 } from "react";
|
|
29695
29758
|
import { createRectangleSvg, createCircleSvg, createPolygonSvg, scaleSvgToNative, parseSvgSelector as parseSvgSelector2 } from "@semiont/api-client";
|
|
29696
29759
|
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
29697
29760
|
function getMotivationColor(motivation) {
|
|
@@ -29724,17 +29787,18 @@ function SvgDrawingCanvas({
|
|
|
29724
29787
|
hoveredAnnotationId,
|
|
29725
29788
|
selectedAnnotationId
|
|
29726
29789
|
}) {
|
|
29790
|
+
const { hoverDelayMs } = useHoverDelay();
|
|
29727
29791
|
const imageUrl = useMemo3(() => {
|
|
29728
29792
|
const resourceId = resourceUri2.split("/").pop();
|
|
29729
29793
|
return `/api/resources/${resourceId}`;
|
|
29730
29794
|
}, [resourceUri2]);
|
|
29731
29795
|
const containerRef = useRef11(null);
|
|
29732
29796
|
const imageRef = useRef11(null);
|
|
29733
|
-
const [imageDimensions, setImageDimensions] =
|
|
29734
|
-
const [displayDimensions, setDisplayDimensions] =
|
|
29735
|
-
const [isDrawing, setIsDrawing] =
|
|
29736
|
-
const [startPoint, setStartPoint] =
|
|
29737
|
-
const [currentPoint, setCurrentPoint] =
|
|
29797
|
+
const [imageDimensions, setImageDimensions] = useState14(null);
|
|
29798
|
+
const [displayDimensions, setDisplayDimensions] = useState14(null);
|
|
29799
|
+
const [isDrawing, setIsDrawing] = useState14(false);
|
|
29800
|
+
const [startPoint, setStartPoint] = useState14(null);
|
|
29801
|
+
const [currentPoint, setCurrentPoint] = useState14(null);
|
|
29738
29802
|
useEffect16(() => {
|
|
29739
29803
|
const img = new Image();
|
|
29740
29804
|
img.onload = () => {
|
|
@@ -29773,7 +29837,7 @@ function SvgDrawingCanvas({
|
|
|
29773
29837
|
}
|
|
29774
29838
|
};
|
|
29775
29839
|
}, []);
|
|
29776
|
-
const getRelativeCoordinates =
|
|
29840
|
+
const getRelativeCoordinates = useCallback12((e6) => {
|
|
29777
29841
|
if (!imageRef.current) return null;
|
|
29778
29842
|
const rect = imageRef.current.getBoundingClientRect();
|
|
29779
29843
|
return {
|
|
@@ -29781,7 +29845,7 @@ function SvgDrawingCanvas({
|
|
|
29781
29845
|
y: e6.clientY - rect.top
|
|
29782
29846
|
};
|
|
29783
29847
|
}, []);
|
|
29784
|
-
const handleMouseDown =
|
|
29848
|
+
const handleMouseDown = useCallback12((e6) => {
|
|
29785
29849
|
if (!drawingMode) return;
|
|
29786
29850
|
const point4 = getRelativeCoordinates(e6);
|
|
29787
29851
|
if (point4) {
|
|
@@ -29790,14 +29854,14 @@ function SvgDrawingCanvas({
|
|
|
29790
29854
|
setCurrentPoint(point4);
|
|
29791
29855
|
}
|
|
29792
29856
|
}, [drawingMode, getRelativeCoordinates]);
|
|
29793
|
-
const handleMouseMove =
|
|
29857
|
+
const handleMouseMove = useCallback12((e6) => {
|
|
29794
29858
|
if (!isDrawing || !startPoint) return;
|
|
29795
29859
|
const point4 = getRelativeCoordinates(e6);
|
|
29796
29860
|
if (point4) {
|
|
29797
29861
|
setCurrentPoint(point4);
|
|
29798
29862
|
}
|
|
29799
29863
|
}, [isDrawing, startPoint, getRelativeCoordinates]);
|
|
29800
|
-
const handleMouseUp =
|
|
29864
|
+
const handleMouseUp = useCallback12((e6) => {
|
|
29801
29865
|
if (!isDrawing || !startPoint || !drawingMode) return;
|
|
29802
29866
|
const endPoint = getRelativeCoordinates(e6);
|
|
29803
29867
|
if (!endPoint || !displayDimensions || !imageDimensions) return;
|
|
@@ -29829,7 +29893,7 @@ function SvgDrawingCanvas({
|
|
|
29829
29893
|
return false;
|
|
29830
29894
|
});
|
|
29831
29895
|
if (clickedAnnotation) {
|
|
29832
|
-
eventBus?.get("
|
|
29896
|
+
eventBus?.get("attend:click").next({ annotationId: clickedAnnotation.id, motivation: clickedAnnotation.motivation });
|
|
29833
29897
|
setIsDrawing(false);
|
|
29834
29898
|
setStartPoint(null);
|
|
29835
29899
|
setCurrentPoint(null);
|
|
@@ -29881,7 +29945,7 @@ function SvgDrawingCanvas({
|
|
|
29881
29945
|
imageDimensions.height
|
|
29882
29946
|
);
|
|
29883
29947
|
if (eventBus && selectedMotivation) {
|
|
29884
|
-
eventBus.get("
|
|
29948
|
+
eventBus.get("annotate:requested").next({
|
|
29885
29949
|
selector: {
|
|
29886
29950
|
type: "SvgSelector",
|
|
29887
29951
|
value: nativeSvg
|
|
@@ -29893,7 +29957,7 @@ function SvgDrawingCanvas({
|
|
|
29893
29957
|
setStartPoint(null);
|
|
29894
29958
|
setCurrentPoint(null);
|
|
29895
29959
|
}, [isDrawing, startPoint, drawingMode, displayDimensions, imageDimensions, getRelativeCoordinates, selectedMotivation, existingAnnotations]);
|
|
29896
|
-
const handleMouseLeave =
|
|
29960
|
+
const handleMouseLeave = useCallback12(() => {
|
|
29897
29961
|
if (isDrawing) {
|
|
29898
29962
|
setIsDrawing(false);
|
|
29899
29963
|
setStartPoint(null);
|
|
@@ -29942,6 +30006,7 @@ function SvgDrawingCanvas({
|
|
|
29942
30006
|
imageHeight: imageDimensions.height,
|
|
29943
30007
|
displayWidth: displayDimensions.width,
|
|
29944
30008
|
displayHeight: displayDimensions.height,
|
|
30009
|
+
hoverDelayMs,
|
|
29945
30010
|
...eventBus && { eventBus },
|
|
29946
30011
|
...hoveredAnnotationId !== void 0 && { hoveredAnnotationId },
|
|
29947
30012
|
...selectedAnnotationId !== void 0 && { selectedAnnotationId }
|
|
@@ -30181,7 +30246,7 @@ function KeyboardShortcutsHelpModal({ isOpen, onClose }) {
|
|
|
30181
30246
|
}
|
|
30182
30247
|
|
|
30183
30248
|
// src/components/modals/ProposeEntitiesModal.tsx
|
|
30184
|
-
import { useEffect as useEffect17, useState as
|
|
30249
|
+
import { useEffect as useEffect17, useState as useState15, Fragment as Fragment5 } from "react";
|
|
30185
30250
|
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
30186
30251
|
var STORAGE_KEY = "userPreferredEntityTypes";
|
|
30187
30252
|
function ProposeEntitiesModal({
|
|
@@ -30189,7 +30254,7 @@ function ProposeEntitiesModal({
|
|
|
30189
30254
|
onConfirm,
|
|
30190
30255
|
onCancel
|
|
30191
30256
|
}) {
|
|
30192
|
-
const [selectedTypes, setSelectedTypes] =
|
|
30257
|
+
const [selectedTypes, setSelectedTypes] = useState15([]);
|
|
30193
30258
|
const entityTypesAPI = useEntityTypes();
|
|
30194
30259
|
const { data: entityTypesData } = entityTypesAPI.list.useQuery();
|
|
30195
30260
|
const allEntityTypes = entityTypesData?.entityTypes || [];
|
|
@@ -30303,11 +30368,11 @@ function ProposeEntitiesModal({
|
|
|
30303
30368
|
}
|
|
30304
30369
|
|
|
30305
30370
|
// src/components/resource/AnnotateView.tsx
|
|
30306
|
-
import { useRef as useRef12, useEffect as useEffect18, useCallback as
|
|
30371
|
+
import { useRef as useRef12, useEffect as useEffect18, useCallback as useCallback13, lazy, Suspense } from "react";
|
|
30307
30372
|
import { resourceUri as toResourceUri } from "@semiont/core";
|
|
30308
30373
|
import { getTextPositionSelector, getTextQuoteSelector, getTargetSelector, getMimeCategory, isPdfMimeType as isPdfMimeType2, extractContext, findTextWithContext } from "@semiont/api-client";
|
|
30309
30374
|
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
30310
|
-
var PdfAnnotationCanvas = lazy(() => import("./PdfAnnotationCanvas.client-
|
|
30375
|
+
var PdfAnnotationCanvas = lazy(() => import("./PdfAnnotationCanvas.client-HNYRKFDS.mjs").then((mod) => ({ default: mod.PdfAnnotationCanvas })));
|
|
30311
30376
|
function segmentTextWithAnnotations(content4, annotations) {
|
|
30312
30377
|
if (!content4) {
|
|
30313
30378
|
return [{ exact: "", start: 0, end: 0 }];
|
|
@@ -30377,6 +30442,7 @@ function AnnotateView({
|
|
|
30377
30442
|
getTargetDocumentName,
|
|
30378
30443
|
generatingReferenceId,
|
|
30379
30444
|
showLineNumbers = false,
|
|
30445
|
+
hoverDelayMs = 150,
|
|
30380
30446
|
annotateMode
|
|
30381
30447
|
}) {
|
|
30382
30448
|
const { newAnnotationIds } = useResourceAnnotations();
|
|
@@ -30389,23 +30455,23 @@ function AnnotateView({
|
|
|
30389
30455
|
const { selectedMotivation, selectedClick, selectedShape, hoveredAnnotationId, hoveredCommentId, scrollToAnnotationId } = uiState;
|
|
30390
30456
|
const onUIStateChangeRef = useRef12(onUIStateChange);
|
|
30391
30457
|
onUIStateChangeRef.current = onUIStateChange;
|
|
30392
|
-
const handleToolbarSelectionChanged =
|
|
30458
|
+
const handleToolbarSelectionChanged = useCallback13(({ motivation }) => {
|
|
30393
30459
|
onUIStateChangeRef.current?.({ selectedMotivation: motivation });
|
|
30394
30460
|
}, []);
|
|
30395
|
-
const handleToolbarClickChanged =
|
|
30461
|
+
const handleToolbarClickChanged = useCallback13(({ action }) => {
|
|
30396
30462
|
onUIStateChangeRef.current?.({ selectedClick: action });
|
|
30397
30463
|
}, []);
|
|
30398
|
-
const handleToolbarShapeChanged =
|
|
30464
|
+
const handleToolbarShapeChanged = useCallback13(({ shape }) => {
|
|
30399
30465
|
onUIStateChangeRef.current?.({ selectedShape: shape });
|
|
30400
30466
|
}, []);
|
|
30401
|
-
const handleAnnotationHover =
|
|
30467
|
+
const handleAnnotationHover = useCallback13(({ annotationId }) => {
|
|
30402
30468
|
onUIStateChangeRef.current?.({ hoveredAnnotationId: annotationId });
|
|
30403
30469
|
}, []);
|
|
30404
30470
|
useEventSubscriptions({
|
|
30405
|
-
"
|
|
30406
|
-
"
|
|
30407
|
-
"
|
|
30408
|
-
"
|
|
30471
|
+
"annotate:selection-changed": handleToolbarSelectionChanged,
|
|
30472
|
+
"annotate:click-changed": handleToolbarClickChanged,
|
|
30473
|
+
"annotate:shape-changed": handleToolbarShapeChanged,
|
|
30474
|
+
"attend:hover": handleAnnotationHover
|
|
30409
30475
|
});
|
|
30410
30476
|
useEffect18(() => {
|
|
30411
30477
|
const container = containerRef.current;
|
|
@@ -30444,7 +30510,7 @@ function AnnotateView({
|
|
|
30444
30510
|
const end2 = start3 + text7.length;
|
|
30445
30511
|
const context = extractContext(content4, start3, end2);
|
|
30446
30512
|
if (selectedMotivation) {
|
|
30447
|
-
eventBus.get("
|
|
30513
|
+
eventBus.get("annotate:requested").next({
|
|
30448
30514
|
selector: [
|
|
30449
30515
|
{
|
|
30450
30516
|
type: "TextPositionSelector",
|
|
@@ -30470,7 +30536,7 @@ function AnnotateView({
|
|
|
30470
30536
|
if (start2 >= 0) {
|
|
30471
30537
|
const context = extractContext(content4, start2, end);
|
|
30472
30538
|
if (selectedMotivation) {
|
|
30473
|
-
eventBus.get("
|
|
30539
|
+
eventBus.get("annotate:requested").next({
|
|
30474
30540
|
selector: [
|
|
30475
30541
|
{
|
|
30476
30542
|
type: "TextPositionSelector",
|
|
@@ -30523,6 +30589,7 @@ function AnnotateView({
|
|
|
30523
30589
|
...scrollToAnnotationId !== void 0 && { scrollToAnnotationId },
|
|
30524
30590
|
sourceView: true,
|
|
30525
30591
|
showLineNumbers,
|
|
30592
|
+
hoverDelayMs,
|
|
30526
30593
|
enableWidgets,
|
|
30527
30594
|
eventBus,
|
|
30528
30595
|
...getTargetDocumentName && { getTargetDocumentName },
|
|
@@ -30553,7 +30620,8 @@ function AnnotateView({
|
|
|
30553
30620
|
drawingMode: selectedMotivation ? selectedShape : null,
|
|
30554
30621
|
selectedMotivation,
|
|
30555
30622
|
eventBus,
|
|
30556
|
-
hoveredAnnotationId: hoveredCommentId || hoveredAnnotationId || null
|
|
30623
|
+
hoveredAnnotationId: hoveredCommentId || hoveredAnnotationId || null,
|
|
30624
|
+
hoverDelayMs
|
|
30557
30625
|
}
|
|
30558
30626
|
) }) })
|
|
30559
30627
|
] });
|
|
@@ -30579,7 +30647,8 @@ function AnnotateView({
|
|
|
30579
30647
|
drawingMode: selectedMotivation ? selectedShape : null,
|
|
30580
30648
|
selectedMotivation,
|
|
30581
30649
|
eventBus,
|
|
30582
|
-
hoveredAnnotationId: hoveredCommentId || hoveredAnnotationId || null
|
|
30650
|
+
hoveredAnnotationId: hoveredCommentId || hoveredAnnotationId || null,
|
|
30651
|
+
hoverDelayMs
|
|
30583
30652
|
}
|
|
30584
30653
|
) })
|
|
30585
30654
|
] });
|
|
@@ -30608,7 +30677,7 @@ import { useEffect as useEffect20, useRef as useRef14 } from "react";
|
|
|
30608
30677
|
import { getAnnotationUriFromEvent as getAnnotationUriFromEvent2 } from "@semiont/core";
|
|
30609
30678
|
|
|
30610
30679
|
// src/components/resource/HistoryEvent.tsx
|
|
30611
|
-
import { useRef as useRef13, useCallback as
|
|
30680
|
+
import { useRef as useRef13, useCallback as useCallback14, useEffect as useEffect19 } from "react";
|
|
30612
30681
|
import { getAnnotationUriFromEvent } from "@semiont/core";
|
|
30613
30682
|
|
|
30614
30683
|
// src/components/resource/event-formatting.ts
|
|
@@ -30853,7 +30922,7 @@ function HistoryEvent({
|
|
|
30853
30922
|
useEffect19(() => {
|
|
30854
30923
|
onEventHoverRef.current = onEventHover;
|
|
30855
30924
|
});
|
|
30856
|
-
const handleEmojiMouseEnter =
|
|
30925
|
+
const handleEmojiMouseEnter = useCallback14(() => {
|
|
30857
30926
|
if (!annotationUri2 || !onEventHoverRef.current) return;
|
|
30858
30927
|
if (hoverTimeoutRef.current) {
|
|
30859
30928
|
clearTimeout(hoverTimeoutRef.current);
|
|
@@ -30862,7 +30931,7 @@ function HistoryEvent({
|
|
|
30862
30931
|
onEventHoverRef.current?.(annotationUri2);
|
|
30863
30932
|
}, 300);
|
|
30864
30933
|
}, [annotationUri2]);
|
|
30865
|
-
const handleEmojiMouseLeave =
|
|
30934
|
+
const handleEmojiMouseLeave = useCallback14(() => {
|
|
30866
30935
|
if (hoverTimeoutRef.current) {
|
|
30867
30936
|
clearTimeout(hoverTimeoutRef.current);
|
|
30868
30937
|
hoverTimeoutRef.current = null;
|
|
@@ -31029,7 +31098,7 @@ function AnnotationHistory({ rUri, hoveredAnnotationId, onEventHover, onEventCli
|
|
|
31029
31098
|
}
|
|
31030
31099
|
|
|
31031
31100
|
// src/components/resource/BrowseView.tsx
|
|
31032
|
-
import { useEffect as useEffect22, useRef as useRef15, useCallback as
|
|
31101
|
+
import { useEffect as useEffect22, useRef as useRef15, useCallback as useCallback15, lazy as lazy2, Suspense as Suspense2 } from "react";
|
|
31033
31102
|
|
|
31034
31103
|
// ../../node_modules/devlop/lib/default.js
|
|
31035
31104
|
function ok2() {
|
|
@@ -32904,7 +32973,7 @@ var urlAttributes = {
|
|
|
32904
32973
|
|
|
32905
32974
|
// ../../node_modules/react-markdown/lib/index.js
|
|
32906
32975
|
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
32907
|
-
import { useEffect as useEffect21, useState as
|
|
32976
|
+
import { useEffect as useEffect21, useState as useState16 } from "react";
|
|
32908
32977
|
|
|
32909
32978
|
// ../../node_modules/mdast-util-to-string/lib/index.js
|
|
32910
32979
|
var emptyOptions2 = {};
|
|
@@ -45363,7 +45432,7 @@ function ImageViewer({ resourceUri: resourceUri2, alt = "Resource image" }) {
|
|
|
45363
45432
|
|
|
45364
45433
|
// src/components/resource/BrowseView.tsx
|
|
45365
45434
|
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
45366
|
-
var PdfAnnotationCanvas2 = lazy2(() => import("./PdfAnnotationCanvas.client-
|
|
45435
|
+
var PdfAnnotationCanvas2 = lazy2(() => import("./PdfAnnotationCanvas.client-HNYRKFDS.mjs").then((mod) => ({ default: mod.PdfAnnotationCanvas })));
|
|
45367
45436
|
function prepareAnnotations(annotations) {
|
|
45368
45437
|
return annotations.map((ann) => {
|
|
45369
45438
|
const targetSelector = getTargetSelector3(ann.target);
|
|
@@ -45389,7 +45458,8 @@ function BrowseView({
|
|
|
45389
45458
|
resourceUri: resourceUri2,
|
|
45390
45459
|
annotations,
|
|
45391
45460
|
selectedClick = "detail",
|
|
45392
|
-
annotateMode
|
|
45461
|
+
annotateMode,
|
|
45462
|
+
hoverDelayMs = 150
|
|
45393
45463
|
}) {
|
|
45394
45464
|
const { newAnnotationIds } = useResourceAnnotations();
|
|
45395
45465
|
const eventBus = useEventBus();
|
|
@@ -45410,12 +45480,13 @@ function BrowseView({
|
|
|
45410
45480
|
if (annotationId && annotationType === "reference") {
|
|
45411
45481
|
const annotation = allAnnotations.find((a15) => a15.id === annotationId);
|
|
45412
45482
|
if (annotation) {
|
|
45413
|
-
eventBus.get("
|
|
45483
|
+
eventBus.get("attend:click").next({ annotationId, motivation: annotation.motivation });
|
|
45414
45484
|
}
|
|
45415
45485
|
}
|
|
45416
45486
|
};
|
|
45417
45487
|
const { handleMouseEnter, handleMouseLeave, cleanup: cleanupHover } = createHoverHandlers(
|
|
45418
|
-
(annotationId) => eventBus.get("
|
|
45488
|
+
(annotationId) => eventBus.get("attend:hover").next({ annotationId }),
|
|
45489
|
+
hoverDelayMs
|
|
45419
45490
|
);
|
|
45420
45491
|
const handleMouseOver = (e6) => {
|
|
45421
45492
|
const target = e6.target;
|
|
@@ -45446,42 +45517,20 @@ function BrowseView({
|
|
|
45446
45517
|
container.removeEventListener("mouseout", handleMouseOut);
|
|
45447
45518
|
cleanupHover();
|
|
45448
45519
|
};
|
|
45449
|
-
}, [content4, allAnnotations, newAnnotationIds]);
|
|
45450
|
-
const scrollToAnnotation =
|
|
45451
|
-
if (!containerRef.current
|
|
45452
|
-
|
|
45453
|
-
`[data-annotation-id="${CSS.escape(annotationId)}"]`
|
|
45454
|
-
);
|
|
45455
|
-
if (!element2) return;
|
|
45456
|
-
const scrollContainer = element2.closest(".semiont-browse-view__content");
|
|
45457
|
-
if (scrollContainer) {
|
|
45458
|
-
const elementRect = element2.getBoundingClientRect();
|
|
45459
|
-
const containerRect = scrollContainer.getBoundingClientRect();
|
|
45460
|
-
const isVisible = elementRect.top >= containerRect.top && elementRect.bottom <= containerRect.bottom;
|
|
45461
|
-
if (!isVisible) {
|
|
45462
|
-
const elementTop = element2.offsetTop;
|
|
45463
|
-
const containerHeight = scrollContainer.clientHeight;
|
|
45464
|
-
const elementHeight = element2.offsetHeight;
|
|
45465
|
-
const scrollTo = elementTop - containerHeight / 2 + elementHeight / 2;
|
|
45466
|
-
scrollContainer.scrollTo({ top: scrollTo, behavior: "smooth" });
|
|
45467
|
-
}
|
|
45468
|
-
}
|
|
45469
|
-
element2.classList.add("annotation-pulse");
|
|
45470
|
-
if (removePulse) {
|
|
45471
|
-
setTimeout(() => {
|
|
45472
|
-
element2.classList.remove("annotation-pulse");
|
|
45473
|
-
}, 2e3);
|
|
45474
|
-
}
|
|
45520
|
+
}, [content4, allAnnotations, newAnnotationIds, hoverDelayMs]);
|
|
45521
|
+
const scrollToAnnotation = useCallback15((annotationId, removePulse = false) => {
|
|
45522
|
+
if (!containerRef.current) return;
|
|
45523
|
+
scrollAnnotationIntoView(annotationId, containerRef.current, { pulse: removePulse });
|
|
45475
45524
|
}, []);
|
|
45476
|
-
const handleAnnotationHover =
|
|
45525
|
+
const handleAnnotationHover = useCallback15(({ annotationId }) => {
|
|
45477
45526
|
scrollToAnnotation(annotationId);
|
|
45478
45527
|
}, [scrollToAnnotation]);
|
|
45479
|
-
const handleAnnotationFocus =
|
|
45528
|
+
const handleAnnotationFocus = useCallback15(({ annotationId }) => {
|
|
45480
45529
|
scrollToAnnotation(annotationId, true);
|
|
45481
45530
|
}, [scrollToAnnotation]);
|
|
45482
45531
|
useEventSubscriptions({
|
|
45483
|
-
"
|
|
45484
|
-
"
|
|
45532
|
+
"attend:hover": handleAnnotationHover,
|
|
45533
|
+
"attend:focus": handleAnnotationFocus
|
|
45485
45534
|
});
|
|
45486
45535
|
switch (category) {
|
|
45487
45536
|
case "text":
|
|
@@ -45577,7 +45626,7 @@ function BrowseView({
|
|
|
45577
45626
|
}
|
|
45578
45627
|
|
|
45579
45628
|
// src/components/resource/ResourceViewer.tsx
|
|
45580
|
-
import { useState as
|
|
45629
|
+
import { useState as useState17, useEffect as useEffect23, useCallback as useCallback16, useRef as useRef16 } from "react";
|
|
45581
45630
|
import { resourceUri } from "@semiont/core";
|
|
45582
45631
|
import { getExactText as getExactText3, getTargetSelector as getTargetSelector4, isHighlight as isHighlight4, isAssessment as isAssessment3, isReference as isReference4, isComment as isComment4, isTag as isTag5, getBodySource as getBodySource4 } from "@semiont/api-client";
|
|
45583
45632
|
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
@@ -45586,6 +45635,7 @@ function ResourceViewer({
|
|
|
45586
45635
|
annotations,
|
|
45587
45636
|
generatingReferenceId,
|
|
45588
45637
|
showLineNumbers = false,
|
|
45638
|
+
hoverDelayMs,
|
|
45589
45639
|
hoveredAnnotationId: hoveredAnnotationIdProp
|
|
45590
45640
|
}) {
|
|
45591
45641
|
const t12 = useTranslations("ResourceViewer");
|
|
@@ -45605,7 +45655,7 @@ function ResourceViewer({
|
|
|
45605
45655
|
return "text/plain";
|
|
45606
45656
|
};
|
|
45607
45657
|
const mimeType = getMimeType();
|
|
45608
|
-
const [annotateMode, setAnnotateMode] =
|
|
45658
|
+
const [annotateMode, setAnnotateMode] = useState17(() => {
|
|
45609
45659
|
if (typeof window !== "undefined") {
|
|
45610
45660
|
return localStorage.getItem("annotateMode") === "true";
|
|
45611
45661
|
}
|
|
@@ -45616,27 +45666,27 @@ function ResourceViewer({
|
|
|
45616
45666
|
localStorage.setItem("annotateMode", annotateMode.toString());
|
|
45617
45667
|
}
|
|
45618
45668
|
}, [annotateMode]);
|
|
45619
|
-
const handleViewModeToggle =
|
|
45669
|
+
const handleViewModeToggle = useCallback16(() => {
|
|
45620
45670
|
setAnnotateMode((prev) => !prev);
|
|
45621
45671
|
}, []);
|
|
45622
45672
|
const activeView = annotateMode ? "annotate" : "browse";
|
|
45623
45673
|
const cacheManager = useCacheManager();
|
|
45624
|
-
const
|
|
45674
|
+
const handleAnnotateAdded = useCallback16(() => {
|
|
45625
45675
|
if (cacheManager) {
|
|
45626
45676
|
cacheManager.invalidateAnnotations(rUri);
|
|
45627
45677
|
}
|
|
45628
45678
|
}, [cacheManager, rUri]);
|
|
45629
|
-
const
|
|
45679
|
+
const handleAnnotateRemoved = useCallback16(() => {
|
|
45630
45680
|
if (cacheManager) {
|
|
45631
45681
|
cacheManager.invalidateAnnotations(rUri);
|
|
45632
45682
|
}
|
|
45633
45683
|
}, [cacheManager, rUri]);
|
|
45634
|
-
const
|
|
45684
|
+
const handleAnnotateBodyUpdated = useCallback16(() => {
|
|
45635
45685
|
if (cacheManager) {
|
|
45636
45686
|
cacheManager.invalidateAnnotations(rUri);
|
|
45637
45687
|
}
|
|
45638
45688
|
}, [cacheManager, rUri]);
|
|
45639
|
-
const [selectedMotivation, setSelectedMotivation] =
|
|
45689
|
+
const [selectedMotivation, setSelectedMotivation] = useState17(() => {
|
|
45640
45690
|
if (typeof window !== "undefined") {
|
|
45641
45691
|
const stored = localStorage.getItem("semiont-toolbar-selection");
|
|
45642
45692
|
if (stored === "null") return null;
|
|
@@ -45646,7 +45696,7 @@ function ResourceViewer({
|
|
|
45646
45696
|
}
|
|
45647
45697
|
return "linking";
|
|
45648
45698
|
});
|
|
45649
|
-
const [selectedClick, setSelectedClick] =
|
|
45699
|
+
const [selectedClick, setSelectedClick] = useState17(() => {
|
|
45650
45700
|
if (typeof window !== "undefined") {
|
|
45651
45701
|
const stored = localStorage.getItem("semiont-toolbar-click");
|
|
45652
45702
|
if (stored && ["detail", "follow", "jsonld", "deleting"].includes(stored)) {
|
|
@@ -45656,16 +45706,16 @@ function ResourceViewer({
|
|
|
45656
45706
|
return "detail";
|
|
45657
45707
|
});
|
|
45658
45708
|
const selectorType = getSelectorType(mimeType);
|
|
45659
|
-
const [selectedShape, setSelectedShape] =
|
|
45709
|
+
const [selectedShape, setSelectedShape] = useState17(() => {
|
|
45660
45710
|
return getSelectedShapeForSelectorType(selectorType);
|
|
45661
45711
|
});
|
|
45662
|
-
const handleToolbarSelectionChanged =
|
|
45712
|
+
const handleToolbarSelectionChanged = useCallback16(({ motivation }) => {
|
|
45663
45713
|
setSelectedMotivation(motivation);
|
|
45664
45714
|
}, []);
|
|
45665
|
-
const handleToolbarClickChanged =
|
|
45715
|
+
const handleToolbarClickChanged = useCallback16(({ action }) => {
|
|
45666
45716
|
setSelectedClick(action);
|
|
45667
45717
|
}, []);
|
|
45668
|
-
const handleToolbarShapeChanged =
|
|
45718
|
+
const handleToolbarShapeChanged = useCallback16(({ shape }) => {
|
|
45669
45719
|
setSelectedShape(shape);
|
|
45670
45720
|
}, []);
|
|
45671
45721
|
useEffect23(() => {
|
|
@@ -45687,14 +45737,14 @@ function ResourceViewer({
|
|
|
45687
45737
|
setSelectedShape(shapeForType);
|
|
45688
45738
|
}
|
|
45689
45739
|
}, [selectorType]);
|
|
45690
|
-
const [showJsonLdView, setShowJsonLdView] =
|
|
45691
|
-
const [jsonLdAnnotation, setJsonLdAnnotation] =
|
|
45692
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
45740
|
+
const [showJsonLdView, setShowJsonLdView] = useState17(false);
|
|
45741
|
+
const [jsonLdAnnotation, setJsonLdAnnotation] = useState17(null);
|
|
45742
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState17(null);
|
|
45693
45743
|
const hoveredAnnotationId = hoveredAnnotationIdProp ?? null;
|
|
45694
|
-
const [hoveredCommentId, _setHoveredCommentId] =
|
|
45695
|
-
const [scrollToAnnotationId, setScrollToAnnotationId] =
|
|
45696
|
-
const [_focusedAnnotationId, setFocusedAnnotationId] =
|
|
45697
|
-
const focusAnnotation =
|
|
45744
|
+
const [hoveredCommentId, _setHoveredCommentId] = useState17(null);
|
|
45745
|
+
const [scrollToAnnotationId, setScrollToAnnotationId] = useState17(null);
|
|
45746
|
+
const [_focusedAnnotationId, setFocusedAnnotationId] = useState17(null);
|
|
45747
|
+
const focusAnnotation = useCallback16((annotationId) => {
|
|
45698
45748
|
setFocusedAnnotationId(annotationId);
|
|
45699
45749
|
setScrollToAnnotationId(annotationId);
|
|
45700
45750
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
@@ -45708,10 +45758,10 @@ function ResourceViewer({
|
|
|
45708
45758
|
y: Math.max(0, (window.innerHeight - popupHeight) / 2)
|
|
45709
45759
|
};
|
|
45710
45760
|
};
|
|
45711
|
-
const handleDeleteAnnotation =
|
|
45712
|
-
eventBus.get("
|
|
45761
|
+
const handleDeleteAnnotation = useCallback16((id2) => {
|
|
45762
|
+
eventBus.get("annotate:delete").next({ annotationId: id2 });
|
|
45713
45763
|
}, []);
|
|
45714
|
-
const handleAnnotationClick =
|
|
45764
|
+
const handleAnnotationClick = useCallback16((annotation, event) => {
|
|
45715
45765
|
const metadata = Object.values(ANNOTATORS).find((a15) => a15.matchesAnnotation(annotation));
|
|
45716
45766
|
if (metadata?.hasSidePanel) {
|
|
45717
45767
|
if (selectedClick === "detail") {
|
|
@@ -45745,7 +45795,7 @@ function ResourceViewer({
|
|
|
45745
45795
|
return;
|
|
45746
45796
|
}
|
|
45747
45797
|
}, [annotateMode, selectedClick, focusAnnotation]);
|
|
45748
|
-
const handleAnnotationClickEvent =
|
|
45798
|
+
const handleAnnotationClickEvent = useCallback16(({ annotationId, motivation }) => {
|
|
45749
45799
|
const metadata = Object.values(ANNOTATORS).find((a15) => a15.matchesAnnotation({ motivation }));
|
|
45750
45800
|
if (!metadata?.hasSidePanel) {
|
|
45751
45801
|
const allAnnotations = [...highlights, ...references, ...assessments, ...comments, ...tags3];
|
|
@@ -45763,21 +45813,21 @@ function ResourceViewer({
|
|
|
45763
45813
|
}
|
|
45764
45814
|
return;
|
|
45765
45815
|
}
|
|
45766
|
-
eventBus.get("panel
|
|
45816
|
+
eventBus.get("attend:panel-open").next({ panel: "annotations", scrollToAnnotationId: annotationId, motivation });
|
|
45767
45817
|
}, [highlights, references, assessments, comments, tags3, handleAnnotationClick, selectedClick]);
|
|
45768
45818
|
useEventSubscriptions({
|
|
45769
45819
|
// View mode
|
|
45770
|
-
"
|
|
45820
|
+
"annotate:mode-toggled": handleViewModeToggle,
|
|
45771
45821
|
// Annotation cache invalidation
|
|
45772
|
-
"
|
|
45773
|
-
"
|
|
45774
|
-
"
|
|
45822
|
+
"annotate:added": handleAnnotateAdded,
|
|
45823
|
+
"annotate:removed": handleAnnotateRemoved,
|
|
45824
|
+
"annotate:body-updated": handleAnnotateBodyUpdated,
|
|
45775
45825
|
// Toolbar state
|
|
45776
|
-
"
|
|
45777
|
-
"
|
|
45778
|
-
"
|
|
45826
|
+
"annotate:selection-changed": handleToolbarSelectionChanged,
|
|
45827
|
+
"annotate:click-changed": handleToolbarClickChanged,
|
|
45828
|
+
"annotate:shape-changed": handleToolbarShapeChanged,
|
|
45779
45829
|
// Annotation clicks
|
|
45780
|
-
"
|
|
45830
|
+
"attend:click": handleAnnotationClickEvent
|
|
45781
45831
|
});
|
|
45782
45832
|
const annotationsCollection = { highlights, references, assessments, comments, tags: tags3 };
|
|
45783
45833
|
const uiState = {
|
|
@@ -45787,7 +45837,7 @@ function ResourceViewer({
|
|
|
45787
45837
|
hoveredAnnotationId,
|
|
45788
45838
|
scrollToAnnotationId
|
|
45789
45839
|
};
|
|
45790
|
-
const getTargetDocumentName =
|
|
45840
|
+
const getTargetDocumentName = useCallback16((documentId) => {
|
|
45791
45841
|
const referencedResource = references.find((a15) => getBodySource4(a15.body) === documentId);
|
|
45792
45842
|
return referencedResource ? getExactText3(getTargetSelector4(referencedResource.target)) : void 0;
|
|
45793
45843
|
}, [references]);
|
|
@@ -45809,6 +45859,7 @@ function ResourceViewer({
|
|
|
45809
45859
|
getTargetDocumentName,
|
|
45810
45860
|
...generatingReferenceId !== void 0 && { generatingReferenceId },
|
|
45811
45861
|
showLineNumbers,
|
|
45862
|
+
hoverDelayMs,
|
|
45812
45863
|
annotateMode
|
|
45813
45864
|
}
|
|
45814
45865
|
) : /* @__PURE__ */ jsx28(
|
|
@@ -45820,6 +45871,7 @@ function ResourceViewer({
|
|
|
45820
45871
|
annotations: annotationsCollection,
|
|
45821
45872
|
hoveredCommentId,
|
|
45822
45873
|
selectedClick,
|
|
45874
|
+
hoverDelayMs,
|
|
45823
45875
|
annotateMode
|
|
45824
45876
|
}
|
|
45825
45877
|
),
|
|
@@ -45943,7 +45995,7 @@ var AssessmentEntry = forwardRef(
|
|
|
45943
45995
|
"data-type": "assessment",
|
|
45944
45996
|
"data-focused": isFocused ? "true" : "false",
|
|
45945
45997
|
onClick: () => {
|
|
45946
|
-
eventBus.get("
|
|
45998
|
+
eventBus.get("attend:click").next({ annotationId: assessment.id, motivation: assessment.motivation });
|
|
45947
45999
|
},
|
|
45948
46000
|
...hoverProps,
|
|
45949
46001
|
children: [
|
|
@@ -45967,37 +46019,37 @@ var AssessmentEntry = forwardRef(
|
|
|
45967
46019
|
);
|
|
45968
46020
|
|
|
45969
46021
|
// src/components/resource/panels/AssessmentPanel.tsx
|
|
45970
|
-
import { useState as
|
|
46022
|
+
import { useState as useState19, useEffect as useEffect25, useRef as useRef17, useCallback as useCallback18, useMemo as useMemo4 } from "react";
|
|
45971
46023
|
import { getTextPositionSelector as getTextPositionSelector3, getTargetSelector as getTargetSelector5 } from "@semiont/api-client";
|
|
45972
46024
|
|
|
45973
|
-
// src/components/resource/panels/
|
|
45974
|
-
import { useState as
|
|
46025
|
+
// src/components/resource/panels/AssistSection.tsx
|
|
46026
|
+
import { useState as useState18, useEffect as useEffect24, useCallback as useCallback17 } from "react";
|
|
45975
46027
|
import { Fragment as Fragment7, jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
45976
|
-
function
|
|
46028
|
+
function AssistSection({
|
|
45977
46029
|
annotationType,
|
|
45978
|
-
|
|
45979
|
-
|
|
46030
|
+
isAssisting,
|
|
46031
|
+
progress
|
|
45980
46032
|
}) {
|
|
45981
46033
|
const panelName = annotationType === "highlight" ? "HighlightPanel" : annotationType === "assessment" ? "AssessmentPanel" : "CommentsPanel";
|
|
45982
46034
|
const t12 = useTranslations(panelName);
|
|
45983
46035
|
const eventBus = useEventBus();
|
|
45984
|
-
const [instructions, setInstructions] =
|
|
45985
|
-
const [tone, setTone] =
|
|
46036
|
+
const [instructions, setInstructions] = useState18("");
|
|
46037
|
+
const [tone, setTone] = useState18("");
|
|
45986
46038
|
const defaultDensity = annotationType === "comment" ? 5 : annotationType === "assessment" ? 4 : annotationType === "highlight" ? 5 : 5;
|
|
45987
|
-
const [density, setDensity] =
|
|
45988
|
-
const [useDensity, setUseDensity] =
|
|
45989
|
-
const [isExpanded, setIsExpanded] =
|
|
46039
|
+
const [density, setDensity] = useState18(defaultDensity);
|
|
46040
|
+
const [useDensity, setUseDensity] = useState18(true);
|
|
46041
|
+
const [isExpanded, setIsExpanded] = useState18(() => {
|
|
45990
46042
|
if (typeof window === "undefined") return true;
|
|
45991
|
-
const stored = localStorage.getItem(`
|
|
46043
|
+
const stored = localStorage.getItem(`assist-section-expanded-${annotationType}`);
|
|
45992
46044
|
return stored ? stored === "true" : true;
|
|
45993
46045
|
});
|
|
45994
46046
|
useEffect24(() => {
|
|
45995
46047
|
if (typeof window === "undefined") return;
|
|
45996
|
-
localStorage.setItem(`
|
|
46048
|
+
localStorage.setItem(`assist-section-expanded-${annotationType}`, String(isExpanded));
|
|
45997
46049
|
}, [isExpanded, annotationType]);
|
|
45998
|
-
const
|
|
46050
|
+
const handleAssist = useCallback17(() => {
|
|
45999
46051
|
const motivation = annotationType === "highlight" ? "highlighting" : annotationType === "assessment" ? "assessing" : "commenting";
|
|
46000
|
-
eventBus.get("
|
|
46052
|
+
eventBus.get("annotate:assist-request").next({
|
|
46001
46053
|
motivation,
|
|
46002
46054
|
options: {
|
|
46003
46055
|
instructions: instructions.trim() || void 0,
|
|
@@ -46008,8 +46060,8 @@ function DetectSection({
|
|
|
46008
46060
|
setInstructions("");
|
|
46009
46061
|
setTone("");
|
|
46010
46062
|
}, [annotationType, instructions, tone, useDensity, density]);
|
|
46011
|
-
const handleDismissProgress =
|
|
46012
|
-
eventBus.get("
|
|
46063
|
+
const handleDismissProgress = useCallback17(() => {
|
|
46064
|
+
eventBus.get("annotate:progress-dismiss").next(void 0);
|
|
46013
46065
|
}, []);
|
|
46014
46066
|
return /* @__PURE__ */ jsxs20("div", { className: "semiont-panel__section", children: [
|
|
46015
46067
|
/* @__PURE__ */ jsxs20(
|
|
@@ -46020,7 +46072,7 @@ function DetectSection({
|
|
|
46020
46072
|
"aria-expanded": isExpanded,
|
|
46021
46073
|
type: "button",
|
|
46022
46074
|
children: [
|
|
46023
|
-
/* @__PURE__ */ jsx30("span", { children: t12(annotationType === "highlight" ? "
|
|
46075
|
+
/* @__PURE__ */ jsx30("span", { children: t12(annotationType === "highlight" ? "annotateHighlights" : annotationType === "assessment" ? "annotateAssessments" : "annotateComments") }),
|
|
46024
46076
|
/* @__PURE__ */ jsx30("span", { className: "semiont-panel__section-chevron", "data-expanded": isExpanded, children: "\u203A" })
|
|
46025
46077
|
]
|
|
46026
46078
|
}
|
|
@@ -46028,11 +46080,11 @@ function DetectSection({
|
|
|
46028
46080
|
isExpanded && /* @__PURE__ */ jsxs20(
|
|
46029
46081
|
"div",
|
|
46030
46082
|
{
|
|
46031
|
-
className: "semiont-
|
|
46032
|
-
"data-
|
|
46083
|
+
className: "semiont-assist-widget",
|
|
46084
|
+
"data-assisting": isAssisting && progress ? "true" : "false",
|
|
46033
46085
|
"data-type": annotationType,
|
|
46034
46086
|
children: [
|
|
46035
|
-
!
|
|
46087
|
+
!progress && /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
46036
46088
|
/* @__PURE__ */ jsxs20("div", { className: "semiont-form-field", children: [
|
|
46037
46089
|
/* @__PURE__ */ jsxs20("label", { className: "semiont-form-field__label", children: [
|
|
46038
46090
|
t12("instructions"),
|
|
@@ -46126,22 +46178,22 @@ function DetectSection({
|
|
|
46126
46178
|
/* @__PURE__ */ jsxs20(
|
|
46127
46179
|
"button",
|
|
46128
46180
|
{
|
|
46129
|
-
onClick:
|
|
46181
|
+
onClick: handleAssist,
|
|
46130
46182
|
className: "semiont-button",
|
|
46131
|
-
"data-variant": "
|
|
46183
|
+
"data-variant": "assist",
|
|
46132
46184
|
"data-type": annotationType,
|
|
46133
46185
|
children: [
|
|
46134
46186
|
/* @__PURE__ */ jsx30("span", { className: "semiont-button-icon", children: "\u2728" }),
|
|
46135
|
-
/* @__PURE__ */ jsx30("span", { children: t12("
|
|
46187
|
+
/* @__PURE__ */ jsx30("span", { children: t12("annotate") })
|
|
46136
46188
|
]
|
|
46137
46189
|
}
|
|
46138
46190
|
)
|
|
46139
46191
|
] }),
|
|
46140
|
-
|
|
46141
|
-
|
|
46142
|
-
/* @__PURE__ */ jsx30("div", { className: "semiont-
|
|
46143
|
-
|
|
46144
|
-
/* @__PURE__ */ jsxs20("span", { className: "semiont-
|
|
46192
|
+
progress && /* @__PURE__ */ jsxs20("div", { className: "semiont-annotation-progress", "data-type": annotationType, children: [
|
|
46193
|
+
progress.requestParams && progress.requestParams.length > 0 && /* @__PURE__ */ jsxs20("div", { className: "semiont-annotation-progress__params", "data-type": annotationType, children: [
|
|
46194
|
+
/* @__PURE__ */ jsx30("div", { className: "semiont-annotation-progress__params-title", children: "Request Parameters:" }),
|
|
46195
|
+
progress.requestParams.map((param, idx) => /* @__PURE__ */ jsxs20("div", { className: "semiont-annotation-progress__param", children: [
|
|
46196
|
+
/* @__PURE__ */ jsxs20("span", { className: "semiont-annotation-progress__param-label", children: [
|
|
46145
46197
|
param.label,
|
|
46146
46198
|
":"
|
|
46147
46199
|
] }),
|
|
@@ -46149,16 +46201,16 @@ function DetectSection({
|
|
|
46149
46201
|
param.value
|
|
46150
46202
|
] }, idx))
|
|
46151
46203
|
] }),
|
|
46152
|
-
/* @__PURE__ */ jsxs20("div", { className: "semiont-
|
|
46153
|
-
/* @__PURE__ */ jsxs20("div", { className: "semiont-
|
|
46154
|
-
/* @__PURE__ */ jsx30("span", { className: "semiont-
|
|
46155
|
-
/* @__PURE__ */ jsx30("span", { children:
|
|
46204
|
+
/* @__PURE__ */ jsxs20("div", { className: "semiont-annotation-progress__status", children: [
|
|
46205
|
+
/* @__PURE__ */ jsxs20("div", { className: "semiont-annotation-progress__message", children: [
|
|
46206
|
+
/* @__PURE__ */ jsx30("span", { className: "semiont-annotation-progress__icon", children: "\u2728" }),
|
|
46207
|
+
/* @__PURE__ */ jsx30("span", { children: progress.message })
|
|
46156
46208
|
] }),
|
|
46157
|
-
!
|
|
46209
|
+
!isAssisting && /* @__PURE__ */ jsx30(
|
|
46158
46210
|
"button",
|
|
46159
46211
|
{
|
|
46160
46212
|
onClick: handleDismissProgress,
|
|
46161
|
-
className: "semiont-
|
|
46213
|
+
className: "semiont-annotation-progress__close",
|
|
46162
46214
|
"aria-label": t12("closeProgress"),
|
|
46163
46215
|
title: t12("closeProgress"),
|
|
46164
46216
|
type: "button",
|
|
@@ -46204,8 +46256,8 @@ function getSelectorDisplayText(selector) {
|
|
|
46204
46256
|
function AssessmentPanel({
|
|
46205
46257
|
annotations,
|
|
46206
46258
|
pendingAnnotation,
|
|
46207
|
-
|
|
46208
|
-
|
|
46259
|
+
isAssisting = false,
|
|
46260
|
+
progress,
|
|
46209
46261
|
annotateMode = true,
|
|
46210
46262
|
scrollToAnnotationId,
|
|
46211
46263
|
onScrollCompleted,
|
|
@@ -46213,8 +46265,8 @@ function AssessmentPanel({
|
|
|
46213
46265
|
}) {
|
|
46214
46266
|
const t12 = useTranslations("AssessmentPanel");
|
|
46215
46267
|
const eventBus = useEventBus();
|
|
46216
|
-
const [newAssessmentText, setNewAssessmentText] =
|
|
46217
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
46268
|
+
const [newAssessmentText, setNewAssessmentText] = useState19("");
|
|
46269
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState19(null);
|
|
46218
46270
|
const containerRef = useRef17(null);
|
|
46219
46271
|
const entryRefs = useRef17(/* @__PURE__ */ new Map());
|
|
46220
46272
|
const sortedAnnotations = useMemo4(() => {
|
|
@@ -46225,7 +46277,7 @@ function AssessmentPanel({
|
|
|
46225
46277
|
return aSelector.start - bSelector.start;
|
|
46226
46278
|
});
|
|
46227
46279
|
}, [annotations]);
|
|
46228
|
-
const setEntryRef =
|
|
46280
|
+
const setEntryRef = useCallback18((id2, element2) => {
|
|
46229
46281
|
if (element2) {
|
|
46230
46282
|
entryRefs.current.set(id2, element2);
|
|
46231
46283
|
} else {
|
|
@@ -46266,7 +46318,7 @@ function AssessmentPanel({
|
|
|
46266
46318
|
const handleSaveNewAssessment = () => {
|
|
46267
46319
|
if (pendingAnnotation) {
|
|
46268
46320
|
const body = newAssessmentText.trim() ? [{ type: "TextualBody", value: newAssessmentText, purpose: "assessing" }] : [];
|
|
46269
|
-
eventBus.get("
|
|
46321
|
+
eventBus.get("annotate:create").next({
|
|
46270
46322
|
motivation: "assessing",
|
|
46271
46323
|
selector: pendingAnnotation.selector,
|
|
46272
46324
|
body
|
|
@@ -46278,19 +46330,19 @@ function AssessmentPanel({
|
|
|
46278
46330
|
if (!pendingAnnotation) return;
|
|
46279
46331
|
const handleEscape = (e6) => {
|
|
46280
46332
|
if (e6.key === "Escape") {
|
|
46281
|
-
eventBus.get("
|
|
46333
|
+
eventBus.get("annotate:cancel-pending").next(void 0);
|
|
46282
46334
|
setNewAssessmentText("");
|
|
46283
46335
|
}
|
|
46284
46336
|
};
|
|
46285
46337
|
document.addEventListener("keydown", handleEscape);
|
|
46286
46338
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
46287
46339
|
}, [pendingAnnotation]);
|
|
46288
|
-
const handleAnnotationClick =
|
|
46340
|
+
const handleAnnotationClick = useCallback18(({ annotationId }) => {
|
|
46289
46341
|
setFocusedAnnotationId(annotationId);
|
|
46290
46342
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
46291
46343
|
}, []);
|
|
46292
46344
|
useEventSubscriptions({
|
|
46293
|
-
"
|
|
46345
|
+
"attend:click": handleAnnotationClick
|
|
46294
46346
|
});
|
|
46295
46347
|
return /* @__PURE__ */ jsxs22("div", { className: "semiont-panel", children: [
|
|
46296
46348
|
/* @__PURE__ */ jsx32(PanelHeader, { annotationType: "assessment", count: annotations.length, title: t12("title") }),
|
|
@@ -46324,7 +46376,7 @@ function AssessmentPanel({
|
|
|
46324
46376
|
"button",
|
|
46325
46377
|
{
|
|
46326
46378
|
onClick: () => {
|
|
46327
|
-
eventBus.get("
|
|
46379
|
+
eventBus.get("annotate:cancel-pending").next(void 0);
|
|
46328
46380
|
setNewAssessmentText("");
|
|
46329
46381
|
},
|
|
46330
46382
|
className: "semiont-button semiont-button--secondary",
|
|
@@ -46346,11 +46398,11 @@ function AssessmentPanel({
|
|
|
46346
46398
|
] }),
|
|
46347
46399
|
/* @__PURE__ */ jsxs22("div", { ref: containerRef, className: "semiont-panel__content", children: [
|
|
46348
46400
|
annotateMode && /* @__PURE__ */ jsx32(
|
|
46349
|
-
|
|
46401
|
+
AssistSection,
|
|
46350
46402
|
{
|
|
46351
46403
|
annotationType: "assessment",
|
|
46352
|
-
|
|
46353
|
-
|
|
46404
|
+
isAssisting,
|
|
46405
|
+
progress
|
|
46354
46406
|
}
|
|
46355
46407
|
),
|
|
46356
46408
|
/* @__PURE__ */ jsx32("div", { className: "semiont-panel__list", children: sortedAnnotations.length === 0 ? /* @__PURE__ */ jsx32("p", { className: "semiont-panel__empty", children: t12("noAssessments") }) : sortedAnnotations.map((assessment) => /* @__PURE__ */ jsx32(
|
|
@@ -46446,7 +46498,7 @@ function CollaborationPanel({
|
|
|
46446
46498
|
}
|
|
46447
46499
|
|
|
46448
46500
|
// src/components/resource/panels/CommentEntry.tsx
|
|
46449
|
-
import { useState as
|
|
46501
|
+
import { useState as useState20, useEffect as useEffect26, useRef as useRef18, forwardRef as forwardRef2, useImperativeHandle } from "react";
|
|
46450
46502
|
import { getAnnotationExactText as getAnnotationExactText2, getCommentText } from "@semiont/api-client";
|
|
46451
46503
|
import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
46452
46504
|
function formatRelativeTime3(isoString) {
|
|
@@ -46473,8 +46525,8 @@ var CommentEntry = forwardRef2(
|
|
|
46473
46525
|
const t12 = useTranslations("CommentsPanel");
|
|
46474
46526
|
const eventBus = useEventBus();
|
|
46475
46527
|
const hoverProps = useHoverEmitter(comment2.id);
|
|
46476
|
-
const [isEditing, setIsEditing] =
|
|
46477
|
-
const [editText, setEditText] =
|
|
46528
|
+
const [isEditing, setIsEditing] = useState20(false);
|
|
46529
|
+
const [editText, setEditText] = useState20("");
|
|
46478
46530
|
const internalRef = useRef18(null);
|
|
46479
46531
|
useImperativeHandle(ref, () => internalRef.current);
|
|
46480
46532
|
const commentText = getCommentText(comment2) || "";
|
|
@@ -46506,7 +46558,7 @@ var CommentEntry = forwardRef2(
|
|
|
46506
46558
|
"data-type": "comment",
|
|
46507
46559
|
"data-focused": isFocused ? "true" : "false",
|
|
46508
46560
|
onClick: () => {
|
|
46509
|
-
eventBus.get("
|
|
46561
|
+
eventBus.get("attend:click").next({ annotationId: comment2.id, motivation: comment2.motivation });
|
|
46510
46562
|
},
|
|
46511
46563
|
...hoverProps,
|
|
46512
46564
|
children: [
|
|
@@ -46578,7 +46630,7 @@ var CommentEntry = forwardRef2(
|
|
|
46578
46630
|
);
|
|
46579
46631
|
|
|
46580
46632
|
// src/components/resource/panels/CommentsPanel.tsx
|
|
46581
|
-
import { useState as
|
|
46633
|
+
import { useState as useState21, useEffect as useEffect27, useRef as useRef19, useCallback as useCallback19, useMemo as useMemo5 } from "react";
|
|
46582
46634
|
import { getTextPositionSelector as getTextPositionSelector4, getTargetSelector as getTargetSelector6 } from "@semiont/api-client";
|
|
46583
46635
|
import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
46584
46636
|
function getSelectorDisplayText2(selector) {
|
|
@@ -46598,16 +46650,16 @@ function CommentsPanel({
|
|
|
46598
46650
|
annotations,
|
|
46599
46651
|
pendingAnnotation,
|
|
46600
46652
|
annotateMode = true,
|
|
46601
|
-
|
|
46602
|
-
|
|
46653
|
+
isAssisting = false,
|
|
46654
|
+
progress,
|
|
46603
46655
|
scrollToAnnotationId,
|
|
46604
46656
|
onScrollCompleted,
|
|
46605
46657
|
hoveredAnnotationId
|
|
46606
46658
|
}) {
|
|
46607
46659
|
const t12 = useTranslations("CommentsPanel");
|
|
46608
46660
|
const eventBus = useEventBus();
|
|
46609
|
-
const [newCommentText, setNewCommentText] =
|
|
46610
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
46661
|
+
const [newCommentText, setNewCommentText] = useState21("");
|
|
46662
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState21(null);
|
|
46611
46663
|
const containerRef = useRef19(null);
|
|
46612
46664
|
const entryRefs = useRef19(/* @__PURE__ */ new Map());
|
|
46613
46665
|
const sortedAnnotations = useMemo5(() => {
|
|
@@ -46618,7 +46670,7 @@ function CommentsPanel({
|
|
|
46618
46670
|
return aSelector.start - bSelector.start;
|
|
46619
46671
|
});
|
|
46620
46672
|
}, [annotations]);
|
|
46621
|
-
const setEntryRef =
|
|
46673
|
+
const setEntryRef = useCallback19((id2, element2) => {
|
|
46622
46674
|
if (element2) {
|
|
46623
46675
|
entryRefs.current.set(id2, element2);
|
|
46624
46676
|
} else {
|
|
@@ -46658,16 +46710,16 @@ function CommentsPanel({
|
|
|
46658
46710
|
container.scrollTo({ top: scrollTo, behavior: "smooth" });
|
|
46659
46711
|
}
|
|
46660
46712
|
}, [hoveredAnnotationId]);
|
|
46661
|
-
const handleAnnotationClick =
|
|
46713
|
+
const handleAnnotationClick = useCallback19(({ annotationId }) => {
|
|
46662
46714
|
setFocusedAnnotationId(annotationId);
|
|
46663
46715
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
46664
46716
|
}, []);
|
|
46665
46717
|
useEventSubscriptions({
|
|
46666
|
-
"
|
|
46718
|
+
"attend:click": handleAnnotationClick
|
|
46667
46719
|
});
|
|
46668
46720
|
const handleSaveNewComment = () => {
|
|
46669
46721
|
if (newCommentText.trim() && pendingAnnotation) {
|
|
46670
|
-
eventBus.get("
|
|
46722
|
+
eventBus.get("annotate:create").next({
|
|
46671
46723
|
motivation: "commenting",
|
|
46672
46724
|
selector: pendingAnnotation.selector,
|
|
46673
46725
|
body: [{ type: "TextualBody", value: newCommentText, purpose: "commenting" }]
|
|
@@ -46679,7 +46731,7 @@ function CommentsPanel({
|
|
|
46679
46731
|
if (!pendingAnnotation) return;
|
|
46680
46732
|
const handleEscape = (e6) => {
|
|
46681
46733
|
if (e6.key === "Escape") {
|
|
46682
|
-
eventBus.get("
|
|
46734
|
+
eventBus.get("annotate:cancel-pending").next(void 0);
|
|
46683
46735
|
setNewCommentText("");
|
|
46684
46736
|
}
|
|
46685
46737
|
};
|
|
@@ -46718,7 +46770,7 @@ function CommentsPanel({
|
|
|
46718
46770
|
"button",
|
|
46719
46771
|
{
|
|
46720
46772
|
onClick: () => {
|
|
46721
|
-
eventBus.get("
|
|
46773
|
+
eventBus.get("annotate:cancel-pending").next(void 0);
|
|
46722
46774
|
setNewCommentText("");
|
|
46723
46775
|
},
|
|
46724
46776
|
className: "semiont-button semiont-button--secondary",
|
|
@@ -46741,11 +46793,11 @@ function CommentsPanel({
|
|
|
46741
46793
|
] }),
|
|
46742
46794
|
/* @__PURE__ */ jsxs25("div", { ref: containerRef, className: "semiont-panel__content", children: [
|
|
46743
46795
|
annotateMode && /* @__PURE__ */ jsx35(
|
|
46744
|
-
|
|
46796
|
+
AssistSection,
|
|
46745
46797
|
{
|
|
46746
46798
|
annotationType: "comment",
|
|
46747
|
-
|
|
46748
|
-
|
|
46799
|
+
isAssisting,
|
|
46800
|
+
progress
|
|
46749
46801
|
}
|
|
46750
46802
|
),
|
|
46751
46803
|
/* @__PURE__ */ jsx35("div", { className: "semiont-panel__list", children: sortedAnnotations.length === 0 ? /* @__PURE__ */ jsx35("p", { className: "semiont-panel__empty", children: t12("noComments") }) : sortedAnnotations.map((comment2) => /* @__PURE__ */ jsx35(
|
|
@@ -46798,7 +46850,7 @@ var HighlightEntry = forwardRef3(
|
|
|
46798
46850
|
"data-type": "highlight",
|
|
46799
46851
|
"data-focused": isFocused ? "true" : "false",
|
|
46800
46852
|
onClick: () => {
|
|
46801
|
-
eventBus.get("
|
|
46853
|
+
eventBus.get("attend:click").next({ annotationId: highlight.id, motivation: highlight.motivation });
|
|
46802
46854
|
},
|
|
46803
46855
|
...hoverProps,
|
|
46804
46856
|
children: [
|
|
@@ -46821,14 +46873,14 @@ var HighlightEntry = forwardRef3(
|
|
|
46821
46873
|
);
|
|
46822
46874
|
|
|
46823
46875
|
// src/components/resource/panels/HighlightPanel.tsx
|
|
46824
|
-
import { useEffect as useEffect28, useState as
|
|
46876
|
+
import { useEffect as useEffect28, useState as useState22, useRef as useRef20, useCallback as useCallback20, useMemo as useMemo6 } from "react";
|
|
46825
46877
|
import { getTextPositionSelector as getTextPositionSelector5, getTargetSelector as getTargetSelector7 } from "@semiont/api-client";
|
|
46826
46878
|
import { jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
46827
46879
|
function HighlightPanel({
|
|
46828
46880
|
annotations,
|
|
46829
46881
|
pendingAnnotation,
|
|
46830
|
-
|
|
46831
|
-
|
|
46882
|
+
isAssisting = false,
|
|
46883
|
+
progress,
|
|
46832
46884
|
annotateMode = true,
|
|
46833
46885
|
scrollToAnnotationId,
|
|
46834
46886
|
onScrollCompleted,
|
|
@@ -46836,7 +46888,7 @@ function HighlightPanel({
|
|
|
46836
46888
|
}) {
|
|
46837
46889
|
const t12 = useTranslations("HighlightPanel");
|
|
46838
46890
|
const eventBus = useEventBus();
|
|
46839
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
46891
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState22(null);
|
|
46840
46892
|
const containerRef = useRef20(null);
|
|
46841
46893
|
const entryRefs = useRef20(/* @__PURE__ */ new Map());
|
|
46842
46894
|
const sortedAnnotations = useMemo6(() => {
|
|
@@ -46847,7 +46899,7 @@ function HighlightPanel({
|
|
|
46847
46899
|
return aSelector.start - bSelector.start;
|
|
46848
46900
|
});
|
|
46849
46901
|
}, [annotations]);
|
|
46850
|
-
const setEntryRef =
|
|
46902
|
+
const setEntryRef = useCallback20((id2, element2) => {
|
|
46851
46903
|
if (element2) {
|
|
46852
46904
|
entryRefs.current.set(id2, element2);
|
|
46853
46905
|
} else {
|
|
@@ -46885,16 +46937,16 @@ function HighlightPanel({
|
|
|
46885
46937
|
container.scrollTo({ top: scrollTo, behavior: "smooth" });
|
|
46886
46938
|
}
|
|
46887
46939
|
}, [hoveredAnnotationId]);
|
|
46888
|
-
const handleAnnotationClick =
|
|
46940
|
+
const handleAnnotationClick = useCallback20(({ annotationId }) => {
|
|
46889
46941
|
setFocusedAnnotationId(annotationId);
|
|
46890
46942
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
46891
46943
|
}, []);
|
|
46892
46944
|
useEventSubscriptions({
|
|
46893
|
-
"
|
|
46945
|
+
"attend:click": handleAnnotationClick
|
|
46894
46946
|
});
|
|
46895
46947
|
useEffect28(() => {
|
|
46896
46948
|
if (pendingAnnotation && pendingAnnotation.motivation === "highlighting") {
|
|
46897
|
-
eventBus.get("
|
|
46949
|
+
eventBus.get("annotate:create").next({
|
|
46898
46950
|
motivation: "highlighting",
|
|
46899
46951
|
selector: pendingAnnotation.selector,
|
|
46900
46952
|
body: []
|
|
@@ -46905,11 +46957,11 @@ function HighlightPanel({
|
|
|
46905
46957
|
/* @__PURE__ */ jsx36(PanelHeader, { annotationType: "highlight", count: annotations.length, title: t12("title") }),
|
|
46906
46958
|
/* @__PURE__ */ jsxs27("div", { ref: containerRef, className: "semiont-panel__content", children: [
|
|
46907
46959
|
annotateMode && /* @__PURE__ */ jsx36(
|
|
46908
|
-
|
|
46960
|
+
AssistSection,
|
|
46909
46961
|
{
|
|
46910
46962
|
annotationType: "highlight",
|
|
46911
|
-
|
|
46912
|
-
|
|
46963
|
+
isAssisting,
|
|
46964
|
+
progress
|
|
46913
46965
|
}
|
|
46914
46966
|
),
|
|
46915
46967
|
/* @__PURE__ */ jsx36("div", { className: "semiont-panel__list", children: sortedAnnotations.length === 0 ? /* @__PURE__ */ jsx36("p", { className: "semiont-panel__empty", children: t12("noHighlights") }) : sortedAnnotations.map((highlight) => /* @__PURE__ */ jsx36(
|
|
@@ -47033,7 +47085,7 @@ var ReferenceEntry = forwardRef4(
|
|
|
47033
47085
|
}
|
|
47034
47086
|
};
|
|
47035
47087
|
const handleComposeDocument = () => {
|
|
47036
|
-
eventBus.get("
|
|
47088
|
+
eventBus.get("resolve:create-manual").next({
|
|
47037
47089
|
annotationUri: reference.id,
|
|
47038
47090
|
title: selectedText,
|
|
47039
47091
|
entityTypes
|
|
@@ -47042,7 +47094,7 @@ var ReferenceEntry = forwardRef4(
|
|
|
47042
47094
|
const handleUnlink = () => {
|
|
47043
47095
|
const sourceUri = typeof reference.target === "object" && "source" in reference.target ? reference.target.source : "";
|
|
47044
47096
|
if (sourceUri) {
|
|
47045
|
-
eventBus.get("
|
|
47097
|
+
eventBus.get("resolve:update-body").next({
|
|
47046
47098
|
annotationUri: reference.id,
|
|
47047
47099
|
resourceId: sourceUri.split("/resources/")[1] || "",
|
|
47048
47100
|
operations: [{ op: "remove" }]
|
|
@@ -47052,14 +47104,14 @@ var ReferenceEntry = forwardRef4(
|
|
|
47052
47104
|
};
|
|
47053
47105
|
const handleGenerate = () => {
|
|
47054
47106
|
const resourceUri2 = typeof reference.target === "object" && "source" in reference.target ? reference.target.source : "";
|
|
47055
|
-
eventBus.get("
|
|
47107
|
+
eventBus.get("generate:modal-open").next({
|
|
47056
47108
|
annotationUri: reference.id,
|
|
47057
47109
|
resourceUri: resourceUri2,
|
|
47058
47110
|
defaultTitle: selectedText
|
|
47059
47111
|
});
|
|
47060
47112
|
};
|
|
47061
47113
|
const handleSearch = () => {
|
|
47062
|
-
eventBus.get("
|
|
47114
|
+
eventBus.get("resolve:link").next({
|
|
47063
47115
|
annotationUri: reference.id,
|
|
47064
47116
|
searchTerm: selectedText
|
|
47065
47117
|
});
|
|
@@ -47072,7 +47124,7 @@ var ReferenceEntry = forwardRef4(
|
|
|
47072
47124
|
"data-type": "reference",
|
|
47073
47125
|
"data-focused": isFocused ? "true" : "false",
|
|
47074
47126
|
onClick: () => {
|
|
47075
|
-
eventBus.get("
|
|
47127
|
+
eventBus.get("attend:click").next({ annotationId: reference.id, motivation: reference.motivation });
|
|
47076
47128
|
},
|
|
47077
47129
|
...hoverProps,
|
|
47078
47130
|
children: [
|
|
@@ -47165,7 +47217,7 @@ var ReferenceEntry = forwardRef4(
|
|
|
47165
47217
|
);
|
|
47166
47218
|
|
|
47167
47219
|
// src/components/resource/panels/ReferencesPanel.tsx
|
|
47168
|
-
import { useState as
|
|
47220
|
+
import { useState as useState23, useRef as useRef22, useEffect as useEffect30, useCallback as useCallback21, useMemo as useMemo7 } from "react";
|
|
47169
47221
|
import { getTextPositionSelector as getTextPositionSelector6, getTargetSelector as getTargetSelector9 } from "@semiont/api-client";
|
|
47170
47222
|
import { Fragment as Fragment8, jsx as jsx39, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
47171
47223
|
function getSelectorDisplayText3(selector) {
|
|
@@ -47183,8 +47235,8 @@ function getSelectorDisplayText3(selector) {
|
|
|
47183
47235
|
}
|
|
47184
47236
|
function ReferencesPanel({
|
|
47185
47237
|
annotations = [],
|
|
47186
|
-
|
|
47187
|
-
|
|
47238
|
+
isAssisting,
|
|
47239
|
+
progress,
|
|
47188
47240
|
annotateMode = true,
|
|
47189
47241
|
Link,
|
|
47190
47242
|
routes,
|
|
@@ -47197,24 +47249,23 @@ function ReferencesPanel({
|
|
|
47197
47249
|
onScrollCompleted,
|
|
47198
47250
|
hoveredAnnotationId
|
|
47199
47251
|
}) {
|
|
47200
|
-
const t12 = useTranslations("
|
|
47201
|
-
const tRef = useTranslations("ReferencesPanel");
|
|
47252
|
+
const t12 = useTranslations("ReferencesPanel");
|
|
47202
47253
|
const eventBus = useEventBus();
|
|
47203
|
-
const [selectedEntityTypes, setSelectedEntityTypes] =
|
|
47204
|
-
const [
|
|
47205
|
-
const [pendingEntityTypes, setPendingEntityTypes] =
|
|
47206
|
-
const [includeDescriptiveReferences, setIncludeDescriptiveReferences] =
|
|
47207
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
47254
|
+
const [selectedEntityTypes, setSelectedEntityTypes] = useState23([]);
|
|
47255
|
+
const [lastAnnotationLog, setLastDetectionLog] = useState23(null);
|
|
47256
|
+
const [pendingEntityTypes, setPendingEntityTypes] = useState23([]);
|
|
47257
|
+
const [includeDescriptiveReferences, setIncludeDescriptiveReferences] = useState23(false);
|
|
47258
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState23(null);
|
|
47208
47259
|
const containerRef = useRef22(null);
|
|
47209
|
-
const [
|
|
47260
|
+
const [isAssistExpanded, setIsDetectExpanded] = useState23(() => {
|
|
47210
47261
|
if (typeof window === "undefined") return true;
|
|
47211
|
-
const stored = localStorage.getItem("
|
|
47262
|
+
const stored = localStorage.getItem("assist-section-expanded-reference");
|
|
47212
47263
|
return stored ? stored === "true" : true;
|
|
47213
47264
|
});
|
|
47214
47265
|
useEffect30(() => {
|
|
47215
47266
|
if (typeof window === "undefined") return;
|
|
47216
|
-
localStorage.setItem("
|
|
47217
|
-
}, [
|
|
47267
|
+
localStorage.setItem("assist-section-expanded-reference", String(isAssistExpanded));
|
|
47268
|
+
}, [isAssistExpanded]);
|
|
47218
47269
|
const entryRefs = useRef22(/* @__PURE__ */ new Map());
|
|
47219
47270
|
const sortedAnnotations = useMemo7(() => {
|
|
47220
47271
|
return [...annotations].sort((a15, b8) => {
|
|
@@ -47224,7 +47275,7 @@ function ReferencesPanel({
|
|
|
47224
47275
|
return aSelector.start - bSelector.start;
|
|
47225
47276
|
});
|
|
47226
47277
|
}, [annotations]);
|
|
47227
|
-
const setEntryRef =
|
|
47278
|
+
const setEntryRef = useCallback21((id2, element2) => {
|
|
47228
47279
|
if (element2) {
|
|
47229
47280
|
entryRefs.current.set(id2, element2);
|
|
47230
47281
|
} else {
|
|
@@ -47266,16 +47317,16 @@ function ReferencesPanel({
|
|
|
47266
47317
|
container.scrollTo({ top: scrollTo, behavior: "smooth" });
|
|
47267
47318
|
}
|
|
47268
47319
|
}, [hoveredAnnotationId]);
|
|
47269
|
-
const handleAnnotationClick =
|
|
47320
|
+
const handleAnnotationClick = useCallback21(({ annotationId }) => {
|
|
47270
47321
|
setFocusedAnnotationId(annotationId);
|
|
47271
47322
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
47272
47323
|
}, []);
|
|
47273
47324
|
useEventSubscriptions({
|
|
47274
|
-
"
|
|
47325
|
+
"attend:click": handleAnnotationClick
|
|
47275
47326
|
});
|
|
47276
|
-
const
|
|
47327
|
+
const handleAssist = () => {
|
|
47277
47328
|
setLastDetectionLog(null);
|
|
47278
|
-
eventBus.get("
|
|
47329
|
+
eventBus.get("annotate:assist-request").next({
|
|
47279
47330
|
motivation: "linking",
|
|
47280
47331
|
options: {
|
|
47281
47332
|
entityTypes: selectedEntityTypes,
|
|
@@ -47285,16 +47336,16 @@ function ReferencesPanel({
|
|
|
47285
47336
|
};
|
|
47286
47337
|
const hasSavedLogRef = useRef22(false);
|
|
47287
47338
|
useEffect30(() => {
|
|
47288
|
-
if (
|
|
47339
|
+
if (isAssisting) {
|
|
47289
47340
|
hasSavedLogRef.current = false;
|
|
47290
47341
|
return;
|
|
47291
47342
|
}
|
|
47292
|
-
if (!
|
|
47343
|
+
if (!isAssisting && !hasSavedLogRef.current && progress?.completedEntityTypes) {
|
|
47293
47344
|
hasSavedLogRef.current = true;
|
|
47294
|
-
setLastDetectionLog(
|
|
47345
|
+
setLastDetectionLog(progress.completedEntityTypes);
|
|
47295
47346
|
setSelectedEntityTypes([]);
|
|
47296
47347
|
}
|
|
47297
|
-
}, [
|
|
47348
|
+
}, [isAssisting, progress?.completedEntityTypes]);
|
|
47298
47349
|
const togglePendingEntityType = (type) => {
|
|
47299
47350
|
setPendingEntityTypes(
|
|
47300
47351
|
(prev) => prev.includes(type) ? prev.filter((t13) => t13 !== type) : [...prev, type]
|
|
@@ -47303,7 +47354,7 @@ function ReferencesPanel({
|
|
|
47303
47354
|
const handleCreateReference = () => {
|
|
47304
47355
|
if (pendingAnnotation) {
|
|
47305
47356
|
const entityType3 = pendingEntityTypes.join(",") || void 0;
|
|
47306
|
-
eventBus.get("
|
|
47357
|
+
eventBus.get("annotate:create").next({
|
|
47307
47358
|
motivation: "linking",
|
|
47308
47359
|
selector: pendingAnnotation.selector,
|
|
47309
47360
|
body: entityType3 ? [{ type: "TextualBody", value: entityType3, purpose: "tagging" }] : []
|
|
@@ -47315,7 +47366,7 @@ function ReferencesPanel({
|
|
|
47315
47366
|
if (!pendingAnnotation) return;
|
|
47316
47367
|
const handleEscape = (e6) => {
|
|
47317
47368
|
if (e6.key === "Escape") {
|
|
47318
|
-
eventBus.get("
|
|
47369
|
+
eventBus.get("annotate:cancel-pending").next(void 0);
|
|
47319
47370
|
setPendingEntityTypes([]);
|
|
47320
47371
|
}
|
|
47321
47372
|
};
|
|
@@ -47323,17 +47374,17 @@ function ReferencesPanel({
|
|
|
47323
47374
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
47324
47375
|
}, [pendingAnnotation]);
|
|
47325
47376
|
return /* @__PURE__ */ jsxs30("div", { className: "semiont-panel", children: [
|
|
47326
|
-
/* @__PURE__ */ jsx39(PanelHeader, { annotationType: "reference", count: annotations.length, title:
|
|
47377
|
+
/* @__PURE__ */ jsx39(PanelHeader, { annotationType: "reference", count: annotations.length, title: t12("title") }),
|
|
47327
47378
|
pendingAnnotation && pendingAnnotation.motivation === "linking" && /* @__PURE__ */ jsxs30("div", { className: "semiont-annotation-prompt", "data-type": "reference", children: [
|
|
47328
47379
|
/* @__PURE__ */ jsx39("div", { className: "semiont-annotation-prompt__quote", children: (() => {
|
|
47329
47380
|
const displayText = getSelectorDisplayText3(pendingAnnotation.selector);
|
|
47330
47381
|
if (displayText) {
|
|
47331
47382
|
return `"${displayText.substring(0, 100)}${displayText.length > 100 ? "..." : ""}"`;
|
|
47332
47383
|
}
|
|
47333
|
-
return
|
|
47384
|
+
return t12("fragmentSelected");
|
|
47334
47385
|
})() }),
|
|
47335
47386
|
allEntityTypes.length > 0 && /* @__PURE__ */ jsxs30("div", { className: "semiont-form-field", children: [
|
|
47336
|
-
/* @__PURE__ */ jsx39("p", { className: "semiont-form-field__label", children:
|
|
47387
|
+
/* @__PURE__ */ jsx39("p", { className: "semiont-form-field__label", children: t12("entityTypesOptional") }),
|
|
47337
47388
|
/* @__PURE__ */ jsx39("div", { className: "semiont-tag-selector", children: allEntityTypes.map((type) => /* @__PURE__ */ jsx39(
|
|
47338
47389
|
"button",
|
|
47339
47390
|
{
|
|
@@ -47350,12 +47401,12 @@ function ReferencesPanel({
|
|
|
47350
47401
|
"button",
|
|
47351
47402
|
{
|
|
47352
47403
|
onClick: () => {
|
|
47353
|
-
eventBus.get("
|
|
47404
|
+
eventBus.get("annotate:cancel-pending").next(void 0);
|
|
47354
47405
|
setPendingEntityTypes([]);
|
|
47355
47406
|
},
|
|
47356
47407
|
className: "semiont-button semiont-button--secondary",
|
|
47357
47408
|
"data-type": "reference",
|
|
47358
|
-
children:
|
|
47409
|
+
children: t12("cancel")
|
|
47359
47410
|
}
|
|
47360
47411
|
),
|
|
47361
47412
|
/* @__PURE__ */ jsxs30(
|
|
@@ -47366,7 +47417,7 @@ function ReferencesPanel({
|
|
|
47366
47417
|
"data-type": "reference",
|
|
47367
47418
|
children: [
|
|
47368
47419
|
"\u{1F517} ",
|
|
47369
|
-
|
|
47420
|
+
t12("createReference")
|
|
47370
47421
|
]
|
|
47371
47422
|
}
|
|
47372
47423
|
)
|
|
@@ -47377,21 +47428,29 @@ function ReferencesPanel({
|
|
|
47377
47428
|
/* @__PURE__ */ jsxs30(
|
|
47378
47429
|
"button",
|
|
47379
47430
|
{
|
|
47380
|
-
onClick: () => setIsDetectExpanded(!
|
|
47431
|
+
onClick: () => setIsDetectExpanded(!isAssistExpanded),
|
|
47381
47432
|
className: "semiont-panel__section-title semiont-panel__section-title--collapsible",
|
|
47382
|
-
"aria-expanded":
|
|
47433
|
+
"aria-expanded": isAssistExpanded,
|
|
47383
47434
|
type: "button",
|
|
47384
47435
|
children: [
|
|
47385
|
-
/* @__PURE__ */ jsx39("span", { children: t12("
|
|
47386
|
-
/* @__PURE__ */ jsx39("span", { className: "semiont-panel__section-chevron", "data-expanded":
|
|
47436
|
+
/* @__PURE__ */ jsx39("span", { children: t12("annotateReferences") }),
|
|
47437
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-panel__section-chevron", "data-expanded": isAssistExpanded, children: "\u203A" })
|
|
47387
47438
|
]
|
|
47388
47439
|
}
|
|
47389
47440
|
),
|
|
47390
|
-
|
|
47391
|
-
!
|
|
47392
|
-
/* @__PURE__ */ jsxs30("div", { className: "semiont-
|
|
47393
|
-
/* @__PURE__ */ jsx39("
|
|
47394
|
-
/* @__PURE__ */
|
|
47441
|
+
isAssistExpanded && /* @__PURE__ */ jsxs30(Fragment8, { children: [
|
|
47442
|
+
!isAssisting && /* @__PURE__ */ jsx39("div", { className: "semiont-assist-widget", "data-type": "reference", children: /* @__PURE__ */ jsxs30(Fragment8, { children: [
|
|
47443
|
+
lastAnnotationLog && lastAnnotationLog.length > 0 && /* @__PURE__ */ jsx39("div", { className: "semiont-assist-widget__log", children: /* @__PURE__ */ jsx39("div", { className: "semiont-assist-widget__log-items", children: lastAnnotationLog.map((item, index2) => /* @__PURE__ */ jsxs30("div", { className: "semiont-assist-widget__log-item", children: [
|
|
47444
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-assist-widget__log-check", children: "\u2713" }),
|
|
47445
|
+
/* @__PURE__ */ jsxs30("span", { className: "semiont-assist-widget__log-type", children: [
|
|
47446
|
+
item.entityType,
|
|
47447
|
+
":"
|
|
47448
|
+
] }),
|
|
47449
|
+
/* @__PURE__ */ jsx39("span", { children: t12("found", { count: item.foundCount }) })
|
|
47450
|
+
] }, index2)) }) }),
|
|
47451
|
+
/* @__PURE__ */ jsxs30("div", { className: "semiont-assist-widget__entity-types", children: [
|
|
47452
|
+
/* @__PURE__ */ jsx39("p", { className: "semiont-assist-widget__label", children: t12("selectEntityTypes") }),
|
|
47453
|
+
/* @__PURE__ */ jsx39("div", { className: "semiont-assist-widget__chips", children: allEntityTypes.length > 0 ? allEntityTypes.map((type) => /* @__PURE__ */ jsx39(
|
|
47395
47454
|
"button",
|
|
47396
47455
|
{
|
|
47397
47456
|
onClick: () => {
|
|
@@ -47406,77 +47465,57 @@ function ReferencesPanel({
|
|
|
47406
47465
|
children: type
|
|
47407
47466
|
},
|
|
47408
47467
|
type
|
|
47409
|
-
)) : /* @__PURE__ */ jsx39("p", { className: "semiont-
|
|
47468
|
+
)) : /* @__PURE__ */ jsx39("p", { className: "semiont-assist-widget__no-types", children: t12("noEntityTypes") }) })
|
|
47410
47469
|
] }),
|
|
47411
|
-
selectedEntityTypes.length > 0 && /* @__PURE__ */ jsx39("p", { className: "semiont-
|
|
47412
|
-
/* @__PURE__ */ jsxs30("div", { className: "semiont-
|
|
47413
|
-
/* @__PURE__ */ jsxs30("label", { className: "semiont-
|
|
47470
|
+
selectedEntityTypes.length > 0 && /* @__PURE__ */ jsx39("p", { className: "semiont-assist-widget__count", children: t12("typesSelected", { count: selectedEntityTypes.length }) }),
|
|
47471
|
+
/* @__PURE__ */ jsxs30("div", { className: "semiont-assist-widget__checkbox-group", children: [
|
|
47472
|
+
/* @__PURE__ */ jsxs30("label", { className: "semiont-assist-widget__checkbox-label", children: [
|
|
47414
47473
|
/* @__PURE__ */ jsx39(
|
|
47415
47474
|
"input",
|
|
47416
47475
|
{
|
|
47417
47476
|
type: "checkbox",
|
|
47418
47477
|
checked: includeDescriptiveReferences,
|
|
47419
47478
|
onChange: (e6) => setIncludeDescriptiveReferences(e6.target.checked),
|
|
47420
|
-
className: "semiont-
|
|
47479
|
+
className: "semiont-assist-widget__checkbox"
|
|
47421
47480
|
}
|
|
47422
47481
|
),
|
|
47423
|
-
/* @__PURE__ */ jsx39("span", { children:
|
|
47482
|
+
/* @__PURE__ */ jsx39("span", { children: t12("includeDescriptiveReferences") })
|
|
47424
47483
|
] }),
|
|
47425
|
-
/* @__PURE__ */ jsx39("p", { className: "semiont-
|
|
47484
|
+
/* @__PURE__ */ jsx39("p", { className: "semiont-assist-widget__checkbox-hint", children: t12("descriptiveReferencesTooltip") })
|
|
47426
47485
|
] }),
|
|
47427
47486
|
/* @__PURE__ */ jsxs30(
|
|
47428
47487
|
"button",
|
|
47429
47488
|
{
|
|
47430
|
-
onClick:
|
|
47489
|
+
onClick: handleAssist,
|
|
47431
47490
|
disabled: selectedEntityTypes.length === 0,
|
|
47432
|
-
title: t12("
|
|
47491
|
+
title: t12("annotate"),
|
|
47433
47492
|
className: "semiont-button",
|
|
47434
|
-
"data-variant": "
|
|
47493
|
+
"data-variant": "assist",
|
|
47435
47494
|
"data-type": "reference",
|
|
47436
47495
|
children: [
|
|
47437
47496
|
/* @__PURE__ */ jsx39("span", { className: "semiont-button-icon", children: "\u2728" }),
|
|
47438
|
-
/* @__PURE__ */ jsx39("span", { children: t12("
|
|
47497
|
+
/* @__PURE__ */ jsx39("span", { children: t12("annotate") })
|
|
47439
47498
|
]
|
|
47440
47499
|
}
|
|
47441
47500
|
)
|
|
47442
47501
|
] }) }),
|
|
47443
|
-
|
|
47444
|
-
|
|
47502
|
+
isAssisting && progress && /* @__PURE__ */ jsx39(
|
|
47503
|
+
AnnotateReferencesProgressWidget,
|
|
47445
47504
|
{
|
|
47446
|
-
progress
|
|
47505
|
+
progress,
|
|
47447
47506
|
annotationType: "reference"
|
|
47448
47507
|
}
|
|
47449
|
-
)
|
|
47450
|
-
!detectionProgress && lastDetectionLog && lastDetectionLog.length > 0 && /* @__PURE__ */ jsxs30("div", { className: "semiont-detect-widget__log", children: [
|
|
47451
|
-
/* @__PURE__ */ jsx39("div", { className: "semiont-detect-widget__log-items", children: lastDetectionLog.map((item, index2) => /* @__PURE__ */ jsxs30("div", { className: "semiont-detect-widget__log-item", children: [
|
|
47452
|
-
/* @__PURE__ */ jsx39("span", { className: "semiont-detect-widget__log-check", children: "\u2713" }),
|
|
47453
|
-
/* @__PURE__ */ jsxs30("span", { className: "semiont-detect-widget__log-type", children: [
|
|
47454
|
-
item.entityType,
|
|
47455
|
-
":"
|
|
47456
|
-
] }),
|
|
47457
|
-
/* @__PURE__ */ jsx39("span", { children: t12("found", { count: item.foundCount }) })
|
|
47458
|
-
] }, index2)) }),
|
|
47459
|
-
/* @__PURE__ */ jsx39(
|
|
47460
|
-
"button",
|
|
47461
|
-
{
|
|
47462
|
-
onClick: () => setLastDetectionLog(null),
|
|
47463
|
-
className: "semiont-button",
|
|
47464
|
-
"data-variant": "detect",
|
|
47465
|
-
"data-type": "reference",
|
|
47466
|
-
children: t12("more")
|
|
47467
|
-
}
|
|
47468
|
-
)
|
|
47469
|
-
] })
|
|
47508
|
+
)
|
|
47470
47509
|
] })
|
|
47471
47510
|
] }),
|
|
47472
47511
|
/* @__PURE__ */ jsxs30("div", { children: [
|
|
47473
47512
|
/* @__PURE__ */ jsx39("div", { className: "semiont-panel__divider", children: /* @__PURE__ */ jsxs30("h3", { className: "semiont-panel__subtitle", children: [
|
|
47474
|
-
|
|
47513
|
+
t12("outgoingReferences"),
|
|
47475
47514
|
" (",
|
|
47476
47515
|
sortedAnnotations.length,
|
|
47477
47516
|
")"
|
|
47478
47517
|
] }) }),
|
|
47479
|
-
/* @__PURE__ */ jsx39("div", { className: "semiont-panel__list", children: sortedAnnotations.length === 0 ? /* @__PURE__ */ jsx39("p", { className: "semiont-panel__empty-message", children:
|
|
47518
|
+
/* @__PURE__ */ jsx39("div", { className: "semiont-panel__list", children: sortedAnnotations.length === 0 ? /* @__PURE__ */ jsx39("p", { className: "semiont-panel__empty-message", children: t12("noReferences") }) : sortedAnnotations.map((reference) => /* @__PURE__ */ jsx39(
|
|
47480
47519
|
ReferenceEntry,
|
|
47481
47520
|
{
|
|
47482
47521
|
reference,
|
|
@@ -47492,13 +47531,13 @@ function ReferencesPanel({
|
|
|
47492
47531
|
] }),
|
|
47493
47532
|
/* @__PURE__ */ jsxs30("div", { children: [
|
|
47494
47533
|
/* @__PURE__ */ jsx39("div", { className: "semiont-panel__divider", children: /* @__PURE__ */ jsxs30("h3", { className: "semiont-panel__subtitle", children: [
|
|
47495
|
-
|
|
47534
|
+
t12("incomingReferences"),
|
|
47496
47535
|
" (",
|
|
47497
47536
|
referencedBy.length,
|
|
47498
47537
|
")",
|
|
47499
47538
|
referencedByLoading && /* @__PURE__ */ jsxs30("span", { className: "semiont-panel__loading-indicator", children: [
|
|
47500
47539
|
"(",
|
|
47501
|
-
|
|
47540
|
+
t12("loading"),
|
|
47502
47541
|
")"
|
|
47503
47542
|
] })
|
|
47504
47543
|
] }) }),
|
|
@@ -47506,24 +47545,24 @@ function ReferencesPanel({
|
|
|
47506
47545
|
const resourceId = ref.target.source.split("/").pop() || "";
|
|
47507
47546
|
return /* @__PURE__ */ jsxs30("div", { className: "semiont-reference-item semiont-reference-item--incoming", children: [
|
|
47508
47547
|
/* @__PURE__ */ jsxs30("div", { className: "semiont-reference-item__header", children: [
|
|
47509
|
-
/* @__PURE__ */ jsx39("span", { className: "semiont-reference-item__title", children: ref.resourceName ||
|
|
47548
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-reference-item__title", children: ref.resourceName || t12("untitledResource") }),
|
|
47510
47549
|
/* @__PURE__ */ jsx39(
|
|
47511
47550
|
Link,
|
|
47512
47551
|
{
|
|
47513
47552
|
href: routes.resourceDetail(resourceId),
|
|
47514
47553
|
className: "semiont-reference-item__link",
|
|
47515
|
-
title:
|
|
47554
|
+
title: t12("open"),
|
|
47516
47555
|
children: "\u{1F517}"
|
|
47517
47556
|
}
|
|
47518
47557
|
)
|
|
47519
47558
|
] }),
|
|
47520
47559
|
/* @__PURE__ */ jsxs30("span", { className: "semiont-reference-item__excerpt", children: [
|
|
47521
47560
|
'"',
|
|
47522
|
-
ref.target.selector?.exact ||
|
|
47561
|
+
ref.target.selector?.exact || t12("noText"),
|
|
47523
47562
|
'"'
|
|
47524
47563
|
] })
|
|
47525
47564
|
] }, ref.id);
|
|
47526
|
-
}) }) : /* @__PURE__ */ jsx39("p", { className: "semiont-panel__empty-message semiont-panel__empty-message--small", children: referencedByLoading ?
|
|
47565
|
+
}) }) : /* @__PURE__ */ jsx39("p", { className: "semiont-panel__empty-message semiont-panel__empty-message--small", children: referencedByLoading ? t12("loadingEllipsis") : t12("noIncomingReferences") })
|
|
47527
47566
|
] })
|
|
47528
47567
|
] })
|
|
47529
47568
|
] });
|
|
@@ -47579,7 +47618,7 @@ function ResourceInfoPanel({
|
|
|
47579
47618
|
/* @__PURE__ */ jsxs31(
|
|
47580
47619
|
"button",
|
|
47581
47620
|
{
|
|
47582
|
-
onClick: () => eventBus.get("
|
|
47621
|
+
onClick: () => eventBus.get("generate:clone").next(void 0),
|
|
47583
47622
|
className: "semiont-resource-button semiont-resource-button--secondary",
|
|
47584
47623
|
children: [
|
|
47585
47624
|
"\u{1F517} ",
|
|
@@ -47712,7 +47751,7 @@ var TagEntry = forwardRef5(
|
|
|
47712
47751
|
{
|
|
47713
47752
|
ref,
|
|
47714
47753
|
onClick: () => {
|
|
47715
|
-
eventBus.get("
|
|
47754
|
+
eventBus.get("attend:click").next({ annotationId: tag.id, motivation: tag.motivation });
|
|
47716
47755
|
},
|
|
47717
47756
|
...hoverProps,
|
|
47718
47757
|
className: `semiont-annotation-entry${isHovered ? " semiont-annotation-pulse" : ""}`,
|
|
@@ -47736,7 +47775,7 @@ var TagEntry = forwardRef5(
|
|
|
47736
47775
|
);
|
|
47737
47776
|
|
|
47738
47777
|
// src/components/resource/panels/TaggingPanel.tsx
|
|
47739
|
-
import { useState as
|
|
47778
|
+
import { useState as useState24, useEffect as useEffect31, useRef as useRef23, useCallback as useCallback22, useMemo as useMemo8 } from "react";
|
|
47740
47779
|
import { getTextPositionSelector as getTextPositionSelector7, getTargetSelector as getTargetSelector10 } from "@semiont/api-client";
|
|
47741
47780
|
import { Fragment as Fragment10, jsx as jsx43, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
47742
47781
|
function getSelectorDisplayText4(selector) {
|
|
@@ -47755,8 +47794,8 @@ function getSelectorDisplayText4(selector) {
|
|
|
47755
47794
|
function TaggingPanel({
|
|
47756
47795
|
annotations,
|
|
47757
47796
|
annotateMode = true,
|
|
47758
|
-
|
|
47759
|
-
|
|
47797
|
+
isAssisting = false,
|
|
47798
|
+
progress,
|
|
47760
47799
|
pendingAnnotation,
|
|
47761
47800
|
scrollToAnnotationId,
|
|
47762
47801
|
onScrollCompleted,
|
|
@@ -47764,25 +47803,25 @@ function TaggingPanel({
|
|
|
47764
47803
|
}) {
|
|
47765
47804
|
const t12 = useTranslations("TaggingPanel");
|
|
47766
47805
|
const eventBus = useEventBus();
|
|
47767
|
-
const [selectedSchemaId, setSelectedSchemaId] =
|
|
47768
|
-
const [selectedCategories, setSelectedCategories] =
|
|
47769
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
47806
|
+
const [selectedSchemaId, setSelectedSchemaId] = useState24("legal-irac");
|
|
47807
|
+
const [selectedCategories, setSelectedCategories] = useState24(/* @__PURE__ */ new Set());
|
|
47808
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState24(null);
|
|
47770
47809
|
const containerRef = useRef23(null);
|
|
47771
|
-
const [
|
|
47810
|
+
const [isAssistExpanded, setIsDetectExpanded] = useState24(() => {
|
|
47772
47811
|
if (typeof window === "undefined") return true;
|
|
47773
|
-
const stored = localStorage.getItem("
|
|
47812
|
+
const stored = localStorage.getItem("assist-section-expanded-tag");
|
|
47774
47813
|
return stored ? stored === "true" : true;
|
|
47775
47814
|
});
|
|
47776
47815
|
useEffect31(() => {
|
|
47777
47816
|
if (typeof window === "undefined") return;
|
|
47778
|
-
localStorage.setItem("
|
|
47779
|
-
}, [
|
|
47780
|
-
const handleAnnotationClick =
|
|
47817
|
+
localStorage.setItem("assist-section-expanded-tag", String(isAssistExpanded));
|
|
47818
|
+
}, [isAssistExpanded]);
|
|
47819
|
+
const handleAnnotationClick = useCallback22(({ annotationId }) => {
|
|
47781
47820
|
setFocusedAnnotationId(annotationId);
|
|
47782
47821
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
47783
47822
|
}, []);
|
|
47784
47823
|
useEventSubscriptions({
|
|
47785
|
-
"
|
|
47824
|
+
"attend:click": handleAnnotationClick
|
|
47786
47825
|
});
|
|
47787
47826
|
const entryRefs = useRef23(/* @__PURE__ */ new Map());
|
|
47788
47827
|
const sortedAnnotations = useMemo8(() => {
|
|
@@ -47793,7 +47832,7 @@ function TaggingPanel({
|
|
|
47793
47832
|
return aSelector.start - bSelector.start;
|
|
47794
47833
|
});
|
|
47795
47834
|
}, [annotations]);
|
|
47796
|
-
const setEntryRef =
|
|
47835
|
+
const setEntryRef = useCallback22((id2, element2) => {
|
|
47797
47836
|
if (element2) {
|
|
47798
47837
|
entryRefs.current.set(id2, element2);
|
|
47799
47838
|
} else {
|
|
@@ -47854,9 +47893,9 @@ function TaggingPanel({
|
|
|
47854
47893
|
const handleDeselectAll = () => {
|
|
47855
47894
|
setSelectedCategories(/* @__PURE__ */ new Set());
|
|
47856
47895
|
};
|
|
47857
|
-
const
|
|
47896
|
+
const handleAssist = () => {
|
|
47858
47897
|
if (selectedCategories.size > 0) {
|
|
47859
|
-
eventBus.get("
|
|
47898
|
+
eventBus.get("annotate:assist-request").next({
|
|
47860
47899
|
motivation: "tagging",
|
|
47861
47900
|
options: {
|
|
47862
47901
|
schemaId: selectedSchemaId,
|
|
@@ -47870,7 +47909,7 @@ function TaggingPanel({
|
|
|
47870
47909
|
if (!pendingAnnotation) return;
|
|
47871
47910
|
const handleEscape = (e6) => {
|
|
47872
47911
|
if (e6.key === "Escape") {
|
|
47873
|
-
eventBus.get("
|
|
47912
|
+
eventBus.get("annotate:cancel-pending").next(void 0);
|
|
47874
47913
|
}
|
|
47875
47914
|
};
|
|
47876
47915
|
document.addEventListener("keydown", handleEscape);
|
|
@@ -47908,7 +47947,7 @@ function TaggingPanel({
|
|
|
47908
47947
|
className: "semiont-select",
|
|
47909
47948
|
onChange: (e6) => {
|
|
47910
47949
|
if (e6.target.value && pendingAnnotation) {
|
|
47911
|
-
eventBus.get("
|
|
47950
|
+
eventBus.get("annotate:create").next({
|
|
47912
47951
|
motivation: "tagging",
|
|
47913
47952
|
selector: pendingAnnotation.selector,
|
|
47914
47953
|
body: [
|
|
@@ -47937,7 +47976,7 @@ function TaggingPanel({
|
|
|
47937
47976
|
/* @__PURE__ */ jsx43("div", { className: "semiont-annotation-prompt__footer", children: /* @__PURE__ */ jsx43(
|
|
47938
47977
|
"button",
|
|
47939
47978
|
{
|
|
47940
|
-
onClick: () => eventBus.get("
|
|
47979
|
+
onClick: () => eventBus.get("annotate:cancel-pending").next(void 0),
|
|
47941
47980
|
className: "semiont-button semiont-button--secondary",
|
|
47942
47981
|
"data-type": "tag",
|
|
47943
47982
|
children: t12("cancel")
|
|
@@ -47948,18 +47987,18 @@ function TaggingPanel({
|
|
|
47948
47987
|
/* @__PURE__ */ jsxs34(
|
|
47949
47988
|
"button",
|
|
47950
47989
|
{
|
|
47951
|
-
onClick: () => setIsDetectExpanded(!
|
|
47990
|
+
onClick: () => setIsDetectExpanded(!isAssistExpanded),
|
|
47952
47991
|
className: "semiont-panel__section-title semiont-panel__section-title--collapsible",
|
|
47953
|
-
"aria-expanded":
|
|
47992
|
+
"aria-expanded": isAssistExpanded,
|
|
47954
47993
|
type: "button",
|
|
47955
47994
|
children: [
|
|
47956
|
-
/* @__PURE__ */ jsx43("span", { children: t12("
|
|
47957
|
-
/* @__PURE__ */ jsx43("span", { className: "semiont-panel__section-chevron", "data-expanded":
|
|
47995
|
+
/* @__PURE__ */ jsx43("span", { children: t12("annotateTags") }),
|
|
47996
|
+
/* @__PURE__ */ jsx43("span", { className: "semiont-panel__section-chevron", "data-expanded": isAssistExpanded, children: "\u203A" })
|
|
47958
47997
|
]
|
|
47959
47998
|
}
|
|
47960
47999
|
),
|
|
47961
|
-
|
|
47962
|
-
!
|
|
48000
|
+
isAssistExpanded && /* @__PURE__ */ jsxs34("div", { className: "semiont-assist-widget", "data-assisting": isAssisting && progress ? "true" : "false", "data-type": "tag", children: [
|
|
48001
|
+
!isAssisting && !progress && /* @__PURE__ */ jsxs34(Fragment10, { children: [
|
|
47963
48002
|
/* @__PURE__ */ jsxs34("div", { className: "semiont-form-field", children: [
|
|
47964
48003
|
/* @__PURE__ */ jsx43("label", { className: "semiont-form-field__label", children: t12("selectSchema") }),
|
|
47965
48004
|
/* @__PURE__ */ jsx43(
|
|
@@ -48027,22 +48066,22 @@ function TaggingPanel({
|
|
|
48027
48066
|
/* @__PURE__ */ jsxs34(
|
|
48028
48067
|
"button",
|
|
48029
48068
|
{
|
|
48030
|
-
onClick:
|
|
48031
|
-
disabled: selectedCategories.size === 0 ||
|
|
48069
|
+
onClick: handleAssist,
|
|
48070
|
+
disabled: selectedCategories.size === 0 || isAssisting,
|
|
48032
48071
|
className: "semiont-button",
|
|
48033
|
-
"data-variant": "
|
|
48072
|
+
"data-variant": "assist",
|
|
48034
48073
|
"data-type": "tag",
|
|
48035
48074
|
children: [
|
|
48036
48075
|
/* @__PURE__ */ jsx43("span", { className: "semiont-button-icon", children: "\u2728" }),
|
|
48037
|
-
/* @__PURE__ */ jsx43("span", { children: t12("
|
|
48076
|
+
/* @__PURE__ */ jsx43("span", { children: t12("annotate") })
|
|
48038
48077
|
]
|
|
48039
48078
|
}
|
|
48040
48079
|
),
|
|
48041
|
-
|
|
48042
|
-
|
|
48043
|
-
/* @__PURE__ */ jsx43("div", { className: "semiont-
|
|
48044
|
-
|
|
48045
|
-
/* @__PURE__ */ jsxs34("span", { className: "semiont-
|
|
48080
|
+
isAssisting && progress && /* @__PURE__ */ jsxs34("div", { className: "semiont-annotation-progress", "data-type": "tag", children: [
|
|
48081
|
+
progress.requestParams && progress.requestParams.length > 0 && /* @__PURE__ */ jsxs34("div", { className: "semiont-annotation-progress__params", "data-type": "tag", children: [
|
|
48082
|
+
/* @__PURE__ */ jsx43("div", { className: "semiont-annotation-progress__params-title", children: "Request Parameters:" }),
|
|
48083
|
+
progress.requestParams.map((param, idx) => /* @__PURE__ */ jsxs34("div", { className: "semiont-annotation-progress__param", children: [
|
|
48084
|
+
/* @__PURE__ */ jsxs34("span", { className: "semiont-annotation-progress__param-label", children: [
|
|
48046
48085
|
param.label,
|
|
48047
48086
|
":"
|
|
48048
48087
|
] }),
|
|
@@ -48050,29 +48089,29 @@ function TaggingPanel({
|
|
|
48050
48089
|
param.value
|
|
48051
48090
|
] }, idx))
|
|
48052
48091
|
] }),
|
|
48053
|
-
/* @__PURE__ */ jsxs34("div", { className: "semiont-
|
|
48054
|
-
/* @__PURE__ */ jsxs34("div", { className: "semiont-
|
|
48055
|
-
/* @__PURE__ */ jsx43("span", { className: "semiont-
|
|
48056
|
-
/* @__PURE__ */ jsx43("span", { children:
|
|
48092
|
+
/* @__PURE__ */ jsxs34("div", { className: "semiont-annotation-progress__status", children: [
|
|
48093
|
+
/* @__PURE__ */ jsxs34("div", { className: "semiont-annotation-progress__message", children: [
|
|
48094
|
+
/* @__PURE__ */ jsx43("span", { className: "semiont-annotation-progress__icon", children: "\u2728" }),
|
|
48095
|
+
/* @__PURE__ */ jsx43("span", { children: progress.message })
|
|
48057
48096
|
] }),
|
|
48058
|
-
|
|
48097
|
+
progress.currentCategory && /* @__PURE__ */ jsxs34("div", { className: "semiont-annotation-progress__details", children: [
|
|
48059
48098
|
"Processing: ",
|
|
48060
|
-
|
|
48061
|
-
|
|
48099
|
+
progress.currentCategory,
|
|
48100
|
+
progress.processedCategories !== void 0 && progress.totalCategories !== void 0 && /* @__PURE__ */ jsxs34(Fragment10, { children: [
|
|
48062
48101
|
" (",
|
|
48063
|
-
|
|
48102
|
+
progress.processedCategories,
|
|
48064
48103
|
"/",
|
|
48065
|
-
|
|
48104
|
+
progress.totalCategories,
|
|
48066
48105
|
")"
|
|
48067
48106
|
] })
|
|
48068
48107
|
] })
|
|
48069
48108
|
] }),
|
|
48070
|
-
|
|
48109
|
+
progress.percentage !== void 0 && /* @__PURE__ */ jsx43("div", { className: "semiont-progress-bar", children: /* @__PURE__ */ jsx43(
|
|
48071
48110
|
"div",
|
|
48072
48111
|
{
|
|
48073
48112
|
className: "semiont-progress-bar__fill",
|
|
48074
48113
|
"data-type": "tag",
|
|
48075
|
-
style: { width: `${
|
|
48114
|
+
style: { width: `${progress.percentage}%` }
|
|
48076
48115
|
}
|
|
48077
48116
|
) })
|
|
48078
48117
|
] })
|
|
@@ -48093,7 +48132,7 @@ function TaggingPanel({
|
|
|
48093
48132
|
}
|
|
48094
48133
|
|
|
48095
48134
|
// src/components/resource/panels/UnifiedAnnotationsPanel.tsx
|
|
48096
|
-
import { useState as
|
|
48135
|
+
import { useState as useState25, useEffect as useEffect32 } from "react";
|
|
48097
48136
|
import { jsx as jsx44, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
48098
48137
|
var TAB_ORDER = ["statistics", "reference", "highlight", "assessment", "comment", "tag"];
|
|
48099
48138
|
function UnifiedAnnotationsPanel(props) {
|
|
@@ -48115,7 +48154,7 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
48115
48154
|
}
|
|
48116
48155
|
}
|
|
48117
48156
|
const grouped = groups;
|
|
48118
|
-
const [activeTab, setActiveTab] =
|
|
48157
|
+
const [activeTab, setActiveTab] = useState25(() => {
|
|
48119
48158
|
if (typeof window === "undefined") return props.initialTab || "statistics";
|
|
48120
48159
|
const storageKey = props.resourceId ? `annotations-tab-${props.resourceId}` : "annotations-tab-global";
|
|
48121
48160
|
const stored = localStorage.getItem(storageKey);
|
|
@@ -48202,13 +48241,13 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
48202
48241
|
const annotator = props.annotators[activeTab];
|
|
48203
48242
|
if (!annotator) return null;
|
|
48204
48243
|
const annotations = grouped[activeTab] || [];
|
|
48205
|
-
const
|
|
48206
|
-
const
|
|
48244
|
+
const isAssisting = props.assistingMotivation === annotator.motivation;
|
|
48245
|
+
const progress = props.progress ?? null;
|
|
48207
48246
|
const commonProps = {
|
|
48208
48247
|
annotations,
|
|
48209
48248
|
pendingAnnotation: props.pendingAnnotation,
|
|
48210
|
-
|
|
48211
|
-
|
|
48249
|
+
isAssisting,
|
|
48250
|
+
progress,
|
|
48212
48251
|
annotateMode: props.annotateMode,
|
|
48213
48252
|
scrollToAnnotationId: props.scrollToAnnotationId,
|
|
48214
48253
|
onScrollCompleted: props.onScrollCompleted,
|
|
@@ -48228,8 +48267,8 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
48228
48267
|
{
|
|
48229
48268
|
annotations: commonProps.annotations,
|
|
48230
48269
|
pendingAnnotation: commonProps.pendingAnnotation,
|
|
48231
|
-
|
|
48232
|
-
|
|
48270
|
+
isAssisting: commonProps.isAssisting,
|
|
48271
|
+
progress: commonProps.progress,
|
|
48233
48272
|
annotateMode: commonProps.annotateMode,
|
|
48234
48273
|
scrollToAnnotationId: commonProps.scrollToAnnotationId,
|
|
48235
48274
|
onScrollCompleted: commonProps.onScrollCompleted,
|
|
@@ -48273,7 +48312,7 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
48273
48312
|
}
|
|
48274
48313
|
|
|
48275
48314
|
// src/components/navigation/Footer.tsx
|
|
48276
|
-
import { useState as
|
|
48315
|
+
import { useState as useState26 } from "react";
|
|
48277
48316
|
import { Fragment as Fragment11, jsx as jsx45, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
48278
48317
|
function Footer({
|
|
48279
48318
|
Link,
|
|
@@ -48284,7 +48323,7 @@ function Footer({
|
|
|
48284
48323
|
apiDocsUrl = "/api/docs",
|
|
48285
48324
|
sourceCodeUrl = "https://github.com/The-AI-Alliance/semiont"
|
|
48286
48325
|
}) {
|
|
48287
|
-
const [showCookiePreferences, setShowCookiePreferences] =
|
|
48326
|
+
const [showCookiePreferences, setShowCookiePreferences] = useState26(false);
|
|
48288
48327
|
return /* @__PURE__ */ jsxs36(Fragment11, { children: [
|
|
48289
48328
|
/* @__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: [
|
|
48290
48329
|
/* @__PURE__ */ jsx45("div", { className: "semiont-footer__copyright", children: t12("copyright", { year: (/* @__PURE__ */ new Date()).getFullYear() }) }),
|
|
@@ -48422,7 +48461,7 @@ function NavigationMenu({
|
|
|
48422
48461
|
}
|
|
48423
48462
|
|
|
48424
48463
|
// src/components/navigation/ObservableLink.tsx
|
|
48425
|
-
import { useCallback as
|
|
48464
|
+
import { useCallback as useCallback23, useRef as useRef24, useEffect as useEffect33 } from "react";
|
|
48426
48465
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
48427
48466
|
function ObservableLink({
|
|
48428
48467
|
href,
|
|
@@ -48436,7 +48475,7 @@ function ObservableLink({
|
|
|
48436
48475
|
useEffect33(() => {
|
|
48437
48476
|
onClickRef.current = onClick;
|
|
48438
48477
|
});
|
|
48439
|
-
const handleClick =
|
|
48478
|
+
const handleClick = useCallback23((e6) => {
|
|
48440
48479
|
eventBus.get("navigation:link-clicked").next({
|
|
48441
48480
|
href,
|
|
48442
48481
|
label
|
|
@@ -48455,7 +48494,7 @@ function ObservableLink({
|
|
|
48455
48494
|
}
|
|
48456
48495
|
|
|
48457
48496
|
// src/components/navigation/SimpleNavigation.tsx
|
|
48458
|
-
import { useState as
|
|
48497
|
+
import { useState as useState27, useRef as useRef25, useEffect as useEffect34 } from "react";
|
|
48459
48498
|
import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
48460
48499
|
function SimpleNavigation({
|
|
48461
48500
|
title,
|
|
@@ -48470,7 +48509,7 @@ function SimpleNavigation({
|
|
|
48470
48509
|
}) {
|
|
48471
48510
|
const ChevronLeftIcon = icons.chevronLeft;
|
|
48472
48511
|
const BarsIcon = icons.bars;
|
|
48473
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
48512
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState27(false);
|
|
48474
48513
|
const dropdownRef = useRef25(null);
|
|
48475
48514
|
const eventBus = useEventBus();
|
|
48476
48515
|
const toggleDropdown = () => setIsDropdownOpen(!isDropdownOpen);
|
|
@@ -48551,14 +48590,14 @@ function SimpleNavigation({
|
|
|
48551
48590
|
}
|
|
48552
48591
|
|
|
48553
48592
|
// src/components/navigation/CollapsibleResourceNavigation.tsx
|
|
48554
|
-
import { useCallback as
|
|
48593
|
+
import { useCallback as useCallback29, useState as useState31, useRef as useRef30, useEffect as useEffect39 } from "react";
|
|
48555
48594
|
|
|
48556
48595
|
// ../../node_modules/@dnd-kit/core/dist/core.esm.js
|
|
48557
|
-
import React20, { createContext as createContext7, useContext as useContext7, useEffect as useEffect36, useState as
|
|
48596
|
+
import React20, { createContext as createContext7, useContext as useContext7, useEffect as useEffect36, useState as useState29, useCallback as useCallback26, useMemo as useMemo10, useRef as useRef27, memo, useReducer, cloneElement, forwardRef as forwardRef6 } from "react";
|
|
48558
48597
|
import { createPortal, unstable_batchedUpdates } from "react-dom";
|
|
48559
48598
|
|
|
48560
48599
|
// ../../node_modules/@dnd-kit/utilities/dist/utilities.esm.js
|
|
48561
|
-
import { useMemo as useMemo9, useLayoutEffect, useEffect as useEffect35, useRef as useRef26, useCallback as
|
|
48600
|
+
import { useMemo as useMemo9, useLayoutEffect, useEffect as useEffect35, useRef as useRef26, useCallback as useCallback24 } from "react";
|
|
48562
48601
|
function useCombinedRefs() {
|
|
48563
48602
|
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48564
48603
|
refs[_key] = arguments[_key];
|
|
@@ -48632,7 +48671,7 @@ function useEvent(handler) {
|
|
|
48632
48671
|
useIsomorphicLayoutEffect(() => {
|
|
48633
48672
|
handlerRef.current = handler;
|
|
48634
48673
|
});
|
|
48635
|
-
return
|
|
48674
|
+
return useCallback24(function() {
|
|
48636
48675
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48637
48676
|
args[_key] = arguments[_key];
|
|
48638
48677
|
}
|
|
@@ -48641,10 +48680,10 @@ function useEvent(handler) {
|
|
|
48641
48680
|
}
|
|
48642
48681
|
function useInterval() {
|
|
48643
48682
|
const intervalRef = useRef26(null);
|
|
48644
|
-
const set =
|
|
48683
|
+
const set = useCallback24((listener, duration) => {
|
|
48645
48684
|
intervalRef.current = setInterval(listener, duration);
|
|
48646
48685
|
}, []);
|
|
48647
|
-
const clear =
|
|
48686
|
+
const clear = useCallback24(() => {
|
|
48648
48687
|
if (intervalRef.current !== null) {
|
|
48649
48688
|
clearInterval(intervalRef.current);
|
|
48650
48689
|
intervalRef.current = null;
|
|
@@ -48679,7 +48718,7 @@ function useLazyMemo(callback, dependencies) {
|
|
|
48679
48718
|
function useNodeRef(onChange) {
|
|
48680
48719
|
const onChangeHandler = useEvent(onChange);
|
|
48681
48720
|
const node2 = useRef26(null);
|
|
48682
|
-
const setNodeRef =
|
|
48721
|
+
const setNodeRef = useCallback24(
|
|
48683
48722
|
(element2) => {
|
|
48684
48723
|
if (element2 !== node2.current) {
|
|
48685
48724
|
onChangeHandler == null ? void 0 : onChangeHandler(element2, node2.current);
|
|
@@ -48834,7 +48873,7 @@ function findFirstFocusableNode(element2) {
|
|
|
48834
48873
|
}
|
|
48835
48874
|
|
|
48836
48875
|
// ../../node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js
|
|
48837
|
-
import React19, { useState as
|
|
48876
|
+
import React19, { useState as useState28, useCallback as useCallback25 } from "react";
|
|
48838
48877
|
var hiddenStyles = {
|
|
48839
48878
|
display: "none"
|
|
48840
48879
|
};
|
|
@@ -48877,8 +48916,8 @@ function LiveRegion(_ref) {
|
|
|
48877
48916
|
}, announcement);
|
|
48878
48917
|
}
|
|
48879
48918
|
function useAnnouncement() {
|
|
48880
|
-
const [announcement, setAnnouncement] =
|
|
48881
|
-
const announce =
|
|
48919
|
+
const [announcement, setAnnouncement] = useState28("");
|
|
48920
|
+
const announce = useCallback25((value) => {
|
|
48882
48921
|
if (value != null) {
|
|
48883
48922
|
setAnnouncement(value);
|
|
48884
48923
|
}
|
|
@@ -48902,12 +48941,12 @@ function useDndMonitor(listener) {
|
|
|
48902
48941
|
}, [listener, registerListener]);
|
|
48903
48942
|
}
|
|
48904
48943
|
function useDndMonitorProvider() {
|
|
48905
|
-
const [listeners] =
|
|
48906
|
-
const registerListener =
|
|
48944
|
+
const [listeners] = useState29(() => /* @__PURE__ */ new Set());
|
|
48945
|
+
const registerListener = useCallback26((listener) => {
|
|
48907
48946
|
listeners.add(listener);
|
|
48908
48947
|
return () => listeners.delete(listener);
|
|
48909
48948
|
}, [listeners]);
|
|
48910
|
-
const dispatch =
|
|
48949
|
+
const dispatch = useCallback26((_ref) => {
|
|
48911
48950
|
let {
|
|
48912
48951
|
type,
|
|
48913
48952
|
event
|
|
@@ -48968,7 +49007,7 @@ function Accessibility(_ref) {
|
|
|
48968
49007
|
announcement
|
|
48969
49008
|
} = useAnnouncement();
|
|
48970
49009
|
const liveRegionId = useUniqueId("DndLiveRegion");
|
|
48971
|
-
const [mounted, setMounted] =
|
|
49010
|
+
const [mounted, setMounted] = useState29(false);
|
|
48972
49011
|
useEffect36(() => {
|
|
48973
49012
|
setMounted(true);
|
|
48974
49013
|
}, []);
|
|
@@ -50327,7 +50366,7 @@ function useAutoScroller(_ref) {
|
|
|
50327
50366
|
}
|
|
50328
50367
|
}, [activator, draggingRect, pointerCoordinates]);
|
|
50329
50368
|
const scrollContainerRef = useRef27(null);
|
|
50330
|
-
const autoScroll =
|
|
50369
|
+
const autoScroll = useCallback26(() => {
|
|
50331
50370
|
const scrollContainer = scrollContainerRef.current;
|
|
50332
50371
|
if (!scrollContainer) {
|
|
50333
50372
|
return;
|
|
@@ -50478,7 +50517,7 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
50478
50517
|
dependencies,
|
|
50479
50518
|
config
|
|
50480
50519
|
} = _ref;
|
|
50481
|
-
const [queue, setQueue] =
|
|
50520
|
+
const [queue, setQueue] = useState29(null);
|
|
50482
50521
|
const {
|
|
50483
50522
|
frequency,
|
|
50484
50523
|
measure,
|
|
@@ -50487,7 +50526,7 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
50487
50526
|
const containersRef = useRef27(containers);
|
|
50488
50527
|
const disabled = isDisabled();
|
|
50489
50528
|
const disabledRef = useLatestValue(disabled);
|
|
50490
|
-
const measureDroppableContainers =
|
|
50529
|
+
const measureDroppableContainers = useCallback26(function(ids2) {
|
|
50491
50530
|
if (ids2 === void 0) {
|
|
50492
50531
|
ids2 = [];
|
|
50493
50532
|
}
|
|
@@ -50643,7 +50682,7 @@ function useRect(element2, measure, fallbackRect2) {
|
|
|
50643
50682
|
if (measure === void 0) {
|
|
50644
50683
|
measure = defaultMeasure;
|
|
50645
50684
|
}
|
|
50646
|
-
const [rect, setRect] =
|
|
50685
|
+
const [rect, setRect] = useState29(null);
|
|
50647
50686
|
function measureRect() {
|
|
50648
50687
|
setRect((currentRect) => {
|
|
50649
50688
|
if (!element2) {
|
|
@@ -50717,9 +50756,9 @@ function useScrollableAncestors(node2) {
|
|
|
50717
50756
|
return ancestors;
|
|
50718
50757
|
}
|
|
50719
50758
|
function useScrollOffsets(elements) {
|
|
50720
|
-
const [scrollCoordinates, setScrollCoordinates] =
|
|
50759
|
+
const [scrollCoordinates, setScrollCoordinates] = useState29(null);
|
|
50721
50760
|
const prevElements = useRef27(elements);
|
|
50722
|
-
const handleScroll =
|
|
50761
|
+
const handleScroll = useCallback26((event) => {
|
|
50723
50762
|
const scrollingElement = getScrollableElement(event.target);
|
|
50724
50763
|
if (!scrollingElement) {
|
|
50725
50764
|
return;
|
|
@@ -50842,7 +50881,7 @@ function useRects(elements, measure) {
|
|
|
50842
50881
|
}
|
|
50843
50882
|
const [firstElement] = elements;
|
|
50844
50883
|
const windowRect2 = useWindowRect(firstElement ? getWindow(firstElement) : null);
|
|
50845
|
-
const [rects, setRects] =
|
|
50884
|
+
const [rects, setRects] = useState29(defaultValue$2);
|
|
50846
50885
|
function measureRects() {
|
|
50847
50886
|
setRects(() => {
|
|
50848
50887
|
if (!elements.length) {
|
|
@@ -50875,8 +50914,8 @@ function useDragOverlayMeasuring(_ref) {
|
|
|
50875
50914
|
let {
|
|
50876
50915
|
measure
|
|
50877
50916
|
} = _ref;
|
|
50878
|
-
const [rect, setRect] =
|
|
50879
|
-
const handleResize =
|
|
50917
|
+
const [rect, setRect] = useState29(null);
|
|
50918
|
+
const handleResize = useCallback26((entries) => {
|
|
50880
50919
|
for (const {
|
|
50881
50920
|
target
|
|
50882
50921
|
} of entries) {
|
|
@@ -50896,7 +50935,7 @@ function useDragOverlayMeasuring(_ref) {
|
|
|
50896
50935
|
const resizeObserver = useResizeObserver({
|
|
50897
50936
|
callback: handleResize
|
|
50898
50937
|
});
|
|
50899
|
-
const handleNodeChange =
|
|
50938
|
+
const handleNodeChange = useCallback26((element2) => {
|
|
50900
50939
|
const node2 = getMeasurableNode(element2);
|
|
50901
50940
|
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
50902
50941
|
if (node2) {
|
|
@@ -51276,7 +51315,7 @@ var DndContext = /* @__PURE__ */ memo(function DndContext2(_ref) {
|
|
|
51276
51315
|
const store = useReducer(reducer, void 0, getInitialState);
|
|
51277
51316
|
const [state, dispatch] = store;
|
|
51278
51317
|
const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();
|
|
51279
|
-
const [status, setStatus] =
|
|
51318
|
+
const [status, setStatus] = useState29(Status.Uninitialized);
|
|
51280
51319
|
const isInitialized = status === Status.Initialized;
|
|
51281
51320
|
const {
|
|
51282
51321
|
draggable: {
|
|
@@ -51303,8 +51342,8 @@ var DndContext = /* @__PURE__ */ memo(function DndContext2(_ref) {
|
|
|
51303
51342
|
} : null;
|
|
51304
51343
|
}, [activeId, node2]);
|
|
51305
51344
|
const activeRef = useRef27(null);
|
|
51306
|
-
const [activeSensor, setActiveSensor] =
|
|
51307
|
-
const [activatorEvent, setActivatorEvent] =
|
|
51345
|
+
const [activeSensor, setActiveSensor] = useState29(null);
|
|
51346
|
+
const [activatorEvent, setActivatorEvent] = useState29(null);
|
|
51308
51347
|
const latestProps = useLatestValue(props, Object.values(props));
|
|
51309
51348
|
const draggableDescribedById = useUniqueId("DndDescribedBy", id2);
|
|
51310
51349
|
const enabledDroppableContainers = useMemo10(() => droppableContainers.getEnabled(), [droppableContainers]);
|
|
@@ -51388,11 +51427,11 @@ var DndContext = /* @__PURE__ */ memo(function DndContext2(_ref) {
|
|
|
51388
51427
|
pointerCoordinates
|
|
51389
51428
|
}) : null;
|
|
51390
51429
|
const overId = getFirstCollision(collisions, "id");
|
|
51391
|
-
const [over, setOver] =
|
|
51430
|
+
const [over, setOver] = useState29(null);
|
|
51392
51431
|
const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
|
|
51393
51432
|
const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
|
|
51394
51433
|
const activeSensorRef = useRef27(null);
|
|
51395
|
-
const instantiateSensor =
|
|
51434
|
+
const instantiateSensor = useCallback26(
|
|
51396
51435
|
(event, _ref2) => {
|
|
51397
51436
|
let {
|
|
51398
51437
|
sensor: Sensor,
|
|
@@ -51550,7 +51589,7 @@ var DndContext = /* @__PURE__ */ memo(function DndContext2(_ref) {
|
|
|
51550
51589
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51551
51590
|
[draggableNodes]
|
|
51552
51591
|
);
|
|
51553
|
-
const bindActivatorToSensorInstantiator =
|
|
51592
|
+
const bindActivatorToSensorInstantiator = useCallback26((handler, sensor) => {
|
|
51554
51593
|
return (event, active2) => {
|
|
51555
51594
|
const nativeEvent = event.nativeEvent;
|
|
51556
51595
|
const activeDraggableNode = draggableNodes.get(active2);
|
|
@@ -51865,7 +51904,7 @@ function useDroppable(_ref) {
|
|
|
51865
51904
|
...resizeObserverConfig
|
|
51866
51905
|
};
|
|
51867
51906
|
const ids2 = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id2);
|
|
51868
|
-
const handleResize =
|
|
51907
|
+
const handleResize = useCallback26(
|
|
51869
51908
|
() => {
|
|
51870
51909
|
if (!resizeObserverConnected.current) {
|
|
51871
51910
|
resizeObserverConnected.current = true;
|
|
@@ -51886,7 +51925,7 @@ function useDroppable(_ref) {
|
|
|
51886
51925
|
callback: handleResize,
|
|
51887
51926
|
disabled: resizeObserverDisabled || !active
|
|
51888
51927
|
});
|
|
51889
|
-
const handleNodeChange =
|
|
51928
|
+
const handleNodeChange = useCallback26((newElement, previousElement) => {
|
|
51890
51929
|
if (!resizeObserver) {
|
|
51891
51930
|
return;
|
|
51892
51931
|
}
|
|
@@ -51952,7 +51991,7 @@ function useDroppable(_ref) {
|
|
|
51952
51991
|
}
|
|
51953
51992
|
|
|
51954
51993
|
// ../../node_modules/@dnd-kit/sortable/dist/sortable.esm.js
|
|
51955
|
-
import React21, { useMemo as useMemo11, useRef as useRef28, useEffect as useEffect37, useState as
|
|
51994
|
+
import React21, { useMemo as useMemo11, useRef as useRef28, useEffect as useEffect37, useState as useState30, useContext as useContext8 } from "react";
|
|
51956
51995
|
function arrayMove(array, from, to) {
|
|
51957
51996
|
const newArray = array.slice();
|
|
51958
51997
|
newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]);
|
|
@@ -52193,7 +52232,7 @@ function useDerivedTransform(_ref) {
|
|
|
52193
52232
|
node: node2,
|
|
52194
52233
|
rect
|
|
52195
52234
|
} = _ref;
|
|
52196
|
-
const [derivedTransform, setDerivedtransform] =
|
|
52235
|
+
const [derivedTransform, setDerivedtransform] = useState30(null);
|
|
52197
52236
|
const previousIndex = useRef28(index2);
|
|
52198
52237
|
useIsomorphicLayoutEffect(() => {
|
|
52199
52238
|
if (!disabled && index2 !== previousIndex.current && node2.current) {
|
|
@@ -52535,7 +52574,7 @@ function isAfter(a15, b8) {
|
|
|
52535
52574
|
}
|
|
52536
52575
|
|
|
52537
52576
|
// src/components/navigation/SortableResourceTab.tsx
|
|
52538
|
-
import { useCallback as
|
|
52577
|
+
import { useCallback as useCallback27, useRef as useRef29, useEffect as useEffect38 } from "react";
|
|
52539
52578
|
import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
52540
52579
|
function SortableResourceTab({
|
|
52541
52580
|
resource,
|
|
@@ -52569,7 +52608,7 @@ function SortableResourceTab({
|
|
|
52569
52608
|
};
|
|
52570
52609
|
const iconEmoji = getResourceIcon(resource.mediaType);
|
|
52571
52610
|
const isCurrentlyDragging = isSortableDragging || isDragging;
|
|
52572
|
-
const handleKeyDown =
|
|
52611
|
+
const handleKeyDown = useCallback27((e6) => {
|
|
52573
52612
|
if (onReorderRef.current && e6.altKey) {
|
|
52574
52613
|
if (e6.key === "ArrowUp") {
|
|
52575
52614
|
e6.preventDefault();
|
|
@@ -52622,37 +52661,37 @@ function SortableResourceTab({
|
|
|
52622
52661
|
}
|
|
52623
52662
|
|
|
52624
52663
|
// src/hooks/useDragAnnouncements.ts
|
|
52625
|
-
import { useCallback as
|
|
52664
|
+
import { useCallback as useCallback28 } from "react";
|
|
52626
52665
|
function useDragAnnouncements() {
|
|
52627
52666
|
const { announce } = useLiveRegion();
|
|
52628
|
-
const announceReorder =
|
|
52667
|
+
const announceReorder = useCallback28((message) => {
|
|
52629
52668
|
announce(message, "assertive");
|
|
52630
52669
|
}, [announce]);
|
|
52631
|
-
const announcePickup =
|
|
52670
|
+
const announcePickup = useCallback28((resourceName, position3, total) => {
|
|
52632
52671
|
announce(
|
|
52633
52672
|
`Picked up ${resourceName}. Position ${position3} of ${total}. Use arrow keys to move, space to drop.`,
|
|
52634
52673
|
"assertive"
|
|
52635
52674
|
);
|
|
52636
52675
|
}, [announce]);
|
|
52637
|
-
const announceDrop =
|
|
52676
|
+
const announceDrop = useCallback28((resourceName, newPosition, total) => {
|
|
52638
52677
|
announce(
|
|
52639
52678
|
`Dropped ${resourceName} at position ${newPosition} of ${total}.`,
|
|
52640
52679
|
"assertive"
|
|
52641
52680
|
);
|
|
52642
52681
|
}, [announce]);
|
|
52643
|
-
const announceMove =
|
|
52682
|
+
const announceMove = useCallback28((resourceName, direction, newPosition, total) => {
|
|
52644
52683
|
announce(
|
|
52645
52684
|
`Moved ${resourceName} ${direction} to position ${newPosition} of ${total}.`,
|
|
52646
52685
|
"polite"
|
|
52647
52686
|
);
|
|
52648
52687
|
}, [announce]);
|
|
52649
|
-
const announceKeyboardReorder =
|
|
52688
|
+
const announceKeyboardReorder = useCallback28((resourceName, direction, newPosition, total) => {
|
|
52650
52689
|
announce(
|
|
52651
52690
|
`${resourceName} moved ${direction} to position ${newPosition} of ${total}.`,
|
|
52652
52691
|
"assertive"
|
|
52653
52692
|
);
|
|
52654
52693
|
}, [announce]);
|
|
52655
|
-
const announceCannotMove =
|
|
52694
|
+
const announceCannotMove = useCallback28((direction) => {
|
|
52656
52695
|
announce(
|
|
52657
52696
|
`Cannot move ${direction}. Already at the ${direction === "up" ? "top" : "bottom"} of the list.`,
|
|
52658
52697
|
"polite"
|
|
@@ -52685,7 +52724,7 @@ function CollapsibleResourceNavigation({
|
|
|
52685
52724
|
}) {
|
|
52686
52725
|
const ChevronLeftIcon = icons.chevronLeft;
|
|
52687
52726
|
const BarsIcon = icons.bars;
|
|
52688
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
52727
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState31(false);
|
|
52689
52728
|
const dropdownRef = useRef30(null);
|
|
52690
52729
|
const { announcePickup, announceDrop, announceKeyboardReorder, announceCannotMove } = useDragAnnouncements();
|
|
52691
52730
|
const t12 = useTranslations("CollapsibleResourceNavigation");
|
|
@@ -52723,7 +52762,7 @@ function CollapsibleResourceNavigation({
|
|
|
52723
52762
|
coordinateGetter: sortableKeyboardCoordinates
|
|
52724
52763
|
})
|
|
52725
52764
|
);
|
|
52726
|
-
const handleKeyboardReorder =
|
|
52765
|
+
const handleKeyboardReorder = useCallback29((resourceId, direction) => {
|
|
52727
52766
|
const currentIndex = resources.findIndex((r14) => r14.id === resourceId);
|
|
52728
52767
|
if (currentIndex === -1) return;
|
|
52729
52768
|
const newIndex = direction === "up" ? currentIndex - 1 : currentIndex + 1;
|
|
@@ -52899,16 +52938,16 @@ function CollapsibleResourceNavigation({
|
|
|
52899
52938
|
}
|
|
52900
52939
|
|
|
52901
52940
|
// src/components/modals/SearchModal.tsx
|
|
52902
|
-
import { useState as
|
|
52941
|
+
import { useState as useState32, useEffect as useEffect40, Fragment as Fragment13 } from "react";
|
|
52903
52942
|
|
|
52904
52943
|
// src/hooks/useSearchAnnouncements.ts
|
|
52905
|
-
import { useCallback as
|
|
52944
|
+
import { useCallback as useCallback30 } from "react";
|
|
52906
52945
|
function useSearchAnnouncements2() {
|
|
52907
52946
|
const { announce } = useLiveRegion();
|
|
52908
|
-
const announceSearching =
|
|
52947
|
+
const announceSearching = useCallback30(() => {
|
|
52909
52948
|
announce("Searching...", "polite");
|
|
52910
52949
|
}, [announce]);
|
|
52911
|
-
const announceSearchResults =
|
|
52950
|
+
const announceSearchResults = useCallback30((count2, query) => {
|
|
52912
52951
|
if (count2 === 0) {
|
|
52913
52952
|
announce(`No results found for ${query}`, "polite");
|
|
52914
52953
|
} else if (count2 === 1) {
|
|
@@ -52917,10 +52956,10 @@ function useSearchAnnouncements2() {
|
|
|
52917
52956
|
announce(`${count2} results found for ${query}`, "polite");
|
|
52918
52957
|
}
|
|
52919
52958
|
}, [announce]);
|
|
52920
|
-
const announceSelection =
|
|
52959
|
+
const announceSelection = useCallback30((name3, type) => {
|
|
52921
52960
|
announce(`Selected ${type}: ${name3}. Press Enter to navigate.`, "polite");
|
|
52922
52961
|
}, [announce]);
|
|
52923
|
-
const announceNavigation =
|
|
52962
|
+
const announceNavigation = useCallback30((name3, type) => {
|
|
52924
52963
|
announce(`Navigating to ${type}: ${name3}`, "assertive");
|
|
52925
52964
|
}, [announce]);
|
|
52926
52965
|
return {
|
|
@@ -52941,10 +52980,10 @@ function SearchModal({
|
|
|
52941
52980
|
translations = {}
|
|
52942
52981
|
}) {
|
|
52943
52982
|
const { announceSearchResults, announceSearching } = useSearchAnnouncements2();
|
|
52944
|
-
const [query, setQuery] =
|
|
52945
|
-
const [debouncedQuery, setDebouncedQuery] =
|
|
52946
|
-
const [results, setResults] =
|
|
52947
|
-
const [selectedIndex, setSelectedIndex] =
|
|
52983
|
+
const [query, setQuery] = useState32("");
|
|
52984
|
+
const [debouncedQuery, setDebouncedQuery] = useState32("");
|
|
52985
|
+
const [results, setResults] = useState32([]);
|
|
52986
|
+
const [selectedIndex, setSelectedIndex] = useState32(0);
|
|
52948
52987
|
const t12 = {
|
|
52949
52988
|
placeholder: translations.placeholder || "Search resources, entities...",
|
|
52950
52989
|
searching: translations.searching || "Searching...",
|
|
@@ -53103,7 +53142,7 @@ function SearchModal({
|
|
|
53103
53142
|
}
|
|
53104
53143
|
|
|
53105
53144
|
// src/components/modals/ResourceSearchModal.tsx
|
|
53106
|
-
import { useState as
|
|
53145
|
+
import { useState as useState33, useEffect as useEffect41, Fragment as Fragment14 } from "react";
|
|
53107
53146
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
53108
53147
|
function ResourceSearchModal({
|
|
53109
53148
|
isOpen,
|
|
@@ -53113,8 +53152,8 @@ function ResourceSearchModal({
|
|
|
53113
53152
|
translations = {}
|
|
53114
53153
|
}) {
|
|
53115
53154
|
const { announceSearchResults, announceSearching, announceNavigation } = useSearchAnnouncements2();
|
|
53116
|
-
const [search2, setSearch] =
|
|
53117
|
-
const [debouncedSearch, setDebouncedSearch] =
|
|
53155
|
+
const [search2, setSearch] = useState33(searchTerm);
|
|
53156
|
+
const [debouncedSearch, setDebouncedSearch] = useState33(searchTerm);
|
|
53118
53157
|
const t12 = {
|
|
53119
53158
|
title: translations.title || "Search Resources",
|
|
53120
53159
|
placeholder: translations.placeholder || "Search for resources...",
|
|
@@ -53358,11 +53397,11 @@ function SessionTimer() {
|
|
|
53358
53397
|
}
|
|
53359
53398
|
|
|
53360
53399
|
// src/components/SessionExpiryBanner.tsx
|
|
53361
|
-
import { useState as
|
|
53400
|
+
import { useState as useState34 } from "react";
|
|
53362
53401
|
import { jsx as jsx55, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
53363
53402
|
function SessionExpiryBanner() {
|
|
53364
53403
|
const { timeRemaining, isExpiringSoon } = useSessionExpiry();
|
|
53365
|
-
const [dismissed, setDismissed] =
|
|
53404
|
+
const [dismissed, setDismissed] = useState34(false);
|
|
53366
53405
|
const formattedTime = formatTime(timeRemaining);
|
|
53367
53406
|
if (!isExpiringSoon || dismissed || !formattedTime) {
|
|
53368
53407
|
return null;
|
|
@@ -53583,7 +53622,7 @@ function UnifiedHeader({
|
|
|
53583
53622
|
}
|
|
53584
53623
|
|
|
53585
53624
|
// src/components/layout/LeftSidebar.tsx
|
|
53586
|
-
import { useState as
|
|
53625
|
+
import { useState as useState35, useEffect as useEffect42 } from "react";
|
|
53587
53626
|
import { jsx as jsx59, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
53588
53627
|
function LeftSidebar({
|
|
53589
53628
|
Link,
|
|
@@ -53598,7 +53637,7 @@ function LeftSidebar({
|
|
|
53598
53637
|
isModerator = false,
|
|
53599
53638
|
currentPath
|
|
53600
53639
|
}) {
|
|
53601
|
-
const [isCollapsed, setIsCollapsed] =
|
|
53640
|
+
const [isCollapsed, setIsCollapsed] = useState35(false);
|
|
53602
53641
|
const { width, setWidth, minWidth, maxWidth } = usePanelWidth({
|
|
53603
53642
|
defaultWidth: 256,
|
|
53604
53643
|
// 16rem
|
|
@@ -54822,7 +54861,7 @@ function AdminSecurityPage({
|
|
|
54822
54861
|
}
|
|
54823
54862
|
|
|
54824
54863
|
// src/features/admin-users/components/AdminUsersPage.tsx
|
|
54825
|
-
import { useState as
|
|
54864
|
+
import { useState as useState36 } from "react";
|
|
54826
54865
|
import { Fragment as Fragment15, jsx as jsx68, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
54827
54866
|
function UserTableRow({
|
|
54828
54867
|
user,
|
|
@@ -54904,9 +54943,9 @@ function AdminUsersPage({
|
|
|
54904
54943
|
Toolbar: Toolbar2,
|
|
54905
54944
|
buttonStyles: buttonStyles2
|
|
54906
54945
|
}) {
|
|
54907
|
-
const [searchTerm, setSearchTerm] =
|
|
54908
|
-
const [selectedRole, setSelectedRole] =
|
|
54909
|
-
const [selectedStatus, setSelectedStatus] =
|
|
54946
|
+
const [searchTerm, setSearchTerm] = useState36("");
|
|
54947
|
+
const [selectedRole, setSelectedRole] = useState36("all");
|
|
54948
|
+
const [selectedStatus, setSelectedStatus] = useState36("all");
|
|
54910
54949
|
const filteredUsers = users.filter((user) => {
|
|
54911
54950
|
const matchesSearch = (user.name || "").toLowerCase().includes(searchTerm.toLowerCase()) || user.email.toLowerCase().includes(searchTerm.toLowerCase());
|
|
54912
54951
|
const userRole = user.isAdmin ? "admin" : "user";
|
|
@@ -55221,7 +55260,7 @@ function SignInForm({
|
|
|
55221
55260
|
}
|
|
55222
55261
|
|
|
55223
55262
|
// src/features/auth/components/SignUpForm.tsx
|
|
55224
|
-
import { useState as
|
|
55263
|
+
import { useState as useState37 } from "react";
|
|
55225
55264
|
import { jsx as jsx70, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
55226
55265
|
function GoogleIcon2() {
|
|
55227
55266
|
return /* @__PURE__ */ jsxs58("svg", { className: "semiont-icon semiont-icon--small semiont-icon--inline", viewBox: "0 0 24 24", children: [
|
|
@@ -55256,7 +55295,7 @@ function GoogleIcon2() {
|
|
|
55256
55295
|
] });
|
|
55257
55296
|
}
|
|
55258
55297
|
function SignUpForm({ onSignUp, Link, translations: t12 }) {
|
|
55259
|
-
const [isLoading, setIsLoading] =
|
|
55298
|
+
const [isLoading, setIsLoading] = useState37(false);
|
|
55260
55299
|
const handleSignUp = async () => {
|
|
55261
55300
|
setIsLoading(true);
|
|
55262
55301
|
try {
|
|
@@ -55713,7 +55752,7 @@ function TagSchemasPage({
|
|
|
55713
55752
|
}
|
|
55714
55753
|
|
|
55715
55754
|
// src/features/resource-compose/components/ResourceComposePage.tsx
|
|
55716
|
-
import { useState as
|
|
55755
|
+
import { useState as useState38, useEffect as useEffect43 } from "react";
|
|
55717
55756
|
import { isImageMimeType, isPdfMimeType as isPdfMimeType4, LOCALES as LOCALES2 } from "@semiont/api-client";
|
|
55718
55757
|
import { jsx as jsx76, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
55719
55758
|
function ResourceComposePage({
|
|
@@ -55724,6 +55763,7 @@ function ResourceComposePage({
|
|
|
55724
55763
|
initialLocale,
|
|
55725
55764
|
theme: theme2,
|
|
55726
55765
|
showLineNumbers,
|
|
55766
|
+
hoverDelayMs,
|
|
55727
55767
|
activePanel,
|
|
55728
55768
|
onSaveResource,
|
|
55729
55769
|
onCancel,
|
|
@@ -55732,18 +55772,18 @@ function ResourceComposePage({
|
|
|
55732
55772
|
Toolbar: Toolbar2
|
|
55733
55773
|
}) {
|
|
55734
55774
|
const { announceFormSubmitting, announceFormSuccess, announceFormError } = useFormAnnouncements();
|
|
55735
|
-
const [newResourceName, setNewResourceName] =
|
|
55736
|
-
const [newResourceContent, setNewResourceContent] =
|
|
55737
|
-
const [selectedEntityTypes, setSelectedEntityTypes] =
|
|
55738
|
-
const [isCreating, setIsCreating] =
|
|
55739
|
-
const [inputMethod, setInputMethod] =
|
|
55740
|
-
const [uploadedFile, setUploadedFile] =
|
|
55741
|
-
const [fileMimeType, setFileMimeType] =
|
|
55742
|
-
const [filePreviewUrl, setFilePreviewUrl] =
|
|
55743
|
-
const [selectedFormat, setSelectedFormat] =
|
|
55744
|
-
const [selectedLanguage, setSelectedLanguage] =
|
|
55745
|
-
const [selectedCharset, setSelectedCharset] =
|
|
55746
|
-
const [archiveOriginal, setArchiveOriginal] =
|
|
55775
|
+
const [newResourceName, setNewResourceName] = useState38("");
|
|
55776
|
+
const [newResourceContent, setNewResourceContent] = useState38("");
|
|
55777
|
+
const [selectedEntityTypes, setSelectedEntityTypes] = useState38([]);
|
|
55778
|
+
const [isCreating, setIsCreating] = useState38(false);
|
|
55779
|
+
const [inputMethod, setInputMethod] = useState38("write");
|
|
55780
|
+
const [uploadedFile, setUploadedFile] = useState38(null);
|
|
55781
|
+
const [fileMimeType, setFileMimeType] = useState38("text/markdown");
|
|
55782
|
+
const [filePreviewUrl, setFilePreviewUrl] = useState38(null);
|
|
55783
|
+
const [selectedFormat, setSelectedFormat] = useState38("text/markdown");
|
|
55784
|
+
const [selectedLanguage, setSelectedLanguage] = useState38(initialLocale);
|
|
55785
|
+
const [selectedCharset, setSelectedCharset] = useState38("");
|
|
55786
|
+
const [archiveOriginal, setArchiveOriginal] = useState38(true);
|
|
55747
55787
|
useEffect43(() => {
|
|
55748
55788
|
if (mode === "clone" && cloneData) {
|
|
55749
55789
|
setNewResourceName(cloneData.sourceResource.name);
|
|
@@ -56042,6 +56082,7 @@ function ResourceComposePage({
|
|
|
56042
56082
|
editable: !isCreating,
|
|
56043
56083
|
sourceView: true,
|
|
56044
56084
|
showLineNumbers,
|
|
56085
|
+
hoverDelayMs,
|
|
56045
56086
|
onChange: (newContent) => setNewResourceContent(newContent)
|
|
56046
56087
|
}
|
|
56047
56088
|
) })
|
|
@@ -56125,7 +56166,7 @@ function ResourceComposePage({
|
|
|
56125
56166
|
}
|
|
56126
56167
|
|
|
56127
56168
|
// src/features/resource-discovery/components/ResourceDiscoveryPage.tsx
|
|
56128
|
-
import { useState as
|
|
56169
|
+
import { useState as useState39, useCallback as useCallback31, useRef as useRef31 } from "react";
|
|
56129
56170
|
import { getResourceId as getResourceId2 } from "@semiont/api-client";
|
|
56130
56171
|
|
|
56131
56172
|
// src/features/resource-discovery/components/ResourceCard.tsx
|
|
@@ -56198,8 +56239,8 @@ function ResourceDiscoveryPage({
|
|
|
56198
56239
|
translations: t12,
|
|
56199
56240
|
ToolbarPanels
|
|
56200
56241
|
}) {
|
|
56201
|
-
const [searchQuery2, setSearchQuery] =
|
|
56202
|
-
const [selectedEntityType, setSelectedEntityType] =
|
|
56242
|
+
const [searchQuery2, setSearchQuery] = useState39("");
|
|
56243
|
+
const [selectedEntityType, setSelectedEntityType] = useState39("");
|
|
56203
56244
|
const hasSearchQuery = searchQuery2.trim() !== "";
|
|
56204
56245
|
const hasSearchResults = searchDocuments.length > 0;
|
|
56205
56246
|
const baseDocuments = hasSearchResults ? searchDocuments : recentDocuments;
|
|
@@ -56218,16 +56259,16 @@ function ResourceDiscoveryPage({
|
|
|
56218
56259
|
);
|
|
56219
56260
|
const onNavigateToResourceRef = useRef31(onNavigateToResource);
|
|
56220
56261
|
onNavigateToResourceRef.current = onNavigateToResource;
|
|
56221
|
-
const handleEntityTypeFilter =
|
|
56262
|
+
const handleEntityTypeFilter = useCallback31((entityType3) => {
|
|
56222
56263
|
setSelectedEntityType(entityType3);
|
|
56223
56264
|
}, []);
|
|
56224
|
-
const openResource =
|
|
56265
|
+
const openResource = useCallback31((resource) => {
|
|
56225
56266
|
const resourceId = getResourceId2(resource);
|
|
56226
56267
|
if (resourceId) {
|
|
56227
56268
|
onNavigateToResourceRef.current(resourceId);
|
|
56228
56269
|
}
|
|
56229
56270
|
}, []);
|
|
56230
|
-
const handleSearchSubmit =
|
|
56271
|
+
const handleSearchSubmit = useCallback31((e6) => {
|
|
56231
56272
|
e6.preventDefault();
|
|
56232
56273
|
}, []);
|
|
56233
56274
|
if (isLoadingRecent) {
|
|
@@ -56359,14 +56400,14 @@ function ResourceDiscoveryPage({
|
|
|
56359
56400
|
}
|
|
56360
56401
|
|
|
56361
56402
|
// src/features/resource-viewer/components/ResourceViewerPage.tsx
|
|
56362
|
-
import { useState as
|
|
56403
|
+
import { useState as useState45, useEffect as useEffect49, useCallback as useCallback36, useMemo as useMemo12 } from "react";
|
|
56363
56404
|
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
56364
56405
|
import { resourceAnnotationUri as resourceAnnotationUri3 } from "@semiont/core";
|
|
56365
56406
|
import { getLanguage, getPrimaryRepresentation, getPrimaryMediaType as getPrimaryMediaType2 } from "@semiont/api-client";
|
|
56366
56407
|
import { uriToAnnotationId as uriToAnnotationId2 } from "@semiont/core";
|
|
56367
56408
|
|
|
56368
56409
|
// src/hooks/useResolutionFlow.ts
|
|
56369
|
-
import { useCallback as
|
|
56410
|
+
import { useCallback as useCallback32, useEffect as useEffect44, useRef as useRef32, useState as useState40 } from "react";
|
|
56370
56411
|
import { resourceAnnotationUri, accessToken as accessToken3 } from "@semiont/core";
|
|
56371
56412
|
import { uriToAnnotationIdOrPassthrough } from "@semiont/core";
|
|
56372
56413
|
function toAccessToken2(token) {
|
|
@@ -56376,9 +56417,10 @@ function useResolutionFlow(rUri) {
|
|
|
56376
56417
|
const eventBus = useEventBus();
|
|
56377
56418
|
const client = useApiClient();
|
|
56378
56419
|
const token = useAuthToken();
|
|
56379
|
-
const
|
|
56380
|
-
const [
|
|
56381
|
-
const
|
|
56420
|
+
const { showError } = useToast();
|
|
56421
|
+
const [searchModalOpen, setSearchModalOpen] = useState40(false);
|
|
56422
|
+
const [pendingReferenceId, setPendingReferenceId] = useState40(null);
|
|
56423
|
+
const onCloseSearchModal = useCallback32(() => {
|
|
56382
56424
|
setSearchModalOpen(false);
|
|
56383
56425
|
}, []);
|
|
56384
56426
|
const rUriRef = useRef32(rUri);
|
|
@@ -56402,20 +56444,20 @@ function useResolutionFlow(rUri) {
|
|
|
56402
56444
|
resourceId: event.resourceId,
|
|
56403
56445
|
operations: event.operations
|
|
56404
56446
|
}, { auth: toAccessToken2(tokenRef.current) });
|
|
56405
|
-
eventBus.get("
|
|
56447
|
+
eventBus.get("resolve:body-updated").next({ annotationUri: event.annotationUri });
|
|
56406
56448
|
} catch (error) {
|
|
56407
56449
|
console.error("Failed to update annotation body:", error);
|
|
56408
|
-
eventBus.get("
|
|
56450
|
+
eventBus.get("resolve:body-update-failed").next({ error });
|
|
56409
56451
|
}
|
|
56410
56452
|
};
|
|
56411
56453
|
const handleReferenceLink = (event) => {
|
|
56412
|
-
eventBus.get("
|
|
56454
|
+
eventBus.get("resolve:search-requested").next({
|
|
56413
56455
|
referenceId: event.annotationUri,
|
|
56414
56456
|
searchTerm: event.searchTerm
|
|
56415
56457
|
});
|
|
56416
56458
|
};
|
|
56417
|
-
const subscription1 = eventBus.get("
|
|
56418
|
-
const subscription2 = eventBus.get("
|
|
56459
|
+
const subscription1 = eventBus.get("resolve:update-body").subscribe(handleAnnotationUpdateBody);
|
|
56460
|
+
const subscription2 = eventBus.get("resolve:link").subscribe(handleReferenceLink);
|
|
56419
56461
|
return () => {
|
|
56420
56462
|
subscription1.unsubscribe();
|
|
56421
56463
|
subscription2.unsubscribe();
|
|
@@ -56426,23 +56468,27 @@ function useResolutionFlow(rUri) {
|
|
|
56426
56468
|
setPendingReferenceId(event.referenceId);
|
|
56427
56469
|
setSearchModalOpen(true);
|
|
56428
56470
|
};
|
|
56429
|
-
const subscription = eventBus.get("
|
|
56471
|
+
const subscription = eventBus.get("resolve:search-requested").subscribe(handleResolutionSearchRequested);
|
|
56430
56472
|
return () => subscription.unsubscribe();
|
|
56431
56473
|
}, [eventBus]);
|
|
56474
|
+
useEventSubscriptions({
|
|
56475
|
+
"resolve:body-update-failed": ({ error }) => showError(`Failed to update reference: ${error.message}`)
|
|
56476
|
+
});
|
|
56432
56477
|
return { searchModalOpen, pendingReferenceId, onCloseSearchModal };
|
|
56433
56478
|
}
|
|
56434
56479
|
|
|
56435
|
-
// src/hooks/
|
|
56436
|
-
import { useState as
|
|
56480
|
+
// src/hooks/useAnnotationFlow.ts
|
|
56481
|
+
import { useState as useState41, useRef as useRef33, useEffect as useEffect45, useCallback as useCallback33 } from "react";
|
|
56437
56482
|
import { resourceAnnotationUri as resourceAnnotationUri2, accessToken as accessToken4, entityType as entityType2 } from "@semiont/core";
|
|
56438
56483
|
import { uriToAnnotationIdOrPassthrough as uriToAnnotationIdOrPassthrough2 } from "@semiont/core";
|
|
56439
56484
|
function toAccessToken3(token) {
|
|
56440
56485
|
return token ? accessToken4(token) : void 0;
|
|
56441
56486
|
}
|
|
56442
|
-
function
|
|
56487
|
+
function useAnnotationFlow(rUri) {
|
|
56443
56488
|
const eventBus = useEventBus();
|
|
56444
56489
|
const client = useApiClient();
|
|
56445
56490
|
const token = useAuthToken();
|
|
56491
|
+
const { showSuccess, showError, showInfo } = useToast();
|
|
56446
56492
|
const clientRef = useRef33(client);
|
|
56447
56493
|
const rUriRef = useRef33(rUri);
|
|
56448
56494
|
const tokenRef = useRef33(token);
|
|
@@ -56455,8 +56501,8 @@ function useDetectionFlow(rUri) {
|
|
|
56455
56501
|
useEffect45(() => {
|
|
56456
56502
|
tokenRef.current = token;
|
|
56457
56503
|
});
|
|
56458
|
-
const [pendingAnnotation, setPendingAnnotation] =
|
|
56459
|
-
const handleAnnotationRequested =
|
|
56504
|
+
const [pendingAnnotation, setPendingAnnotation] = useState41(null);
|
|
56505
|
+
const handleAnnotationRequested = useCallback33((pending) => {
|
|
56460
56506
|
const MOTIVATION_TO_TAB = {
|
|
56461
56507
|
highlighting: "annotations",
|
|
56462
56508
|
commenting: "annotations",
|
|
@@ -56472,10 +56518,10 @@ function useDetectionFlow(rUri) {
|
|
|
56472
56518
|
questioning: "annotations",
|
|
56473
56519
|
replying: "annotations"
|
|
56474
56520
|
};
|
|
56475
|
-
eventBus.get("panel
|
|
56521
|
+
eventBus.get("attend:panel-open").next({ panel: MOTIVATION_TO_TAB[pending.motivation] || "annotations" });
|
|
56476
56522
|
setPendingAnnotation(pending);
|
|
56477
56523
|
}, []);
|
|
56478
|
-
const selectionToSelector =
|
|
56524
|
+
const selectionToSelector = useCallback33((selection2) => {
|
|
56479
56525
|
if (selection2.svgSelector) {
|
|
56480
56526
|
return {
|
|
56481
56527
|
type: "SvgSelector",
|
|
@@ -56507,57 +56553,60 @@ function useDetectionFlow(rUri) {
|
|
|
56507
56553
|
...selection2.suffix && { suffix: selection2.suffix }
|
|
56508
56554
|
};
|
|
56509
56555
|
}, []);
|
|
56510
|
-
const handleCommentRequested =
|
|
56556
|
+
const handleCommentRequested = useCallback33((selection2) => {
|
|
56511
56557
|
handleAnnotationRequested({ selector: selectionToSelector(selection2), motivation: "commenting" });
|
|
56512
56558
|
}, [handleAnnotationRequested, selectionToSelector]);
|
|
56513
|
-
const handleTagRequested =
|
|
56559
|
+
const handleTagRequested = useCallback33((selection2) => {
|
|
56514
56560
|
handleAnnotationRequested({ selector: selectionToSelector(selection2), motivation: "tagging" });
|
|
56515
56561
|
}, [handleAnnotationRequested, selectionToSelector]);
|
|
56516
|
-
const handleAssessmentRequested =
|
|
56562
|
+
const handleAssessmentRequested = useCallback33((selection2) => {
|
|
56517
56563
|
handleAnnotationRequested({ selector: selectionToSelector(selection2), motivation: "assessing" });
|
|
56518
56564
|
}, [handleAnnotationRequested, selectionToSelector]);
|
|
56519
|
-
const handleReferenceRequested =
|
|
56565
|
+
const handleReferenceRequested = useCallback33((selection2) => {
|
|
56520
56566
|
handleAnnotationRequested({ selector: selectionToSelector(selection2), motivation: "linking" });
|
|
56521
56567
|
}, [handleAnnotationRequested, selectionToSelector]);
|
|
56522
|
-
const handleAnnotationCancelPending =
|
|
56568
|
+
const handleAnnotationCancelPending = useCallback33(() => {
|
|
56523
56569
|
setPendingAnnotation(null);
|
|
56524
56570
|
}, []);
|
|
56525
|
-
const [
|
|
56526
|
-
const [
|
|
56527
|
-
const
|
|
56571
|
+
const [assistingMotivation, setAssistingMotivation] = useState41(null);
|
|
56572
|
+
const [progress, setProgress] = useState41(null);
|
|
56573
|
+
const assistStreamRef = useRef33(null);
|
|
56528
56574
|
const progressDismissTimeoutRef = useRef33(null);
|
|
56529
|
-
const
|
|
56530
|
-
|
|
56575
|
+
const handleAnnotationProgress = useCallback33((chunk) => {
|
|
56576
|
+
setProgress(chunk);
|
|
56531
56577
|
}, []);
|
|
56532
|
-
const
|
|
56533
|
-
|
|
56578
|
+
const handleAnnotationComplete = useCallback33(({ motivation }) => {
|
|
56579
|
+
setAssistingMotivation((current) => {
|
|
56534
56580
|
if (motivation === current) {
|
|
56535
56581
|
return null;
|
|
56536
56582
|
}
|
|
56537
56583
|
return current;
|
|
56538
56584
|
});
|
|
56585
|
+
showSuccess("Annotation complete");
|
|
56539
56586
|
if (progressDismissTimeoutRef.current) {
|
|
56540
56587
|
clearTimeout(progressDismissTimeoutRef.current);
|
|
56541
56588
|
}
|
|
56542
56589
|
progressDismissTimeoutRef.current = setTimeout(() => {
|
|
56543
|
-
|
|
56590
|
+
setProgress(null);
|
|
56544
56591
|
progressDismissTimeoutRef.current = null;
|
|
56545
56592
|
}, 5e3);
|
|
56546
|
-
}, []);
|
|
56547
|
-
const
|
|
56593
|
+
}, [showSuccess]);
|
|
56594
|
+
const handleAnnotationFailed = useCallback33((event) => {
|
|
56548
56595
|
if (progressDismissTimeoutRef.current) {
|
|
56549
56596
|
clearTimeout(progressDismissTimeoutRef.current);
|
|
56550
56597
|
progressDismissTimeoutRef.current = null;
|
|
56551
56598
|
}
|
|
56552
|
-
|
|
56553
|
-
|
|
56554
|
-
|
|
56555
|
-
|
|
56599
|
+
setAssistingMotivation(null);
|
|
56600
|
+
setProgress(null);
|
|
56601
|
+
const errorMessage = event.payload.error || "Annotation failed";
|
|
56602
|
+
showError(errorMessage);
|
|
56603
|
+
}, [showError]);
|
|
56604
|
+
const handleProgressDismiss = useCallback33(() => {
|
|
56556
56605
|
if (progressDismissTimeoutRef.current) {
|
|
56557
56606
|
clearTimeout(progressDismissTimeoutRef.current);
|
|
56558
56607
|
progressDismissTimeoutRef.current = null;
|
|
56559
56608
|
}
|
|
56560
|
-
|
|
56609
|
+
setProgress(null);
|
|
56561
56610
|
}, []);
|
|
56562
56611
|
useEffect45(() => {
|
|
56563
56612
|
const handleAnnotationCreate = async (event) => {
|
|
@@ -56575,11 +56624,11 @@ function useDetectionFlow(rUri) {
|
|
|
56575
56624
|
}, { auth: toAccessToken3(tokenRef.current) });
|
|
56576
56625
|
if (result.annotation) {
|
|
56577
56626
|
setPendingAnnotation(null);
|
|
56578
|
-
eventBus.get("
|
|
56627
|
+
eventBus.get("annotate:created").next({ annotation: result.annotation });
|
|
56579
56628
|
}
|
|
56580
56629
|
} catch (error) {
|
|
56581
56630
|
console.error("Failed to create annotation:", error);
|
|
56582
|
-
eventBus.get("
|
|
56631
|
+
eventBus.get("annotate:create-failed").next({ error });
|
|
56583
56632
|
}
|
|
56584
56633
|
};
|
|
56585
56634
|
const handleAnnotationDelete = async (event) => {
|
|
@@ -56589,55 +56638,55 @@ function useDetectionFlow(rUri) {
|
|
|
56589
56638
|
const annotationIdSegment = uriToAnnotationIdOrPassthrough2(event.annotationId);
|
|
56590
56639
|
const annotationUri2 = resourceAnnotationUri2(`${currentRUri}/annotations/${annotationIdSegment}`);
|
|
56591
56640
|
await currentClient.deleteAnnotation(annotationUri2, { auth: toAccessToken3(tokenRef.current) });
|
|
56592
|
-
eventBus.get("
|
|
56641
|
+
eventBus.get("annotate:deleted").next({ annotationId: event.annotationId });
|
|
56593
56642
|
} catch (error) {
|
|
56594
56643
|
console.error("Failed to delete annotation:", error);
|
|
56595
|
-
eventBus.get("
|
|
56644
|
+
eventBus.get("annotate:delete-failed").next({ error });
|
|
56596
56645
|
}
|
|
56597
56646
|
};
|
|
56598
|
-
const
|
|
56647
|
+
const handleAssistStart = async (event) => {
|
|
56599
56648
|
const currentClient = clientRef.current;
|
|
56600
56649
|
const currentRUri = rUriRef.current;
|
|
56601
56650
|
try {
|
|
56602
|
-
if (
|
|
56603
|
-
|
|
56651
|
+
if (assistStreamRef.current) {
|
|
56652
|
+
assistStreamRef.current.abort();
|
|
56604
56653
|
}
|
|
56605
|
-
|
|
56654
|
+
assistStreamRef.current = new AbortController();
|
|
56606
56655
|
if (progressDismissTimeoutRef.current) {
|
|
56607
56656
|
clearTimeout(progressDismissTimeoutRef.current);
|
|
56608
56657
|
progressDismissTimeoutRef.current = null;
|
|
56609
56658
|
}
|
|
56610
|
-
|
|
56611
|
-
|
|
56659
|
+
setAssistingMotivation(event.motivation);
|
|
56660
|
+
setProgress(null);
|
|
56612
56661
|
const sseOptions = { auth: toAccessToken3(tokenRef.current), eventBus };
|
|
56613
56662
|
if (event.motivation === "tagging") {
|
|
56614
56663
|
const { schemaId, categories } = event.options;
|
|
56615
56664
|
if (!schemaId || !categories || categories.length === 0) {
|
|
56616
|
-
throw new Error("Tag
|
|
56665
|
+
throw new Error("Tag assist requires schemaId and categories");
|
|
56617
56666
|
}
|
|
56618
|
-
currentClient.sse.
|
|
56667
|
+
currentClient.sse.annotateTags(currentRUri, { schemaId, categories }, sseOptions);
|
|
56619
56668
|
} else if (event.motivation === "linking") {
|
|
56620
56669
|
const { entityTypes, includeDescriptiveReferences } = event.options;
|
|
56621
56670
|
if (!entityTypes || entityTypes.length === 0) {
|
|
56622
|
-
throw new Error("Reference
|
|
56671
|
+
throw new Error("Reference assist requires entityTypes");
|
|
56623
56672
|
}
|
|
56624
|
-
currentClient.sse.
|
|
56673
|
+
currentClient.sse.annotateReferences(currentRUri, {
|
|
56625
56674
|
entityTypes: entityTypes.map((et) => entityType2(et)),
|
|
56626
56675
|
includeDescriptiveReferences: includeDescriptiveReferences || false
|
|
56627
56676
|
}, sseOptions);
|
|
56628
56677
|
} else if (event.motivation === "highlighting") {
|
|
56629
|
-
currentClient.sse.
|
|
56678
|
+
currentClient.sse.annotateHighlights(currentRUri, {
|
|
56630
56679
|
instructions: event.options.instructions,
|
|
56631
56680
|
density: event.options.density
|
|
56632
56681
|
}, sseOptions);
|
|
56633
56682
|
} else if (event.motivation === "assessing") {
|
|
56634
|
-
currentClient.sse.
|
|
56683
|
+
currentClient.sse.annotateAssessments(currentRUri, {
|
|
56635
56684
|
instructions: event.options.instructions,
|
|
56636
56685
|
tone: event.options.tone,
|
|
56637
56686
|
density: event.options.density
|
|
56638
56687
|
}, sseOptions);
|
|
56639
56688
|
} else if (event.motivation === "commenting") {
|
|
56640
|
-
currentClient.sse.
|
|
56689
|
+
currentClient.sse.annotateComments(currentRUri, {
|
|
56641
56690
|
instructions: event.options.instructions,
|
|
56642
56691
|
tone: event.options.tone,
|
|
56643
56692
|
density: event.options.density
|
|
@@ -56645,45 +56694,49 @@ function useDetectionFlow(rUri) {
|
|
|
56645
56694
|
}
|
|
56646
56695
|
} catch (error) {
|
|
56647
56696
|
if (error instanceof Error && error.name === "AbortError") {
|
|
56648
|
-
eventBus.get("
|
|
56697
|
+
eventBus.get("annotate:assist-cancelled").next(void 0);
|
|
56649
56698
|
} else {
|
|
56650
|
-
console.error("
|
|
56651
|
-
|
|
56652
|
-
|
|
56699
|
+
console.error("Annotation assist failed:", error);
|
|
56700
|
+
setAssistingMotivation(null);
|
|
56701
|
+
setProgress(null);
|
|
56653
56702
|
}
|
|
56654
56703
|
}
|
|
56655
56704
|
};
|
|
56656
56705
|
const handleJobCancelRequested = (event) => {
|
|
56657
|
-
if (event.jobType === "
|
|
56658
|
-
|
|
56659
|
-
|
|
56706
|
+
if (event.jobType === "annotation") {
|
|
56707
|
+
assistStreamRef.current?.abort();
|
|
56708
|
+
assistStreamRef.current = null;
|
|
56660
56709
|
}
|
|
56661
56710
|
};
|
|
56662
|
-
const subscription1 = eventBus.get("
|
|
56663
|
-
const subscription2 = eventBus.get("
|
|
56664
|
-
const subscription3 = eventBus.get("
|
|
56711
|
+
const subscription1 = eventBus.get("annotate:create").subscribe(handleAnnotationCreate);
|
|
56712
|
+
const subscription2 = eventBus.get("annotate:delete").subscribe(handleAnnotationDelete);
|
|
56713
|
+
const subscription3 = eventBus.get("annotate:assist-request").subscribe(handleAssistStart);
|
|
56665
56714
|
const subscription4 = eventBus.get("job:cancel-requested").subscribe(handleJobCancelRequested);
|
|
56666
56715
|
return () => {
|
|
56667
56716
|
subscription1.unsubscribe();
|
|
56668
56717
|
subscription2.unsubscribe();
|
|
56669
56718
|
subscription3.unsubscribe();
|
|
56670
56719
|
subscription4.unsubscribe();
|
|
56671
|
-
|
|
56720
|
+
assistStreamRef.current?.abort();
|
|
56672
56721
|
};
|
|
56673
56722
|
}, [eventBus]);
|
|
56674
56723
|
useEventSubscriptions({
|
|
56675
|
-
// Manual
|
|
56676
|
-
"
|
|
56677
|
-
"
|
|
56678
|
-
"
|
|
56679
|
-
"
|
|
56680
|
-
"
|
|
56681
|
-
"
|
|
56682
|
-
// AI
|
|
56683
|
-
"
|
|
56684
|
-
"
|
|
56685
|
-
"
|
|
56686
|
-
"
|
|
56724
|
+
// Manual annotation
|
|
56725
|
+
"annotate:requested": handleAnnotationRequested,
|
|
56726
|
+
"annotate:select-comment": handleCommentRequested,
|
|
56727
|
+
"annotate:select-tag": handleTagRequested,
|
|
56728
|
+
"annotate:select-assessment": handleAssessmentRequested,
|
|
56729
|
+
"annotate:select-reference": handleReferenceRequested,
|
|
56730
|
+
"annotate:cancel-pending": handleAnnotationCancelPending,
|
|
56731
|
+
// AI-assisted annotation state updates
|
|
56732
|
+
"annotate:progress": handleAnnotationProgress,
|
|
56733
|
+
"annotate:assist-finished": handleAnnotationComplete,
|
|
56734
|
+
"annotate:assist-failed": handleAnnotationFailed,
|
|
56735
|
+
"annotate:progress-dismiss": handleProgressDismiss,
|
|
56736
|
+
"annotate:assist-cancelled": () => showInfo("Annotation cancelled"),
|
|
56737
|
+
// CRUD error notifications
|
|
56738
|
+
"annotate:create-failed": ({ error }) => showError(`Failed to create annotation: ${error.message}`),
|
|
56739
|
+
"annotate:delete-failed": ({ error }) => showError(`Failed to delete annotation: ${error.message}`)
|
|
56687
56740
|
});
|
|
56688
56741
|
useEffect45(() => {
|
|
56689
56742
|
return () => {
|
|
@@ -56694,24 +56747,25 @@ function useDetectionFlow(rUri) {
|
|
|
56694
56747
|
}, []);
|
|
56695
56748
|
return {
|
|
56696
56749
|
pendingAnnotation,
|
|
56697
|
-
|
|
56698
|
-
|
|
56699
|
-
|
|
56750
|
+
assistingMotivation,
|
|
56751
|
+
progress,
|
|
56752
|
+
assistStreamRef
|
|
56700
56753
|
};
|
|
56701
56754
|
}
|
|
56702
56755
|
|
|
56703
56756
|
// src/hooks/usePanelNavigation.ts
|
|
56704
|
-
import { useState as
|
|
56757
|
+
import { useState as useState42, useCallback as useCallback34, useEffect as useEffect46 } from "react";
|
|
56758
|
+
var tabGenerationCounter = 0;
|
|
56705
56759
|
function usePanelNavigation() {
|
|
56706
|
-
const [activePanel, setActivePanel] =
|
|
56760
|
+
const [activePanel, setActivePanel] = useState42(() => {
|
|
56707
56761
|
if (typeof window !== "undefined") {
|
|
56708
56762
|
const saved = localStorage.getItem("activeToolbarPanel");
|
|
56709
56763
|
return saved || null;
|
|
56710
56764
|
}
|
|
56711
56765
|
return null;
|
|
56712
56766
|
});
|
|
56713
|
-
const [scrollToAnnotationId, setScrollToAnnotationId] =
|
|
56714
|
-
const [panelInitialTab, setPanelInitialTab] =
|
|
56767
|
+
const [scrollToAnnotationId, setScrollToAnnotationId] = useState42(null);
|
|
56768
|
+
const [panelInitialTab, setPanelInitialTab] = useState42(null);
|
|
56715
56769
|
useEffect46(() => {
|
|
56716
56770
|
if (typeof window === "undefined") return;
|
|
56717
56771
|
if (activePanel) {
|
|
@@ -56720,13 +56774,13 @@ function usePanelNavigation() {
|
|
|
56720
56774
|
localStorage.removeItem("activeToolbarPanel");
|
|
56721
56775
|
}
|
|
56722
56776
|
}, [activePanel]);
|
|
56723
|
-
const handleScrollCompleted =
|
|
56777
|
+
const handleScrollCompleted = useCallback34(() => {
|
|
56724
56778
|
setScrollToAnnotationId(null);
|
|
56725
56779
|
}, []);
|
|
56726
|
-
const handlePanelToggle =
|
|
56780
|
+
const handlePanelToggle = useCallback34(({ panel }) => {
|
|
56727
56781
|
setActivePanel((current) => current === panel ? null : panel);
|
|
56728
56782
|
}, []);
|
|
56729
|
-
const handlePanelOpen =
|
|
56783
|
+
const handlePanelOpen = useCallback34(({ panel, scrollToAnnotationId: scrollTarget, motivation }) => {
|
|
56730
56784
|
if (scrollTarget) {
|
|
56731
56785
|
setScrollToAnnotationId(scrollTarget);
|
|
56732
56786
|
}
|
|
@@ -56739,17 +56793,17 @@ function usePanelNavigation() {
|
|
|
56739
56793
|
"assessing": "assessment"
|
|
56740
56794
|
};
|
|
56741
56795
|
const tab2 = motivationToTab[motivation] || "highlight";
|
|
56742
|
-
setPanelInitialTab({ tab: tab2, generation:
|
|
56796
|
+
setPanelInitialTab({ tab: tab2, generation: ++tabGenerationCounter });
|
|
56743
56797
|
}
|
|
56744
56798
|
setActivePanel(panel);
|
|
56745
56799
|
}, []);
|
|
56746
|
-
const handlePanelClose =
|
|
56800
|
+
const handlePanelClose = useCallback34(() => {
|
|
56747
56801
|
setActivePanel(null);
|
|
56748
56802
|
}, []);
|
|
56749
56803
|
useEventSubscriptions({
|
|
56750
|
-
"panel
|
|
56751
|
-
"panel
|
|
56752
|
-
"panel
|
|
56804
|
+
"attend:panel-toggle": handlePanelToggle,
|
|
56805
|
+
"attend:panel-open": handlePanelOpen,
|
|
56806
|
+
"attend:panel-close": handlePanelClose
|
|
56753
56807
|
});
|
|
56754
56808
|
return {
|
|
56755
56809
|
activePanel,
|
|
@@ -56760,15 +56814,16 @@ function usePanelNavigation() {
|
|
|
56760
56814
|
}
|
|
56761
56815
|
|
|
56762
56816
|
// src/hooks/useGenerationFlow.ts
|
|
56763
|
-
import { useState as
|
|
56817
|
+
import { useState as useState43, useCallback as useCallback35, useEffect as useEffect47, useRef as useRef34 } from "react";
|
|
56764
56818
|
import { annotationUri, accessToken as accessToken5 } from "@semiont/core";
|
|
56765
56819
|
function toAccessToken4(token) {
|
|
56766
56820
|
return token ? accessToken5(token) : void 0;
|
|
56767
56821
|
}
|
|
56768
|
-
function useGenerationFlow(locale, resourceId,
|
|
56822
|
+
function useGenerationFlow(locale, resourceId, clearNewAnnotationId) {
|
|
56769
56823
|
const eventBus = useEventBus();
|
|
56770
56824
|
const client = useApiClient();
|
|
56771
56825
|
const token = useAuthToken();
|
|
56826
|
+
const { showSuccess, showError } = useToast();
|
|
56772
56827
|
const clientRef = useRef34(client);
|
|
56773
56828
|
const tokenRef = useRef34(token);
|
|
56774
56829
|
useEffect47(() => {
|
|
@@ -56778,19 +56833,19 @@ function useGenerationFlow(locale, resourceId, showSuccess, showError, clearNewA
|
|
|
56778
56833
|
tokenRef.current = token;
|
|
56779
56834
|
});
|
|
56780
56835
|
const generationStreamRef = useRef34(null);
|
|
56781
|
-
const [isGenerating, setIsGenerating] =
|
|
56782
|
-
const [generationProgress, setGenerationProgress] =
|
|
56783
|
-
const handleProgressEvent =
|
|
56836
|
+
const [isGenerating, setIsGenerating] = useState43(false);
|
|
56837
|
+
const [generationProgress, setGenerationProgress] = useState43(null);
|
|
56838
|
+
const handleProgressEvent = useCallback35((chunk) => {
|
|
56784
56839
|
setGenerationProgress(chunk);
|
|
56785
56840
|
setIsGenerating(true);
|
|
56786
56841
|
}, []);
|
|
56787
|
-
const clearProgress =
|
|
56842
|
+
const clearProgress = useCallback35(() => {
|
|
56788
56843
|
setGenerationProgress(null);
|
|
56789
56844
|
}, []);
|
|
56790
|
-
const [generationModalOpen, setGenerationModalOpen] =
|
|
56791
|
-
const [generationReferenceId, setGenerationReferenceId] =
|
|
56792
|
-
const [generationDefaultTitle, setGenerationDefaultTitle] =
|
|
56793
|
-
const handleGenerateDocument =
|
|
56845
|
+
const [generationModalOpen, setGenerationModalOpen] = useState43(false);
|
|
56846
|
+
const [generationReferenceId, setGenerationReferenceId] = useState43(null);
|
|
56847
|
+
const [generationDefaultTitle, setGenerationDefaultTitle] = useState43("");
|
|
56848
|
+
const handleGenerateDocument = useCallback35((referenceId, options) => {
|
|
56794
56849
|
if (!options.context) {
|
|
56795
56850
|
setGenerationReferenceId(referenceId);
|
|
56796
56851
|
setGenerationDefaultTitle(options.title);
|
|
@@ -56799,7 +56854,7 @@ function useGenerationFlow(locale, resourceId, showSuccess, showError, clearNewA
|
|
|
56799
56854
|
}
|
|
56800
56855
|
clearNewAnnotationId(annotationUri(referenceId));
|
|
56801
56856
|
const resourceUriStr = `resource://${resourceId}`;
|
|
56802
|
-
eventBus.get("
|
|
56857
|
+
eventBus.get("generate:request").next({
|
|
56803
56858
|
annotationUri: referenceId,
|
|
56804
56859
|
resourceUri: resourceUriStr,
|
|
56805
56860
|
options: {
|
|
@@ -56811,16 +56866,16 @@ function useGenerationFlow(locale, resourceId, showSuccess, showError, clearNewA
|
|
|
56811
56866
|
}
|
|
56812
56867
|
});
|
|
56813
56868
|
}, [resourceId, clearNewAnnotationId, locale]);
|
|
56814
|
-
const handleCloseGenerationModal =
|
|
56869
|
+
const handleCloseGenerationModal = useCallback35(() => {
|
|
56815
56870
|
setGenerationModalOpen(false);
|
|
56816
56871
|
}, []);
|
|
56817
|
-
const handleGenerationModalOpen =
|
|
56872
|
+
const handleGenerationModalOpen = useCallback35(({ annotationUri: annUri, resourceUri: resourceUri2, defaultTitle }) => {
|
|
56818
56873
|
setGenerationReferenceId(annUri);
|
|
56819
56874
|
setGenerationDefaultTitle(defaultTitle);
|
|
56820
56875
|
setGenerationModalOpen(true);
|
|
56821
|
-
eventBus.get("
|
|
56876
|
+
eventBus.get("correlate:requested").next({ annotationUri: annUri, resourceUri: resourceUri2 });
|
|
56822
56877
|
}, []);
|
|
56823
|
-
const handleGenerationComplete =
|
|
56878
|
+
const handleGenerationComplete = useCallback35((progress) => {
|
|
56824
56879
|
setGenerationProgress(progress);
|
|
56825
56880
|
setIsGenerating(false);
|
|
56826
56881
|
if (progress.resourceName) {
|
|
@@ -56830,7 +56885,7 @@ function useGenerationFlow(locale, resourceId, showSuccess, showError, clearNewA
|
|
|
56830
56885
|
}
|
|
56831
56886
|
setTimeout(() => clearProgress(), 2e3);
|
|
56832
56887
|
}, [showSuccess, clearProgress]);
|
|
56833
|
-
const handleGenerationFailed =
|
|
56888
|
+
const handleGenerationFailed = useCallback35(({ error }) => {
|
|
56834
56889
|
setGenerationProgress(null);
|
|
56835
56890
|
setIsGenerating(false);
|
|
56836
56891
|
showError(`Resource generation failed: ${error.message}`);
|
|
@@ -56850,7 +56905,7 @@ function useGenerationFlow(locale, resourceId, showSuccess, showError, clearNewA
|
|
|
56850
56905
|
} catch (error) {
|
|
56851
56906
|
if (error.name !== "AbortError") {
|
|
56852
56907
|
console.error("[useGenerationFlow] Generation failed:", error);
|
|
56853
|
-
eventBus.get("
|
|
56908
|
+
eventBus.get("generate:failed").next({ error });
|
|
56854
56909
|
}
|
|
56855
56910
|
}
|
|
56856
56911
|
};
|
|
@@ -56870,9 +56925,9 @@ function useGenerationFlow(locale, resourceId, showSuccess, showError, clearNewA
|
|
|
56870
56925
|
});
|
|
56871
56926
|
window.location.href = `${baseUrl}/know/compose?${params.toString()}`;
|
|
56872
56927
|
};
|
|
56873
|
-
const subscription1 = eventBus.get("
|
|
56928
|
+
const subscription1 = eventBus.get("generate:request").subscribe(handleGenerationStart);
|
|
56874
56929
|
const subscription2 = eventBus.get("job:cancel-requested").subscribe(handleJobCancelRequested);
|
|
56875
|
-
const subscription3 = eventBus.get("
|
|
56930
|
+
const subscription3 = eventBus.get("resolve:create-manual").subscribe(handleReferenceCreateManual);
|
|
56876
56931
|
return () => {
|
|
56877
56932
|
subscription1.unsubscribe();
|
|
56878
56933
|
subscription2.unsubscribe();
|
|
@@ -56881,10 +56936,10 @@ function useGenerationFlow(locale, resourceId, showSuccess, showError, clearNewA
|
|
|
56881
56936
|
};
|
|
56882
56937
|
}, [eventBus, resourceId]);
|
|
56883
56938
|
useEventSubscriptions({
|
|
56884
|
-
"
|
|
56885
|
-
"
|
|
56886
|
-
"
|
|
56887
|
-
"
|
|
56939
|
+
"generate:progress": handleProgressEvent,
|
|
56940
|
+
"generate:finished": handleGenerationComplete,
|
|
56941
|
+
"generate:failed": handleGenerationFailed,
|
|
56942
|
+
"generate:modal-open": handleGenerationModalOpen
|
|
56888
56943
|
});
|
|
56889
56944
|
return {
|
|
56890
56945
|
isGenerating,
|
|
@@ -56897,18 +56952,18 @@ function useGenerationFlow(locale, resourceId, showSuccess, showError, clearNewA
|
|
|
56897
56952
|
};
|
|
56898
56953
|
}
|
|
56899
56954
|
|
|
56900
|
-
// src/hooks/
|
|
56901
|
-
import { useState as
|
|
56955
|
+
// src/hooks/useContextCorrelationFlow.ts
|
|
56956
|
+
import { useState as useState44, useEffect as useEffect48, useRef as useRef35 } from "react";
|
|
56902
56957
|
import { accessToken as accessToken6 } from "@semiont/core";
|
|
56903
56958
|
function toAccessToken5(token) {
|
|
56904
56959
|
return token ? accessToken6(token) : void 0;
|
|
56905
56960
|
}
|
|
56906
|
-
function
|
|
56961
|
+
function useContextCorrelationFlow(eventBus, config) {
|
|
56907
56962
|
const token = useAuthToken();
|
|
56908
|
-
const [
|
|
56909
|
-
const [
|
|
56910
|
-
const [
|
|
56911
|
-
const [
|
|
56963
|
+
const [correlationContext, setCorrelationContext] = useState44(null);
|
|
56964
|
+
const [correlationLoading, setCorrelationLoading] = useState44(false);
|
|
56965
|
+
const [correlationError, setCorrelationError] = useState44(null);
|
|
56966
|
+
const [correlationAnnotationUri, setCorrelationAnnotationUri] = useState44(null);
|
|
56912
56967
|
const configRef = useRef35(config);
|
|
56913
56968
|
const tokenRef = useRef35(token);
|
|
56914
56969
|
useEffect48(() => {
|
|
@@ -56918,11 +56973,11 @@ function useContextRetrievalFlow(eventBus, config) {
|
|
|
56918
56973
|
tokenRef.current = token;
|
|
56919
56974
|
});
|
|
56920
56975
|
useEffect48(() => {
|
|
56921
|
-
const
|
|
56922
|
-
|
|
56923
|
-
|
|
56924
|
-
|
|
56925
|
-
|
|
56976
|
+
const handleContextCorrelationRequested = async (event) => {
|
|
56977
|
+
setCorrelationLoading(true);
|
|
56978
|
+
setCorrelationError(null);
|
|
56979
|
+
setCorrelationContext(null);
|
|
56980
|
+
setCorrelationAnnotationUri(event.annotationUri);
|
|
56926
56981
|
try {
|
|
56927
56982
|
const { client } = configRef.current;
|
|
56928
56983
|
const annotationId = event.annotationUri.split("/").pop() || "";
|
|
@@ -56932,28 +56987,28 @@ function useContextRetrievalFlow(eventBus, config) {
|
|
|
56932
56987
|
{ contextWindow: 2e3, auth: toAccessToken5(tokenRef.current) }
|
|
56933
56988
|
);
|
|
56934
56989
|
const context = response.context ?? null;
|
|
56935
|
-
|
|
56936
|
-
|
|
56990
|
+
setCorrelationContext(context);
|
|
56991
|
+
setCorrelationLoading(false);
|
|
56937
56992
|
if (context) {
|
|
56938
|
-
eventBus.get("
|
|
56993
|
+
eventBus.get("correlate:complete").next({
|
|
56939
56994
|
annotationUri: event.annotationUri,
|
|
56940
56995
|
context
|
|
56941
56996
|
});
|
|
56942
56997
|
}
|
|
56943
56998
|
} catch (error) {
|
|
56944
56999
|
const err = error;
|
|
56945
|
-
|
|
56946
|
-
|
|
56947
|
-
eventBus.get("
|
|
57000
|
+
setCorrelationError(err);
|
|
57001
|
+
setCorrelationLoading(false);
|
|
57002
|
+
eventBus.get("correlate:failed").next({
|
|
56948
57003
|
annotationUri: event.annotationUri,
|
|
56949
57004
|
error: err
|
|
56950
57005
|
});
|
|
56951
57006
|
}
|
|
56952
57007
|
};
|
|
56953
|
-
const subscription = eventBus.get("
|
|
57008
|
+
const subscription = eventBus.get("correlate:requested").subscribe(handleContextCorrelationRequested);
|
|
56954
57009
|
return () => subscription.unsubscribe();
|
|
56955
57010
|
}, [eventBus]);
|
|
56956
|
-
return {
|
|
57011
|
+
return { correlationContext, correlationLoading, correlationError, correlationAnnotationUri };
|
|
56957
57012
|
}
|
|
56958
57013
|
|
|
56959
57014
|
// src/features/resource-viewer/components/ResourceViewerPage.tsx
|
|
@@ -56975,6 +57030,7 @@ function ResourceViewerPage({
|
|
|
56975
57030
|
const { showError, showSuccess } = useToast();
|
|
56976
57031
|
const { theme: theme2, setTheme } = useTheme();
|
|
56977
57032
|
const { showLineNumbers, toggleLineNumbers } = useLineNumbers();
|
|
57033
|
+
const { hoverDelayMs } = useHoverDelay();
|
|
56978
57034
|
const { addResource } = useOpenResources();
|
|
56979
57035
|
const { triggerSparkleAnimation, clearNewAnnotationId } = useResourceAnnotations();
|
|
56980
57036
|
const resources = useResources();
|
|
@@ -56990,7 +57046,7 @@ function ResourceViewerPage({
|
|
|
56990
57046
|
const { data: entityTypesData } = entityTypesAPI.list.useQuery();
|
|
56991
57047
|
const allEntityTypes = entityTypesData?.entityTypes || [];
|
|
56992
57048
|
const { hoveredAnnotationId } = useAttentionFlow();
|
|
56993
|
-
const {
|
|
57049
|
+
const { assistingMotivation, progress, pendingAnnotation } = useAnnotationFlow(rUri);
|
|
56994
57050
|
const { activePanel, scrollToAnnotationId, panelInitialTab, onScrollCompleted } = usePanelNavigation();
|
|
56995
57051
|
const { searchModalOpen, pendingReferenceId, onCloseSearchModal } = useResolutionFlow(rUri);
|
|
56996
57052
|
const {
|
|
@@ -57000,8 +57056,8 @@ function ResourceViewerPage({
|
|
|
57000
57056
|
generationDefaultTitle,
|
|
57001
57057
|
onGenerateDocument,
|
|
57002
57058
|
onCloseGenerationModal
|
|
57003
|
-
} = useGenerationFlow(locale, rUri.split("/").pop() || "",
|
|
57004
|
-
const {
|
|
57059
|
+
} = useGenerationFlow(locale, rUri.split("/").pop() || "", clearNewAnnotationId);
|
|
57060
|
+
const { correlationContext, correlationLoading, correlationError } = useContextCorrelationFlow(eventBus, { client, resourceUri: rUri });
|
|
57005
57061
|
const debouncedInvalidateAnnotations = useDebouncedCallback(
|
|
57006
57062
|
() => {
|
|
57007
57063
|
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.annotations(rUri) });
|
|
@@ -57023,13 +57079,13 @@ function ResourceViewerPage({
|
|
|
57023
57079
|
rUri,
|
|
57024
57080
|
autoConnect: true,
|
|
57025
57081
|
// Annotation events - use debounced invalidation to batch rapid updates
|
|
57026
|
-
onAnnotationAdded:
|
|
57082
|
+
onAnnotationAdded: useCallback36((_event) => {
|
|
57027
57083
|
debouncedInvalidateAnnotations();
|
|
57028
57084
|
}, [debouncedInvalidateAnnotations]),
|
|
57029
|
-
onAnnotationRemoved:
|
|
57085
|
+
onAnnotationRemoved: useCallback36((_event) => {
|
|
57030
57086
|
debouncedInvalidateAnnotations();
|
|
57031
57087
|
}, [debouncedInvalidateAnnotations]),
|
|
57032
|
-
onAnnotationBodyUpdated:
|
|
57088
|
+
onAnnotationBodyUpdated: useCallback36((event) => {
|
|
57033
57089
|
queryClient.setQueryData(QUERY_KEYS.resources.annotations(rUri), (old) => {
|
|
57034
57090
|
if (!old) return old;
|
|
57035
57091
|
return {
|
|
@@ -57066,32 +57122,32 @@ function ResourceViewerPage({
|
|
|
57066
57122
|
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.events(rUri) });
|
|
57067
57123
|
}, [queryClient, rUri]),
|
|
57068
57124
|
// Document status events
|
|
57069
|
-
onDocumentArchived:
|
|
57125
|
+
onDocumentArchived: useCallback36((_event) => {
|
|
57070
57126
|
refetchDocument();
|
|
57071
57127
|
showSuccess("This document has been archived");
|
|
57072
57128
|
debouncedInvalidateAnnotations();
|
|
57073
57129
|
}, [refetchDocument, showSuccess, debouncedInvalidateAnnotations]),
|
|
57074
|
-
onDocumentUnarchived:
|
|
57130
|
+
onDocumentUnarchived: useCallback36((_event) => {
|
|
57075
57131
|
refetchDocument();
|
|
57076
57132
|
showSuccess("This document has been unarchived");
|
|
57077
57133
|
debouncedInvalidateAnnotations();
|
|
57078
57134
|
}, [refetchDocument, showSuccess, debouncedInvalidateAnnotations]),
|
|
57079
57135
|
// Entity tag events
|
|
57080
|
-
onEntityTagAdded:
|
|
57136
|
+
onEntityTagAdded: useCallback36((_event) => {
|
|
57081
57137
|
refetchDocument();
|
|
57082
57138
|
debouncedInvalidateAnnotations();
|
|
57083
57139
|
}, [refetchDocument, debouncedInvalidateAnnotations]),
|
|
57084
|
-
onEntityTagRemoved:
|
|
57140
|
+
onEntityTagRemoved: useCallback36((_event) => {
|
|
57085
57141
|
refetchDocument();
|
|
57086
57142
|
debouncedInvalidateAnnotations();
|
|
57087
57143
|
}, [refetchDocument, debouncedInvalidateAnnotations]),
|
|
57088
|
-
onError:
|
|
57144
|
+
onError: useCallback36((error) => {
|
|
57089
57145
|
console.error("[RealTime] Event stream error:", error);
|
|
57090
57146
|
}, [])
|
|
57091
57147
|
});
|
|
57092
57148
|
const updateMutation = resources.update.useMutation();
|
|
57093
57149
|
const generateCloneTokenMutation = resources.generateCloneToken.useMutation();
|
|
57094
|
-
const handleResourceArchive =
|
|
57150
|
+
const handleResourceArchive = useCallback36(async () => {
|
|
57095
57151
|
try {
|
|
57096
57152
|
await updateMutation.mutateAsync({ rUri, data: { archived: true } });
|
|
57097
57153
|
await refetchDocument();
|
|
@@ -57100,7 +57156,7 @@ function ResourceViewerPage({
|
|
|
57100
57156
|
showError("Failed to archive document");
|
|
57101
57157
|
}
|
|
57102
57158
|
}, [updateMutation, rUri, refetchDocument, showError]);
|
|
57103
|
-
const handleResourceUnarchive =
|
|
57159
|
+
const handleResourceUnarchive = useCallback36(async () => {
|
|
57104
57160
|
try {
|
|
57105
57161
|
await updateMutation.mutateAsync({ rUri, data: { archived: false } });
|
|
57106
57162
|
await refetchDocument();
|
|
@@ -57109,7 +57165,7 @@ function ResourceViewerPage({
|
|
|
57109
57165
|
showError("Failed to unarchive document");
|
|
57110
57166
|
}
|
|
57111
57167
|
}, [updateMutation, rUri, refetchDocument, showError]);
|
|
57112
|
-
const handleResourceClone =
|
|
57168
|
+
const handleResourceClone = useCallback36(async () => {
|
|
57113
57169
|
try {
|
|
57114
57170
|
const result2 = await generateCloneTokenMutation.mutateAsync(rUri);
|
|
57115
57171
|
const token = result2.token;
|
|
@@ -57119,34 +57175,38 @@ function ResourceViewerPage({
|
|
|
57119
57175
|
showError("Failed to generate clone link");
|
|
57120
57176
|
}
|
|
57121
57177
|
}, [generateCloneTokenMutation, rUri, showError]);
|
|
57122
|
-
const handleAnnotationSparkle =
|
|
57178
|
+
const handleAnnotationSparkle = useCallback36(({ annotationId }) => {
|
|
57123
57179
|
triggerSparkleAnimation(annotationId);
|
|
57124
57180
|
}, [triggerSparkleAnimation]);
|
|
57125
|
-
const
|
|
57126
|
-
triggerSparkleAnimation(annotation.id);
|
|
57181
|
+
const handleAnnotationAdded = useCallback36((event) => {
|
|
57182
|
+
triggerSparkleAnimation(event.payload.annotation.id);
|
|
57127
57183
|
debouncedInvalidateAnnotations();
|
|
57128
57184
|
}, [triggerSparkleAnimation, debouncedInvalidateAnnotations]);
|
|
57129
|
-
const handleAnnotationCreateFailed =
|
|
57130
|
-
const handleAnnotationDeleteFailed =
|
|
57131
|
-
const
|
|
57185
|
+
const handleAnnotationCreateFailed = useCallback36(() => showError("Failed to create annotation"), [showError]);
|
|
57186
|
+
const handleAnnotationDeleteFailed = useCallback36(() => showError("Failed to delete annotation"), [showError]);
|
|
57187
|
+
const handleAnnotateBodyUpdated = useCallback36(() => {
|
|
57132
57188
|
}, []);
|
|
57133
|
-
const
|
|
57134
|
-
const handleSettingsThemeChanged =
|
|
57135
|
-
const handleDetectionComplete =
|
|
57136
|
-
showSuccess("Detection complete");
|
|
57189
|
+
const handleAnnotateBodyUpdateFailed = useCallback36(() => showError("Failed to update annotation"), [showError]);
|
|
57190
|
+
const handleSettingsThemeChanged = useCallback36(({ theme: theme3 }) => setTheme(theme3), [setTheme]);
|
|
57191
|
+
const handleDetectionComplete = useCallback36(() => {
|
|
57137
57192
|
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.annotations(rUri) });
|
|
57138
57193
|
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.events(rUri) });
|
|
57139
|
-
}, [
|
|
57140
|
-
const handleDetectionFailed =
|
|
57141
|
-
|
|
57142
|
-
|
|
57143
|
-
|
|
57194
|
+
}, [queryClient, rUri]);
|
|
57195
|
+
const handleDetectionFailed = useCallback36(() => {
|
|
57196
|
+
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.annotations(rUri) });
|
|
57197
|
+
queryClient.invalidateQueries({ queryKey: QUERY_KEYS.resources.events(rUri) });
|
|
57198
|
+
}, [queryClient, rUri]);
|
|
57199
|
+
const handleGenerationComplete = useCallback36(() => {
|
|
57200
|
+
}, []);
|
|
57201
|
+
const handleGenerationFailed = useCallback36(() => {
|
|
57202
|
+
}, []);
|
|
57203
|
+
const handleReferenceNavigate = useCallback36(({ documentId }) => {
|
|
57144
57204
|
if (routes.resource) {
|
|
57145
57205
|
const path2 = routes.resource.replace("[resourceId]", encodeURIComponent(documentId));
|
|
57146
57206
|
eventBus.get("navigation:router-push").next({ path: path2, reason: "reference-link" });
|
|
57147
57207
|
}
|
|
57148
57208
|
}, [routes.resource]);
|
|
57149
|
-
const handleEntityTypeClicked =
|
|
57209
|
+
const handleEntityTypeClicked = useCallback36(({ entityType: entityType3 }) => {
|
|
57150
57210
|
if (routes.know) {
|
|
57151
57211
|
const path2 = `${routes.know}?entityType=${encodeURIComponent(entityType3)}`;
|
|
57152
57212
|
eventBus.get("navigation:router-push").next({ path: path2, reason: "entity-type-filter" });
|
|
@@ -57155,20 +57215,20 @@ function ResourceViewerPage({
|
|
|
57155
57215
|
useEventSubscriptions({
|
|
57156
57216
|
"resource:archive": handleResourceArchive,
|
|
57157
57217
|
"resource:unarchive": handleResourceUnarchive,
|
|
57158
|
-
"
|
|
57159
|
-
"
|
|
57160
|
-
"
|
|
57161
|
-
"
|
|
57162
|
-
"
|
|
57163
|
-
"
|
|
57164
|
-
"
|
|
57165
|
-
"
|
|
57218
|
+
"generate:clone": handleResourceClone,
|
|
57219
|
+
"attend:sparkle": handleAnnotationSparkle,
|
|
57220
|
+
"annotate:added": handleAnnotationAdded,
|
|
57221
|
+
"annotate:removed": debouncedInvalidateAnnotations,
|
|
57222
|
+
"annotate:create-failed": handleAnnotationCreateFailed,
|
|
57223
|
+
"annotate:delete-failed": handleAnnotationDeleteFailed,
|
|
57224
|
+
"annotate:body-updated": handleAnnotateBodyUpdated,
|
|
57225
|
+
"resolve:body-update-failed": handleAnnotateBodyUpdateFailed,
|
|
57166
57226
|
"settings:theme-changed": handleSettingsThemeChanged,
|
|
57167
57227
|
"settings:line-numbers-toggled": toggleLineNumbers,
|
|
57168
|
-
"
|
|
57169
|
-
"
|
|
57170
|
-
"
|
|
57171
|
-
"
|
|
57228
|
+
"annotate:assist-finished": handleDetectionComplete,
|
|
57229
|
+
"annotate:assist-failed": handleDetectionFailed,
|
|
57230
|
+
"generate:finished": handleGenerationComplete,
|
|
57231
|
+
"generate:failed": handleGenerationFailed,
|
|
57172
57232
|
"navigation:reference-navigate": handleReferenceNavigate,
|
|
57173
57233
|
"navigation:entity-type-clicked": handleEntityTypeClicked
|
|
57174
57234
|
});
|
|
@@ -57187,7 +57247,7 @@ function ResourceViewerPage({
|
|
|
57187
57247
|
const primaryRep = getPrimaryRepresentation(resource);
|
|
57188
57248
|
const primaryMediaType = primaryRep?.mediaType;
|
|
57189
57249
|
const primaryByteSize = primaryRep?.byteSize;
|
|
57190
|
-
const [annotateMode, _setAnnotateMode] =
|
|
57250
|
+
const [annotateMode, _setAnnotateMode] = useState45(() => {
|
|
57191
57251
|
if (typeof window !== "undefined") {
|
|
57192
57252
|
return localStorage.getItem("annotateMode") === "true";
|
|
57193
57253
|
}
|
|
@@ -57211,12 +57271,12 @@ function ResourceViewerPage({
|
|
|
57211
57271
|
}
|
|
57212
57272
|
const groups = result;
|
|
57213
57273
|
const resourceWithContent = { ...resource, content: content4 };
|
|
57214
|
-
const handleEventHover =
|
|
57274
|
+
const handleEventHover = useCallback36((annotationId) => {
|
|
57215
57275
|
if (annotationId) {
|
|
57216
|
-
eventBus.get("
|
|
57276
|
+
eventBus.get("attend:sparkle").next({ annotationId });
|
|
57217
57277
|
}
|
|
57218
57278
|
}, []);
|
|
57219
|
-
const handleEventClick =
|
|
57279
|
+
const handleEventClick = useCallback36((_annotationId) => {
|
|
57220
57280
|
}, []);
|
|
57221
57281
|
return /* @__PURE__ */ jsxs67("div", { className: `semiont-document-viewer${activePanel ? " semiont-document-viewer--panel-open" : ""}`, children: [
|
|
57222
57282
|
/* @__PURE__ */ jsxs67("div", { className: "semiont-document-viewer__main", children: [
|
|
@@ -57244,6 +57304,7 @@ function ResourceViewerPage({
|
|
|
57244
57304
|
annotations: groups,
|
|
57245
57305
|
generatingReferenceId: generationProgress?.referenceId ?? null,
|
|
57246
57306
|
showLineNumbers,
|
|
57307
|
+
hoverDelayMs,
|
|
57247
57308
|
hoveredAnnotationId
|
|
57248
57309
|
}
|
|
57249
57310
|
)
|
|
@@ -57266,8 +57327,8 @@ function ResourceViewerPage({
|
|
|
57266
57327
|
annotations,
|
|
57267
57328
|
annotators: ANNOTATORS,
|
|
57268
57329
|
annotateMode,
|
|
57269
|
-
|
|
57270
|
-
|
|
57330
|
+
assistingMotivation,
|
|
57331
|
+
progress,
|
|
57271
57332
|
pendingAnnotation,
|
|
57272
57333
|
allEntityTypes,
|
|
57273
57334
|
generatingReferenceId: generationProgress?.referenceId ?? null,
|
|
@@ -57339,7 +57400,7 @@ function ResourceViewerPage({
|
|
|
57339
57400
|
}
|
|
57340
57401
|
const resourceIdSegment = rUri.split("/").pop() || "";
|
|
57341
57402
|
const nestedUri = `${window.location.origin}/resources/${resourceIdSegment}/annotations/${annotationIdShort}`;
|
|
57342
|
-
eventBus.get("
|
|
57403
|
+
eventBus.get("resolve:update-body").next({
|
|
57343
57404
|
annotationUri: resourceAnnotationUri3(nestedUri),
|
|
57344
57405
|
resourceId: resourceIdSegment,
|
|
57345
57406
|
operations: [{
|
|
@@ -57372,9 +57433,9 @@ function ResourceViewerPage({
|
|
|
57372
57433
|
}
|
|
57373
57434
|
},
|
|
57374
57435
|
defaultTitle: generationDefaultTitle,
|
|
57375
|
-
context:
|
|
57376
|
-
contextLoading:
|
|
57377
|
-
contextError:
|
|
57436
|
+
context: correlationContext,
|
|
57437
|
+
contextLoading: correlationLoading,
|
|
57438
|
+
contextError: correlationError
|
|
57378
57439
|
}
|
|
57379
57440
|
)
|
|
57380
57441
|
] });
|
|
@@ -57386,6 +57447,7 @@ export {
|
|
|
57386
57447
|
AdminDevOpsPage,
|
|
57387
57448
|
AdminSecurityPage,
|
|
57388
57449
|
AdminUsersPage,
|
|
57450
|
+
AnnotateReferencesProgressWidget,
|
|
57389
57451
|
AnnotateToolbar,
|
|
57390
57452
|
AnnotateView,
|
|
57391
57453
|
AnnotationHistory,
|
|
@@ -57394,6 +57456,7 @@ export {
|
|
|
57394
57456
|
ApiClientProvider,
|
|
57395
57457
|
AssessmentEntry,
|
|
57396
57458
|
AssessmentPanel,
|
|
57459
|
+
AssistSection,
|
|
57397
57460
|
AsyncErrorBoundary,
|
|
57398
57461
|
AuthErrorDisplay,
|
|
57399
57462
|
AuthTokenProvider,
|
|
@@ -57407,8 +57470,6 @@ export {
|
|
|
57407
57470
|
CommentEntry,
|
|
57408
57471
|
CommentsPanel,
|
|
57409
57472
|
ComposeLoadingState,
|
|
57410
|
-
DetectSection,
|
|
57411
|
-
DetectionProgressWidget,
|
|
57412
57473
|
EntityTagsPage,
|
|
57413
57474
|
EntityTypeBadges,
|
|
57414
57475
|
ErrorBoundary,
|
|
@@ -57511,6 +57572,7 @@ export {
|
|
|
57511
57572
|
supportsDetection,
|
|
57512
57573
|
tokens,
|
|
57513
57574
|
useAdmin,
|
|
57575
|
+
useAnnotationFlow,
|
|
57514
57576
|
useAnnotationManager,
|
|
57515
57577
|
useAnnotations,
|
|
57516
57578
|
useApiClient,
|
|
@@ -57518,10 +57580,9 @@ export {
|
|
|
57518
57580
|
useAuthApi,
|
|
57519
57581
|
useAuthToken,
|
|
57520
57582
|
useCacheManager,
|
|
57521
|
-
|
|
57583
|
+
useContextCorrelationFlow,
|
|
57522
57584
|
useDebounce,
|
|
57523
57585
|
useDebouncedCallback,
|
|
57524
|
-
useDetectionFlow,
|
|
57525
57586
|
useDocumentAnnouncements,
|
|
57526
57587
|
useDoubleKeyPress,
|
|
57527
57588
|
useDropdown,
|
|
@@ -57532,6 +57593,7 @@ export {
|
|
|
57532
57593
|
useFormAnnouncements,
|
|
57533
57594
|
useGenerationFlow,
|
|
57534
57595
|
useHealth,
|
|
57596
|
+
useHoverDelay,
|
|
57535
57597
|
useHoverEmitter,
|
|
57536
57598
|
useIsTyping,
|
|
57537
57599
|
useKeyboardShortcuts,
|