@semiont/react-ui 0.5.17 → 0.5.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +24 -4
- package/dist/index.js +343 -308
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -18441,6 +18441,40 @@ function usePendingCreation(session, resourceId2, enabled) {
|
|
|
18441
18441
|
return { pending, clearPending };
|
|
18442
18442
|
}
|
|
18443
18443
|
|
|
18444
|
+
// src/hooks/useKBDiscovery.ts
|
|
18445
|
+
import { useEffect as useEffect16, useMemo as useMemo3, useState as useState16 } from "react";
|
|
18446
|
+
import { httpDiscovery, subscribeDiscovery } from "@semiont/sdk";
|
|
18447
|
+
function useKBDiscovery(options) {
|
|
18448
|
+
const enabled = options?.enabled ?? true;
|
|
18449
|
+
const intervalMs = options?.intervalMs;
|
|
18450
|
+
const externalTransport = options?.transport;
|
|
18451
|
+
const transport = useMemo3(
|
|
18452
|
+
() => externalTransport ?? httpDiscovery(),
|
|
18453
|
+
[externalTransport]
|
|
18454
|
+
);
|
|
18455
|
+
const [visible, setVisible] = useState16(
|
|
18456
|
+
() => typeof document === "undefined" || !document.hidden
|
|
18457
|
+
);
|
|
18458
|
+
const [state, setState] = useState16(null);
|
|
18459
|
+
useEffect16(() => {
|
|
18460
|
+
const onVisibilityChange = () => setVisible(!document.hidden);
|
|
18461
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
18462
|
+
return () => document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
18463
|
+
}, []);
|
|
18464
|
+
useEffect16(() => {
|
|
18465
|
+
if (!enabled || !visible) return;
|
|
18466
|
+
const subscription = subscribeDiscovery(
|
|
18467
|
+
transport,
|
|
18468
|
+
intervalMs !== void 0 ? { intervalMs } : void 0
|
|
18469
|
+
).subscribe((diff) => setState(diff.state));
|
|
18470
|
+
return () => subscription.unsubscribe();
|
|
18471
|
+
}, [enabled, visible, transport, intervalMs]);
|
|
18472
|
+
return {
|
|
18473
|
+
state,
|
|
18474
|
+
kbs: state?.kind === "managed" ? state.kbs : []
|
|
18475
|
+
};
|
|
18476
|
+
}
|
|
18477
|
+
|
|
18444
18478
|
// src/contexts/AnnotationContext.tsx
|
|
18445
18479
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
18446
18480
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
@@ -18457,15 +18491,15 @@ function useAnnotationManager() {
|
|
|
18457
18491
|
}
|
|
18458
18492
|
|
|
18459
18493
|
// src/contexts/useEventSubscription.ts
|
|
18460
|
-
import { useEffect as
|
|
18494
|
+
import { useEffect as useEffect17, useRef as useRef8, useMemo as useMemo4 } from "react";
|
|
18461
18495
|
function useEventSubscription(eventName, handler) {
|
|
18462
18496
|
const semiont = useSemiont();
|
|
18463
18497
|
const session = useObservable(semiont.activeSession$);
|
|
18464
18498
|
const handlerRef = useRef8(handler);
|
|
18465
|
-
|
|
18499
|
+
useEffect17(() => {
|
|
18466
18500
|
handlerRef.current = handler;
|
|
18467
18501
|
});
|
|
18468
|
-
|
|
18502
|
+
useEffect17(() => {
|
|
18469
18503
|
const unsubs = [];
|
|
18470
18504
|
unsubs.push(semiont.on(eventName, (payload) => handlerRef.current(payload)));
|
|
18471
18505
|
if (session) {
|
|
@@ -18480,15 +18514,15 @@ function useEventSubscriptions(subscriptions) {
|
|
|
18480
18514
|
const semiont = useSemiont();
|
|
18481
18515
|
const session = useObservable(semiont.activeSession$);
|
|
18482
18516
|
const handlersRef = useRef8(subscriptions);
|
|
18483
|
-
|
|
18517
|
+
useEffect17(() => {
|
|
18484
18518
|
handlersRef.current = subscriptions;
|
|
18485
18519
|
});
|
|
18486
|
-
const eventNames =
|
|
18520
|
+
const eventNames = useMemo4(
|
|
18487
18521
|
() => Object.keys(subscriptions).sort(),
|
|
18488
18522
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18489
18523
|
[Object.keys(subscriptions).sort().join(",")]
|
|
18490
18524
|
);
|
|
18491
|
-
|
|
18525
|
+
useEffect17(() => {
|
|
18492
18526
|
const unsubs = [];
|
|
18493
18527
|
for (const eventName of eventNames) {
|
|
18494
18528
|
const channel = eventName;
|
|
@@ -18508,10 +18542,10 @@ function useEventSubscriptions(subscriptions) {
|
|
|
18508
18542
|
}
|
|
18509
18543
|
|
|
18510
18544
|
// src/contexts/ResourceAnnotationsContext.tsx
|
|
18511
|
-
import { createContext as createContext4, useContext as useContext4, useState as
|
|
18545
|
+
import { createContext as createContext4, useContext as useContext4, useState as useState18, useCallback as useCallback13, useMemo as useMemo5 } from "react";
|
|
18512
18546
|
|
|
18513
18547
|
// src/components/LiveRegion.tsx
|
|
18514
|
-
import { useState as
|
|
18548
|
+
import { useState as useState17, createContext as createContext3, useContext as useContext3, useCallback as useCallback12 } from "react";
|
|
18515
18549
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
18516
18550
|
var LiveRegionContext = createContext3(null);
|
|
18517
18551
|
function useLiveRegion() {
|
|
@@ -18523,8 +18557,8 @@ function useLiveRegion() {
|
|
|
18523
18557
|
return context;
|
|
18524
18558
|
}
|
|
18525
18559
|
function LiveRegionProvider({ children }) {
|
|
18526
|
-
const [politeMessage, setPoliteMessage] =
|
|
18527
|
-
const [assertiveMessage, setAssertiveMessage] =
|
|
18560
|
+
const [politeMessage, setPoliteMessage] = useState17("");
|
|
18561
|
+
const [assertiveMessage, setAssertiveMessage] = useState17("");
|
|
18528
18562
|
const announce = useCallback12((message, priority = "polite") => {
|
|
18529
18563
|
if (priority === "assertive") {
|
|
18530
18564
|
setAssertiveMessage(message);
|
|
@@ -18671,7 +18705,7 @@ function useLanguageChangeAnnouncements() {
|
|
|
18671
18705
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
18672
18706
|
var ResourceAnnotationsContext = createContext4(void 0);
|
|
18673
18707
|
function ResourceAnnotationsProvider({ children }) {
|
|
18674
|
-
const [newAnnotationIds, setNewAnnotationIds] =
|
|
18708
|
+
const [newAnnotationIds, setNewAnnotationIds] = useState18(/* @__PURE__ */ new Set());
|
|
18675
18709
|
const { announce } = useLiveRegion();
|
|
18676
18710
|
const semiont = useObservable(useSemiont().activeSession$)?.client;
|
|
18677
18711
|
const markAnnotation = useCallback13(async (rUri, motivation, selector, body = []) => {
|
|
@@ -18721,7 +18755,7 @@ function ResourceAnnotationsProvider({ children }) {
|
|
|
18721
18755
|
});
|
|
18722
18756
|
}, 6e3);
|
|
18723
18757
|
}, []);
|
|
18724
|
-
const contextValue =
|
|
18758
|
+
const contextValue = useMemo5(
|
|
18725
18759
|
() => ({
|
|
18726
18760
|
newAnnotationIds,
|
|
18727
18761
|
markAnnotation,
|
|
@@ -18741,7 +18775,7 @@ function useResourceAnnotations() {
|
|
|
18741
18775
|
}
|
|
18742
18776
|
|
|
18743
18777
|
// src/components/CodeMirrorRenderer.tsx
|
|
18744
|
-
import { useEffect as
|
|
18778
|
+
import { useEffect as useEffect18, useRef as useRef9 } from "react";
|
|
18745
18779
|
|
|
18746
18780
|
// ../../node_modules/@codemirror/autocomplete/dist/index.js
|
|
18747
18781
|
var CompletionContext = class {
|
|
@@ -26412,7 +26446,7 @@ function CodeMirrorRenderer({
|
|
|
26412
26446
|
segmentsByIdRef.current = segmentsById;
|
|
26413
26447
|
sessionRef.current = session;
|
|
26414
26448
|
getTargetResourceNameRef.current = getTargetResourceName;
|
|
26415
|
-
|
|
26449
|
+
useEffect18(() => {
|
|
26416
26450
|
if (!containerRef.current || viewRef.current) return;
|
|
26417
26451
|
const annotationDecorationsField = createAnnotationDecorationsField();
|
|
26418
26452
|
const state = EditorState.create({
|
|
@@ -26547,7 +26581,7 @@ function CodeMirrorRenderer({
|
|
|
26547
26581
|
viewRef.current = null;
|
|
26548
26582
|
};
|
|
26549
26583
|
}, [hoverDelayMs]);
|
|
26550
|
-
|
|
26584
|
+
useEffect18(() => {
|
|
26551
26585
|
if (!viewRef.current) return;
|
|
26552
26586
|
const currentContent = viewRef.current.state.doc.toString();
|
|
26553
26587
|
if (content2 === currentContent) return;
|
|
@@ -26563,19 +26597,19 @@ function CodeMirrorRenderer({
|
|
|
26563
26597
|
});
|
|
26564
26598
|
contentRef.current = content2;
|
|
26565
26599
|
}, [content2]);
|
|
26566
|
-
|
|
26600
|
+
useEffect18(() => {
|
|
26567
26601
|
if (!viewRef.current) return;
|
|
26568
26602
|
viewRef.current.dispatch({
|
|
26569
26603
|
effects: lineNumbersCompartment.current.reconfigure(showLineNumbers ? lineNumbers() : [])
|
|
26570
26604
|
});
|
|
26571
26605
|
}, [showLineNumbers]);
|
|
26572
|
-
|
|
26606
|
+
useEffect18(() => {
|
|
26573
26607
|
if (!viewRef.current) return;
|
|
26574
26608
|
viewRef.current.dispatch({
|
|
26575
26609
|
effects: updateAnnotationsEffect.of({ segments: convertedSegments, ...newAnnotationIds && { newAnnotationIds } })
|
|
26576
26610
|
});
|
|
26577
26611
|
}, [convertedSegments, newAnnotationIds]);
|
|
26578
|
-
|
|
26612
|
+
useEffect18(() => {
|
|
26579
26613
|
if (!viewRef.current || !enableWidgets) return;
|
|
26580
26614
|
viewRef.current.dispatch({
|
|
26581
26615
|
effects: updateWidgetsEffect.of({
|
|
@@ -26586,7 +26620,7 @@ function CodeMirrorRenderer({
|
|
|
26586
26620
|
})
|
|
26587
26621
|
});
|
|
26588
26622
|
}, [content2, convertedSegments, enableWidgets, generatingReferenceId]);
|
|
26589
|
-
|
|
26623
|
+
useEffect18(() => {
|
|
26590
26624
|
if (!viewRef.current || !hoveredAnnotationId) return void 0;
|
|
26591
26625
|
const view = viewRef.current;
|
|
26592
26626
|
const element = view.contentDOM.querySelector(
|
|
@@ -26614,7 +26648,7 @@ function CodeMirrorRenderer({
|
|
|
26614
26648
|
element.classList.remove("annotation-pulse");
|
|
26615
26649
|
};
|
|
26616
26650
|
}, [hoveredAnnotationId]);
|
|
26617
|
-
|
|
26651
|
+
useEffect18(() => {
|
|
26618
26652
|
if (!viewRef.current || !scrollToAnnotationId) return;
|
|
26619
26653
|
scrollAnnotationIntoView(scrollToAnnotationId, viewRef.current.contentDOM);
|
|
26620
26654
|
}, [scrollToAnnotationId]);
|
|
@@ -26853,7 +26887,7 @@ function ProtectedErrorFallback({ error, resetErrorBoundary }) {
|
|
|
26853
26887
|
}
|
|
26854
26888
|
|
|
26855
26889
|
// src/components/ResizeHandle.tsx
|
|
26856
|
-
import { useRef as useRef10, useCallback as useCallback14, useEffect as
|
|
26890
|
+
import { useRef as useRef10, useCallback as useCallback14, useEffect as useEffect19, useState as useState19 } from "react";
|
|
26857
26891
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
26858
26892
|
function ResizeHandle({
|
|
26859
26893
|
onResize,
|
|
@@ -26862,11 +26896,11 @@ function ResizeHandle({
|
|
|
26862
26896
|
position = "left",
|
|
26863
26897
|
ariaLabel = "Resize panel"
|
|
26864
26898
|
}) {
|
|
26865
|
-
const [isDragging, setIsDragging] =
|
|
26899
|
+
const [isDragging, setIsDragging] = useState19(false);
|
|
26866
26900
|
const startXRef = useRef10(0);
|
|
26867
26901
|
const startWidthRef = useRef10(0);
|
|
26868
26902
|
const onResizeRef = useRef10(onResize);
|
|
26869
|
-
|
|
26903
|
+
useEffect19(() => {
|
|
26870
26904
|
onResizeRef.current = onResize;
|
|
26871
26905
|
});
|
|
26872
26906
|
const handleMouseDown = useCallback14((e6) => {
|
|
@@ -26917,7 +26951,7 @@ function ResizeHandle({
|
|
|
26917
26951
|
onResizeRef.current(constrainedWidth);
|
|
26918
26952
|
}
|
|
26919
26953
|
}, [minWidth, maxWidth, position]);
|
|
26920
|
-
|
|
26954
|
+
useEffect19(() => {
|
|
26921
26955
|
if (isDragging) {
|
|
26922
26956
|
document.addEventListener("mousemove", handleMouseMove);
|
|
26923
26957
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -26948,7 +26982,7 @@ function ResizeHandle({
|
|
|
26948
26982
|
}
|
|
26949
26983
|
|
|
26950
26984
|
// src/components/ResourceTagsInline.tsx
|
|
26951
|
-
import { useState as
|
|
26985
|
+
import { useState as useState20 } from "react";
|
|
26952
26986
|
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
26953
26987
|
function ResourceTagsInline({
|
|
26954
26988
|
tags: tags3,
|
|
@@ -26957,8 +26991,8 @@ function ResourceTagsInline({
|
|
|
26957
26991
|
disabled = false,
|
|
26958
26992
|
vocabulary
|
|
26959
26993
|
}) {
|
|
26960
|
-
const [busy, setBusy] =
|
|
26961
|
-
const [picking, setPicking] =
|
|
26994
|
+
const [busy, setBusy] = useState20(false);
|
|
26995
|
+
const [picking, setPicking] = useState20(false);
|
|
26962
26996
|
if (!isEditing) {
|
|
26963
26997
|
if (tags3.length === 0) {
|
|
26964
26998
|
return null;
|
|
@@ -27143,7 +27177,7 @@ function Toolbar({
|
|
|
27143
27177
|
}
|
|
27144
27178
|
|
|
27145
27179
|
// src/components/settings/SettingsPanel.tsx
|
|
27146
|
-
import React5, { useEffect as
|
|
27180
|
+
import React5, { useEffect as useEffect20 } from "react";
|
|
27147
27181
|
import { LOCALES } from "@semiont/core";
|
|
27148
27182
|
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
27149
27183
|
function SettingsPanel({
|
|
@@ -27162,7 +27196,7 @@ function SettingsPanel({
|
|
|
27162
27196
|
announceLanguageChanging(localeName);
|
|
27163
27197
|
semiont.emit("settings:locale-changed", { locale: newLocale });
|
|
27164
27198
|
};
|
|
27165
|
-
|
|
27199
|
+
useEffect20(() => {
|
|
27166
27200
|
if (locale !== previousLocale && !isPendingLocaleChange) {
|
|
27167
27201
|
const localeName = LOCALES.find((l10) => l10.code === locale)?.nativeName || locale;
|
|
27168
27202
|
announceLanguageChanged(localeName);
|
|
@@ -27281,7 +27315,7 @@ function SettingsPanel({
|
|
|
27281
27315
|
}
|
|
27282
27316
|
|
|
27283
27317
|
// src/components/annotation/AnnotateToolbar.tsx
|
|
27284
|
-
import React6, { useState as
|
|
27318
|
+
import React6, { useState as useState21, useRef as useRef11, useEffect as useEffect21 } from "react";
|
|
27285
27319
|
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
27286
27320
|
function DropdownGroup({
|
|
27287
27321
|
label,
|
|
@@ -27358,14 +27392,14 @@ function AnnotateToolbar({
|
|
|
27358
27392
|
const annotator = Object.values(annotators).find((a15) => a15.motivation === motivation);
|
|
27359
27393
|
return annotator?.iconEmoji || "\u2753";
|
|
27360
27394
|
};
|
|
27361
|
-
const [modeHovered, setModeHovered] =
|
|
27362
|
-
const [modePinned, setModePinned] =
|
|
27363
|
-
const [clickHovered, setClickHovered] =
|
|
27364
|
-
const [clickPinned, setClickPinned] =
|
|
27365
|
-
const [selectionHovered, setSelectionHovered] =
|
|
27366
|
-
const [selectionPinned, setSelectionPinned] =
|
|
27367
|
-
const [shapeHovered, setShapeHovered] =
|
|
27368
|
-
const [shapePinned, setShapePinned] =
|
|
27395
|
+
const [modeHovered, setModeHovered] = useState21(false);
|
|
27396
|
+
const [modePinned, setModePinned] = useState21(false);
|
|
27397
|
+
const [clickHovered, setClickHovered] = useState21(false);
|
|
27398
|
+
const [clickPinned, setClickPinned] = useState21(false);
|
|
27399
|
+
const [selectionHovered, setSelectionHovered] = useState21(false);
|
|
27400
|
+
const [selectionPinned, setSelectionPinned] = useState21(false);
|
|
27401
|
+
const [shapeHovered, setShapeHovered] = useState21(false);
|
|
27402
|
+
const [shapePinned, setShapePinned] = useState21(false);
|
|
27369
27403
|
const modeRef = useRef11(null);
|
|
27370
27404
|
const clickRef = useRef11(null);
|
|
27371
27405
|
const selectionRef = useRef11(null);
|
|
@@ -27374,7 +27408,7 @@ function AnnotateToolbar({
|
|
|
27374
27408
|
const clickExpanded = clickHovered || clickPinned;
|
|
27375
27409
|
const selectionExpanded = selectionHovered || selectionPinned;
|
|
27376
27410
|
const shapeExpanded = shapeHovered || shapePinned;
|
|
27377
|
-
|
|
27411
|
+
useEffect21(() => {
|
|
27378
27412
|
const handleClickOutside = (event) => {
|
|
27379
27413
|
if (modePinned && modeRef.current && !modeRef.current.contains(event.target)) {
|
|
27380
27414
|
setModePinned(false);
|
|
@@ -27392,7 +27426,7 @@ function AnnotateToolbar({
|
|
|
27392
27426
|
document.addEventListener("mousedown", handleClickOutside);
|
|
27393
27427
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
27394
27428
|
}, [modePinned, clickPinned, selectionPinned, shapePinned]);
|
|
27395
|
-
|
|
27429
|
+
useEffect21(() => {
|
|
27396
27430
|
const handleEscape = (event) => {
|
|
27397
27431
|
if (event.key === "Escape") {
|
|
27398
27432
|
setModePinned(false);
|
|
@@ -27572,7 +27606,7 @@ function AnnotateToolbar({
|
|
|
27572
27606
|
}
|
|
27573
27607
|
|
|
27574
27608
|
// src/components/annotation-popups/JsonLdView.tsx
|
|
27575
|
-
import { useEffect as
|
|
27609
|
+
import { useEffect as useEffect22, useRef as useRef12 } from "react";
|
|
27576
27610
|
|
|
27577
27611
|
// ../../node_modules/@lezer/json/dist/index.js
|
|
27578
27612
|
var jsonHighlighting = styleTags({
|
|
@@ -27780,10 +27814,10 @@ function JsonLdView({ annotation, onBack }) {
|
|
|
27780
27814
|
const viewRef = useRef12(null);
|
|
27781
27815
|
const { showLineNumbers } = useLineNumbers();
|
|
27782
27816
|
const onBackRef = useRef12(onBack);
|
|
27783
|
-
|
|
27817
|
+
useEffect22(() => {
|
|
27784
27818
|
onBackRef.current = onBack;
|
|
27785
27819
|
});
|
|
27786
|
-
|
|
27820
|
+
useEffect22(() => {
|
|
27787
27821
|
const handleKeyDown = (e6) => {
|
|
27788
27822
|
if (e6.key === "Escape") {
|
|
27789
27823
|
onBackRef.current();
|
|
@@ -27792,7 +27826,7 @@ function JsonLdView({ annotation, onBack }) {
|
|
|
27792
27826
|
window.addEventListener("keydown", handleKeyDown);
|
|
27793
27827
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
27794
27828
|
}, []);
|
|
27795
|
-
|
|
27829
|
+
useEffect22(() => {
|
|
27796
27830
|
if (!editorRef.current) return;
|
|
27797
27831
|
const isDarkMode = document.documentElement.classList.contains("dark");
|
|
27798
27832
|
const jsonContent = JSON.stringify(annotation, null, 2);
|
|
@@ -29448,7 +29482,7 @@ function PopupContainer({ children, position, onClose, isOpen, wide = false }) {
|
|
|
29448
29482
|
}
|
|
29449
29483
|
|
|
29450
29484
|
// src/components/image-annotation/AnnotationOverlay.tsx
|
|
29451
|
-
import { useMemo as
|
|
29485
|
+
import { useMemo as useMemo6 } from "react";
|
|
29452
29486
|
import { getSvgSelector, isHighlight as isHighlight4, isReference as isReference5, isAssessment as isAssessment3, isComment as isComment4, isTag as isTag4, isBodyResolved, isResolvedReference as isResolvedReference3 } from "@semiont/core";
|
|
29453
29487
|
import { createHoverHandlers as createHoverHandlers2 } from "@semiont/sdk";
|
|
29454
29488
|
import { parseSvgSelector } from "@semiont/core";
|
|
@@ -29496,7 +29530,7 @@ function AnnotationOverlay({
|
|
|
29496
29530
|
}) {
|
|
29497
29531
|
const scaleX = displayWidth / imageWidth;
|
|
29498
29532
|
const scaleY = displayHeight / imageHeight;
|
|
29499
|
-
const { handleMouseEnter, handleMouseLeave } =
|
|
29533
|
+
const { handleMouseEnter, handleMouseLeave } = useMemo6(
|
|
29500
29534
|
() => createHoverHandlers2((id2) => session?.client.beckon.hover(id2), hoverDelayMs),
|
|
29501
29535
|
[session, hoverDelayMs]
|
|
29502
29536
|
);
|
|
@@ -29665,7 +29699,7 @@ function AnnotationOverlay({
|
|
|
29665
29699
|
}
|
|
29666
29700
|
|
|
29667
29701
|
// src/components/image-annotation/SvgDrawingCanvas.tsx
|
|
29668
|
-
import { useRef as useRef13, useState as
|
|
29702
|
+
import { useRef as useRef13, useState as useState23, useEffect as useEffect24, useCallback as useCallback15 } from "react";
|
|
29669
29703
|
import { createRectangleSvg, createCircleSvg, createPolygonSvg, scaleSvgToNative, parseSvgSelector as parseSvgSelector2, resourceId as toResourceId3 } from "@semiont/core";
|
|
29670
29704
|
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
29671
29705
|
function getMotivationColor(motivation) {
|
|
@@ -29702,12 +29736,12 @@ function SvgDrawingCanvas({
|
|
|
29702
29736
|
const { hoverDelayMs } = useHoverDelay();
|
|
29703
29737
|
const containerRef = useRef13(null);
|
|
29704
29738
|
const imageRef = useRef13(null);
|
|
29705
|
-
const [imageDimensions, setImageDimensions] =
|
|
29706
|
-
const [displayDimensions, setDisplayDimensions] =
|
|
29707
|
-
const [isDrawing, setIsDrawing] =
|
|
29708
|
-
const [startPoint, setStartPoint] =
|
|
29709
|
-
const [currentPoint, setCurrentPoint] =
|
|
29710
|
-
|
|
29739
|
+
const [imageDimensions, setImageDimensions] = useState23(null);
|
|
29740
|
+
const [displayDimensions, setDisplayDimensions] = useState23(null);
|
|
29741
|
+
const [isDrawing, setIsDrawing] = useState23(false);
|
|
29742
|
+
const [startPoint, setStartPoint] = useState23(null);
|
|
29743
|
+
const [currentPoint, setCurrentPoint] = useState23(null);
|
|
29744
|
+
useEffect24(() => {
|
|
29711
29745
|
const img = new Image();
|
|
29712
29746
|
img.onload = () => {
|
|
29713
29747
|
setImageDimensions({
|
|
@@ -29717,7 +29751,7 @@ function SvgDrawingCanvas({
|
|
|
29717
29751
|
};
|
|
29718
29752
|
img.src = imageUrl;
|
|
29719
29753
|
}, [imageUrl]);
|
|
29720
|
-
|
|
29754
|
+
useEffect24(() => {
|
|
29721
29755
|
const updateDisplayDimensions = () => {
|
|
29722
29756
|
if (imageRef.current) {
|
|
29723
29757
|
setDisplayDimensions({
|
|
@@ -30334,7 +30368,7 @@ function SessionExpiredModal() {
|
|
|
30334
30368
|
}
|
|
30335
30369
|
|
|
30336
30370
|
// src/components/resource/AnnotateView.tsx
|
|
30337
|
-
import { useRef as useRef14, useEffect as
|
|
30371
|
+
import { useRef as useRef14, useEffect as useEffect25, useCallback as useCallback16, lazy, Suspense } from "react";
|
|
30338
30372
|
import { capabilitiesOf as capabilitiesOf3, resourceId as toResourceId4 } from "@semiont/core";
|
|
30339
30373
|
|
|
30340
30374
|
// src/lib/text-segmentation.ts
|
|
@@ -30487,7 +30521,7 @@ function AnnotateView({
|
|
|
30487
30521
|
useSessionEventSubscriptions(session, {
|
|
30488
30522
|
"beckon:hover": handleAnnotationHover
|
|
30489
30523
|
});
|
|
30490
|
-
|
|
30524
|
+
useEffect25(() => {
|
|
30491
30525
|
const container = containerRef.current;
|
|
30492
30526
|
if (!container) return;
|
|
30493
30527
|
let clickedOnAnnotation = false;
|
|
@@ -30661,11 +30695,11 @@ function AnnotateView({
|
|
|
30661
30695
|
}
|
|
30662
30696
|
|
|
30663
30697
|
// src/components/resource/AnnotationHistory.tsx
|
|
30664
|
-
import { useEffect as
|
|
30698
|
+
import { useEffect as useEffect27, useRef as useRef16 } from "react";
|
|
30665
30699
|
import { getAnnotationUriFromEvent as getAnnotationUriFromEvent2 } from "@semiont/core";
|
|
30666
30700
|
|
|
30667
30701
|
// src/components/resource/HistoryEvent.tsx
|
|
30668
|
-
import { useRef as useRef15, useCallback as useCallback17, useEffect as
|
|
30702
|
+
import { useRef as useRef15, useCallback as useCallback17, useEffect as useEffect26 } from "react";
|
|
30669
30703
|
import { getAnnotationUriFromEvent } from "@semiont/core";
|
|
30670
30704
|
|
|
30671
30705
|
// src/components/resource/event-formatting.ts
|
|
@@ -30921,7 +30955,7 @@ function HistoryEvent({
|
|
|
30921
30955
|
const entityTypes = getEventEntityTypes(event);
|
|
30922
30956
|
const hoverTimeoutRef = useRef15(null);
|
|
30923
30957
|
const onEventHoverRef = useRef15(onEventHover);
|
|
30924
|
-
|
|
30958
|
+
useEffect26(() => {
|
|
30925
30959
|
onEventHoverRef.current = onEventHover;
|
|
30926
30960
|
});
|
|
30927
30961
|
const handleEmojiMouseEnter = useCallback17(() => {
|
|
@@ -31027,7 +31061,7 @@ function AnnotationHistory({ rUri, hoveredAnnotationId, onEventHover, onEventCli
|
|
|
31027
31061
|
const events2 = !eventsData ? [] : eventsData.filter((e6) => {
|
|
31028
31062
|
return e6.type !== "job:started" && e6.type !== "job:progress" && e6.type !== "job:completed";
|
|
31029
31063
|
}).sort((a15, b8) => a15.metadata.sequenceNumber - b8.metadata.sequenceNumber);
|
|
31030
|
-
|
|
31064
|
+
useEffect27(() => {
|
|
31031
31065
|
if (containerRef.current && events2.length > 0) {
|
|
31032
31066
|
requestAnimationFrame(() => {
|
|
31033
31067
|
if (containerRef.current) {
|
|
@@ -31036,7 +31070,7 @@ function AnnotationHistory({ rUri, hoveredAnnotationId, onEventHover, onEventCli
|
|
|
31036
31070
|
});
|
|
31037
31071
|
}
|
|
31038
31072
|
}, [events2.length]);
|
|
31039
|
-
|
|
31073
|
+
useEffect27(() => {
|
|
31040
31074
|
if (!hoveredAnnotationId) return;
|
|
31041
31075
|
const eventElement = eventRefs.current.get(hoveredAnnotationId);
|
|
31042
31076
|
if (eventElement && containerRef.current) {
|
|
@@ -31094,7 +31128,7 @@ function AnnotationHistory({ rUri, hoveredAnnotationId, onEventHover, onEventCli
|
|
|
31094
31128
|
}
|
|
31095
31129
|
|
|
31096
31130
|
// src/components/resource/BrowseView.tsx
|
|
31097
|
-
import { useEffect as
|
|
31131
|
+
import { useEffect as useEffect28, useRef as useRef17, useCallback as useCallback18, useMemo as useMemo7, memo as memo2 } from "react";
|
|
31098
31132
|
import { annotationId as toAnnotationId3, resourceId as toResourceId5 } from "@semiont/core";
|
|
31099
31133
|
import { capabilitiesOf as capabilitiesOf4, getBodySource as getBodySource4, isResolvedReference as isResolvedReference4 } from "@semiont/core";
|
|
31100
31134
|
import { createHoverHandlers as createHoverHandlers3 } from "@semiont/sdk";
|
|
@@ -31167,15 +31201,15 @@ var BrowseView = memo2(function BrowseView2({
|
|
|
31167
31201
|
const inlineMod = inline ? " semiont-browse-view--inline" : "";
|
|
31168
31202
|
const render = capabilitiesOf4(mimeType)?.render ?? "none";
|
|
31169
31203
|
const { highlights, references, assessments, comments, tags: tags3 } = annotations;
|
|
31170
|
-
const allAnnotations =
|
|
31204
|
+
const allAnnotations = useMemo7(
|
|
31171
31205
|
() => [...highlights, ...references, ...assessments, ...comments, ...tags3],
|
|
31172
31206
|
[highlights, references, assessments, comments, tags3]
|
|
31173
31207
|
);
|
|
31174
|
-
const overlayAnnotations =
|
|
31208
|
+
const overlayAnnotations = useMemo7(
|
|
31175
31209
|
() => toOverlayAnnotations(allAnnotations),
|
|
31176
31210
|
[allAnnotations]
|
|
31177
31211
|
);
|
|
31178
|
-
|
|
31212
|
+
useEffect28(() => {
|
|
31179
31213
|
if (!containerRef.current || overlayAnnotations.length === 0) return;
|
|
31180
31214
|
const container = containerRef.current;
|
|
31181
31215
|
const offsetMap = buildSourceToRenderedMap(content2, container);
|
|
@@ -31184,7 +31218,7 @@ var BrowseView = memo2(function BrowseView2({
|
|
|
31184
31218
|
applyHighlights(ranges);
|
|
31185
31219
|
return () => clearHighlights(container);
|
|
31186
31220
|
}, [content2, overlayAnnotations]);
|
|
31187
|
-
|
|
31221
|
+
useEffect28(() => {
|
|
31188
31222
|
if (!containerRef.current) return;
|
|
31189
31223
|
if (!session) return;
|
|
31190
31224
|
const container = containerRef.current;
|
|
@@ -31337,7 +31371,7 @@ var BrowseView = memo2(function BrowseView2({
|
|
|
31337
31371
|
});
|
|
31338
31372
|
|
|
31339
31373
|
// src/components/resource/ResourceViewer.tsx
|
|
31340
|
-
import { useState as
|
|
31374
|
+
import { useState as useState24, useCallback as useCallback19, useRef as useRef18, useMemo as useMemo8 } from "react";
|
|
31341
31375
|
import { getExactText as getExactText3, getTargetSelector as getTargetSelector4, isHighlight as isHighlight5, isAssessment as isAssessment4, isReference as isReference6, isComment as isComment5, isTag as isTag5, getBodySource as getBodySource5 } from "@semiont/core";
|
|
31342
31376
|
import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
31343
31377
|
function ResourceViewer({
|
|
@@ -31379,7 +31413,7 @@ function ResourceViewer({
|
|
|
31379
31413
|
return "text/plain";
|
|
31380
31414
|
};
|
|
31381
31415
|
const mimeType = getMimeType();
|
|
31382
|
-
const [internalAnnotateMode, setInternalAnnotateMode] =
|
|
31416
|
+
const [internalAnnotateMode, setInternalAnnotateMode] = useState24(false);
|
|
31383
31417
|
const annotateMode = annotateModeProp ?? internalAnnotateMode;
|
|
31384
31418
|
const changeAnnotateMode = useCallback19((mode) => {
|
|
31385
31419
|
if (annotateModeProp === void 0) setInternalAnnotateMode(mode);
|
|
@@ -31396,30 +31430,30 @@ function ResourceViewer({
|
|
|
31396
31430
|
const handleAnnotateBodyUpdated = useCallback19(() => {
|
|
31397
31431
|
semiont?.browse.invalidateAnnotationList(rUri);
|
|
31398
31432
|
}, [semiont, rUri]);
|
|
31399
|
-
const [internalSelectionMotivation, setInternalSelectionMotivation] =
|
|
31433
|
+
const [internalSelectionMotivation, setInternalSelectionMotivation] = useState24("linking");
|
|
31400
31434
|
const selectedMotivation = selectionMotivationProp !== void 0 ? selectionMotivationProp : internalSelectionMotivation;
|
|
31401
31435
|
const changeSelectionMotivation = useCallback19((motivation) => {
|
|
31402
31436
|
if (selectionMotivationProp === void 0) setInternalSelectionMotivation(motivation);
|
|
31403
31437
|
onSelectionMotivationChange?.(motivation);
|
|
31404
31438
|
}, [selectionMotivationProp, onSelectionMotivationChange]);
|
|
31405
|
-
const [internalClickAction, setInternalClickAction] =
|
|
31439
|
+
const [internalClickAction, setInternalClickAction] = useState24("detail");
|
|
31406
31440
|
const selectedClick = clickActionProp ?? internalClickAction;
|
|
31407
31441
|
const changeClickAction = useCallback19((action) => {
|
|
31408
31442
|
if (clickActionProp === void 0) setInternalClickAction(action);
|
|
31409
31443
|
onClickActionChange?.(action);
|
|
31410
31444
|
}, [clickActionProp, onClickActionChange]);
|
|
31411
|
-
const [internalShape, setInternalShape] =
|
|
31445
|
+
const [internalShape, setInternalShape] = useState24("rectangle");
|
|
31412
31446
|
const selectedShape = shapeProp ?? internalShape;
|
|
31413
31447
|
const changeShape = useCallback19((shape) => {
|
|
31414
31448
|
if (shapeProp === void 0) setInternalShape(shape);
|
|
31415
31449
|
onShapeChange?.(shape);
|
|
31416
31450
|
}, [shapeProp, onShapeChange]);
|
|
31417
|
-
const [showJsonLdView, setShowJsonLdView] =
|
|
31418
|
-
const [jsonLdAnnotation, setJsonLdAnnotation] =
|
|
31419
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
31451
|
+
const [showJsonLdView, setShowJsonLdView] = useState24(false);
|
|
31452
|
+
const [jsonLdAnnotation, setJsonLdAnnotation] = useState24(null);
|
|
31453
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState24(null);
|
|
31420
31454
|
const hoveredAnnotationId = hoveredAnnotationIdProp ?? null;
|
|
31421
|
-
const [scrollToAnnotationId, setScrollToAnnotationId] =
|
|
31422
|
-
const [_focusedAnnotationId, setFocusedAnnotationId] =
|
|
31455
|
+
const [scrollToAnnotationId, setScrollToAnnotationId] = useState24(null);
|
|
31456
|
+
const [_focusedAnnotationId, setFocusedAnnotationId] = useState24(null);
|
|
31423
31457
|
const focusAnnotation = useCallback19((annotationId2) => {
|
|
31424
31458
|
setFocusedAnnotationId(annotationId2);
|
|
31425
31459
|
setScrollToAnnotationId(annotationId2);
|
|
@@ -31496,7 +31530,7 @@ function ResourceViewer({
|
|
|
31496
31530
|
// Annotation clicks
|
|
31497
31531
|
"browse:click": handleAnnotationClickEvent
|
|
31498
31532
|
});
|
|
31499
|
-
const annotationsCollection =
|
|
31533
|
+
const annotationsCollection = useMemo8(
|
|
31500
31534
|
() => ({ highlights, references, assessments, comments, tags: tags3 }),
|
|
31501
31535
|
[highlights, references, assessments, comments, tags3]
|
|
31502
31536
|
);
|
|
@@ -31716,11 +31750,11 @@ function AssessmentEntry({
|
|
|
31716
31750
|
}
|
|
31717
31751
|
|
|
31718
31752
|
// src/components/resource/panels/AssessmentPanel.tsx
|
|
31719
|
-
import { useState as
|
|
31753
|
+
import { useState as useState26, useEffect as useEffect30, useRef as useRef19, useCallback as useCallback21, useMemo as useMemo9 } from "react";
|
|
31720
31754
|
import { getTextPositionSelector as getTextPositionSelector3, getTargetSelector as getTargetSelector5 } from "@semiont/core";
|
|
31721
31755
|
|
|
31722
31756
|
// src/components/resource/panels/AssistSection.tsx
|
|
31723
|
-
import { useState as
|
|
31757
|
+
import { useState as useState25, useEffect as useEffect29, useCallback as useCallback20 } from "react";
|
|
31724
31758
|
import { Fragment as Fragment4, jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
31725
31759
|
function AssistSection({
|
|
31726
31760
|
session,
|
|
@@ -31732,17 +31766,17 @@ function AssistSection({
|
|
|
31732
31766
|
}) {
|
|
31733
31767
|
const panelName = annotationType === "highlight" ? "HighlightPanel" : annotationType === "assessment" ? "AssessmentPanel" : "CommentsPanel";
|
|
31734
31768
|
const t12 = useTranslations(panelName);
|
|
31735
|
-
const [instructions, setInstructions] =
|
|
31736
|
-
const [tone, setTone] =
|
|
31769
|
+
const [instructions, setInstructions] = useState25("");
|
|
31770
|
+
const [tone, setTone] = useState25("");
|
|
31737
31771
|
const defaultDensity = annotationType === "comment" ? 5 : annotationType === "assessment" ? 4 : annotationType === "highlight" ? 5 : 5;
|
|
31738
|
-
const [density, setDensity] =
|
|
31739
|
-
const [useDensity, setUseDensity] =
|
|
31740
|
-
const [isExpanded, setIsExpanded] =
|
|
31772
|
+
const [density, setDensity] = useState25(defaultDensity);
|
|
31773
|
+
const [useDensity, setUseDensity] = useState25(true);
|
|
31774
|
+
const [isExpanded, setIsExpanded] = useState25(() => {
|
|
31741
31775
|
if (typeof window === "undefined") return true;
|
|
31742
31776
|
const stored = localStorage.getItem(`assist-section-expanded-${annotationType}`);
|
|
31743
31777
|
return stored ? stored === "true" : true;
|
|
31744
31778
|
});
|
|
31745
|
-
|
|
31779
|
+
useEffect29(() => {
|
|
31746
31780
|
if (typeof window === "undefined") return;
|
|
31747
31781
|
localStorage.setItem(`assist-section-expanded-${annotationType}`, String(isExpanded));
|
|
31748
31782
|
}, [isExpanded, annotationType]);
|
|
@@ -31970,11 +32004,11 @@ function AssessmentPanel({
|
|
|
31970
32004
|
hoveredAnnotationId
|
|
31971
32005
|
}) {
|
|
31972
32006
|
const t12 = useTranslations("AssessmentPanel");
|
|
31973
|
-
const [newAssessmentText, setNewAssessmentText] =
|
|
31974
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
32007
|
+
const [newAssessmentText, setNewAssessmentText] = useState26("");
|
|
32008
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState26(null);
|
|
31975
32009
|
const containerRef = useRef19(null);
|
|
31976
32010
|
const entryRefs = useRef19(/* @__PURE__ */ new Map());
|
|
31977
|
-
const sortedAnnotations =
|
|
32011
|
+
const sortedAnnotations = useMemo9(() => {
|
|
31978
32012
|
return [...annotations].sort((a15, b8) => {
|
|
31979
32013
|
const aSelector = getTextPositionSelector3(getTargetSelector5(a15.target));
|
|
31980
32014
|
const bSelector = getTextPositionSelector3(getTargetSelector5(b8.target));
|
|
@@ -31989,7 +32023,7 @@ function AssessmentPanel({
|
|
|
31989
32023
|
entryRefs.current.delete(id2);
|
|
31990
32024
|
}
|
|
31991
32025
|
}, []);
|
|
31992
|
-
|
|
32026
|
+
useEffect30(() => {
|
|
31993
32027
|
if (!scrollToAnnotationId) return;
|
|
31994
32028
|
const element = entryRefs.current.get(scrollToAnnotationId);
|
|
31995
32029
|
if (element && containerRef.current) {
|
|
@@ -32004,7 +32038,7 @@ function AssessmentPanel({
|
|
|
32004
32038
|
if (onScrollCompleted) onScrollCompleted();
|
|
32005
32039
|
}
|
|
32006
32040
|
}, [scrollToAnnotationId]);
|
|
32007
|
-
|
|
32041
|
+
useEffect30(() => {
|
|
32008
32042
|
if (!hoveredAnnotationId) return;
|
|
32009
32043
|
const element = entryRefs.current.get(hoveredAnnotationId);
|
|
32010
32044
|
if (!element || !containerRef.current) return;
|
|
@@ -32033,7 +32067,7 @@ function AssessmentPanel({
|
|
|
32033
32067
|
setNewAssessmentText("");
|
|
32034
32068
|
}
|
|
32035
32069
|
};
|
|
32036
|
-
|
|
32070
|
+
useEffect30(() => {
|
|
32037
32071
|
if (!pendingAnnotation) return;
|
|
32038
32072
|
const handleEscape = (e6) => {
|
|
32039
32073
|
if (e6.key === "Escape") {
|
|
@@ -32212,7 +32246,7 @@ function CollaborationPanel({
|
|
|
32212
32246
|
}
|
|
32213
32247
|
|
|
32214
32248
|
// src/components/resource/panels/CommentEntry.tsx
|
|
32215
|
-
import { useState as
|
|
32249
|
+
import { useState as useState27, useEffect as useEffect31, useRef as useRef20, useImperativeHandle } from "react";
|
|
32216
32250
|
import { getAnnotationExactText as getAnnotationExactText2, getCommentText } from "@semiont/core";
|
|
32217
32251
|
import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
32218
32252
|
function formatRelativeTime3(isoString) {
|
|
@@ -32239,13 +32273,13 @@ function CommentEntry({
|
|
|
32239
32273
|
}) {
|
|
32240
32274
|
const t12 = useTranslations("CommentsPanel");
|
|
32241
32275
|
const hoverProps = useHoverEmitter(session, comment2.id);
|
|
32242
|
-
const [isEditing, setIsEditing] =
|
|
32243
|
-
const [editText, setEditText] =
|
|
32276
|
+
const [isEditing, setIsEditing] = useState27(false);
|
|
32277
|
+
const [editText, setEditText] = useState27("");
|
|
32244
32278
|
const internalRef = useRef20(null);
|
|
32245
32279
|
useImperativeHandle(ref, () => internalRef.current);
|
|
32246
32280
|
const commentText = getCommentText(comment2) || "";
|
|
32247
32281
|
const selectedText = getAnnotationExactText2(comment2);
|
|
32248
|
-
|
|
32282
|
+
useEffect31(() => {
|
|
32249
32283
|
if (isFocused && internalRef.current) {
|
|
32250
32284
|
internalRef.current.scrollIntoView({
|
|
32251
32285
|
behavior: "smooth",
|
|
@@ -32347,7 +32381,7 @@ function CommentEntry({
|
|
|
32347
32381
|
}
|
|
32348
32382
|
|
|
32349
32383
|
// src/components/resource/panels/CommentsPanel.tsx
|
|
32350
|
-
import { useState as
|
|
32384
|
+
import { useState as useState28, useEffect as useEffect32, useRef as useRef21, useCallback as useCallback22, useMemo as useMemo10 } from "react";
|
|
32351
32385
|
import { getTextPositionSelector as getTextPositionSelector4, getTargetSelector as getTargetSelector6 } from "@semiont/core";
|
|
32352
32386
|
import { jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
32353
32387
|
function getSelectorDisplayText2(selector) {
|
|
@@ -32378,11 +32412,11 @@ function CommentsPanel({
|
|
|
32378
32412
|
hoveredAnnotationId
|
|
32379
32413
|
}) {
|
|
32380
32414
|
const t12 = useTranslations("CommentsPanel");
|
|
32381
|
-
const [newCommentText, setNewCommentText] =
|
|
32382
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
32415
|
+
const [newCommentText, setNewCommentText] = useState28("");
|
|
32416
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState28(null);
|
|
32383
32417
|
const containerRef = useRef21(null);
|
|
32384
32418
|
const entryRefs = useRef21(/* @__PURE__ */ new Map());
|
|
32385
|
-
const sortedAnnotations =
|
|
32419
|
+
const sortedAnnotations = useMemo10(() => {
|
|
32386
32420
|
return [...annotations].sort((a15, b8) => {
|
|
32387
32421
|
const aSelector = getTextPositionSelector4(getTargetSelector6(a15.target));
|
|
32388
32422
|
const bSelector = getTextPositionSelector4(getTargetSelector6(b8.target));
|
|
@@ -32397,7 +32431,7 @@ function CommentsPanel({
|
|
|
32397
32431
|
entryRefs.current.delete(id2);
|
|
32398
32432
|
}
|
|
32399
32433
|
}, []);
|
|
32400
|
-
|
|
32434
|
+
useEffect32(() => {
|
|
32401
32435
|
if (!scrollToAnnotationId) return;
|
|
32402
32436
|
const element = entryRefs.current.get(scrollToAnnotationId);
|
|
32403
32437
|
if (element && containerRef.current) {
|
|
@@ -32414,7 +32448,7 @@ function CommentsPanel({
|
|
|
32414
32448
|
}
|
|
32415
32449
|
}
|
|
32416
32450
|
}, [scrollToAnnotationId]);
|
|
32417
|
-
|
|
32451
|
+
useEffect32(() => {
|
|
32418
32452
|
if (!hoveredAnnotationId) return;
|
|
32419
32453
|
const element = entryRefs.current.get(hoveredAnnotationId);
|
|
32420
32454
|
if (!element || !containerRef.current) return;
|
|
@@ -32448,7 +32482,7 @@ function CommentsPanel({
|
|
|
32448
32482
|
setNewCommentText("");
|
|
32449
32483
|
}
|
|
32450
32484
|
};
|
|
32451
|
-
|
|
32485
|
+
useEffect32(() => {
|
|
32452
32486
|
if (!pendingAnnotation) return;
|
|
32453
32487
|
const handleEscape = (e6) => {
|
|
32454
32488
|
if (e6.key === "Escape") {
|
|
@@ -32600,7 +32634,7 @@ function HighlightEntry({
|
|
|
32600
32634
|
}
|
|
32601
32635
|
|
|
32602
32636
|
// src/components/resource/panels/HighlightPanel.tsx
|
|
32603
|
-
import { useEffect as
|
|
32637
|
+
import { useEffect as useEffect33, useState as useState29, useRef as useRef22, useCallback as useCallback23, useMemo as useMemo11 } from "react";
|
|
32604
32638
|
import { getTextPositionSelector as getTextPositionSelector5, getTargetSelector as getTargetSelector7 } from "@semiont/core";
|
|
32605
32639
|
import { jsx as jsx35, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
32606
32640
|
function HighlightPanel({
|
|
@@ -32617,10 +32651,10 @@ function HighlightPanel({
|
|
|
32617
32651
|
sourceLanguage
|
|
32618
32652
|
}) {
|
|
32619
32653
|
const t12 = useTranslations("HighlightPanel");
|
|
32620
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
32654
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState29(null);
|
|
32621
32655
|
const containerRef = useRef22(null);
|
|
32622
32656
|
const entryRefs = useRef22(/* @__PURE__ */ new Map());
|
|
32623
|
-
const sortedAnnotations =
|
|
32657
|
+
const sortedAnnotations = useMemo11(() => {
|
|
32624
32658
|
return [...annotations].sort((a15, b8) => {
|
|
32625
32659
|
const aSelector = getTextPositionSelector5(getTargetSelector7(a15.target));
|
|
32626
32660
|
const bSelector = getTextPositionSelector5(getTargetSelector7(b8.target));
|
|
@@ -32635,7 +32669,7 @@ function HighlightPanel({
|
|
|
32635
32669
|
entryRefs.current.delete(id2);
|
|
32636
32670
|
}
|
|
32637
32671
|
}, []);
|
|
32638
|
-
|
|
32672
|
+
useEffect33(() => {
|
|
32639
32673
|
if (!scrollToAnnotationId) return;
|
|
32640
32674
|
const element = entryRefs.current.get(scrollToAnnotationId);
|
|
32641
32675
|
if (element && containerRef.current) {
|
|
@@ -32650,7 +32684,7 @@ function HighlightPanel({
|
|
|
32650
32684
|
if (onScrollCompleted) onScrollCompleted();
|
|
32651
32685
|
}
|
|
32652
32686
|
}, [scrollToAnnotationId]);
|
|
32653
|
-
|
|
32687
|
+
useEffect33(() => {
|
|
32654
32688
|
if (!hoveredAnnotationId) return;
|
|
32655
32689
|
const element = entryRefs.current.get(hoveredAnnotationId);
|
|
32656
32690
|
if (!element || !containerRef.current) return;
|
|
@@ -32673,7 +32707,7 @@ function HighlightPanel({
|
|
|
32673
32707
|
useSessionEventSubscriptions(session, {
|
|
32674
32708
|
"browse:click": handleAnnotationClick2
|
|
32675
32709
|
});
|
|
32676
|
-
|
|
32710
|
+
useEffect33(() => {
|
|
32677
32711
|
if (pendingAnnotation && pendingAnnotation.motivation === "highlighting") {
|
|
32678
32712
|
session?.client.mark.submit({
|
|
32679
32713
|
source: resourceId2,
|
|
@@ -32711,16 +32745,16 @@ function HighlightPanel({
|
|
|
32711
32745
|
}
|
|
32712
32746
|
|
|
32713
32747
|
// src/components/resource/panels/JsonLdPanel.tsx
|
|
32714
|
-
import { useEffect as
|
|
32748
|
+
import { useEffect as useEffect35, useRef as useRef23 } from "react";
|
|
32715
32749
|
|
|
32716
32750
|
// src/hooks/useResourceGraph.ts
|
|
32717
|
-
import { useEffect as
|
|
32751
|
+
import { useEffect as useEffect34, useState as useState30 } from "react";
|
|
32718
32752
|
function useResourceGraph(id2) {
|
|
32719
32753
|
const semiont = useObservable(useSemiont().activeSession$)?.client;
|
|
32720
|
-
const [graph, setGraph] =
|
|
32721
|
-
const [loading, setLoading] =
|
|
32722
|
-
const [error, setError] =
|
|
32723
|
-
|
|
32754
|
+
const [graph, setGraph] = useState30(null);
|
|
32755
|
+
const [loading, setLoading] = useState30(true);
|
|
32756
|
+
const [error, setError] = useState30(null);
|
|
32757
|
+
useEffect34(() => {
|
|
32724
32758
|
if (!semiont || !id2) {
|
|
32725
32759
|
setLoading(false);
|
|
32726
32760
|
return;
|
|
@@ -32752,7 +32786,7 @@ function JsonLdPanel({ resourceId: resourceId2 }) {
|
|
|
32752
32786
|
const { showLineNumbers } = useLineNumbers();
|
|
32753
32787
|
const { graph, loading, error } = useResourceGraph(resourceId2);
|
|
32754
32788
|
const documentText = graph ? JSON.stringify(graph, null, 2) : "";
|
|
32755
|
-
|
|
32789
|
+
useEffect35(() => {
|
|
32756
32790
|
if (!editorRef.current || !documentText) return;
|
|
32757
32791
|
const isDarkMode = document.documentElement?.classList.contains("dark") ?? false;
|
|
32758
32792
|
const extensions = [
|
|
@@ -32998,7 +33032,7 @@ function ReferenceEntry({
|
|
|
32998
33032
|
}
|
|
32999
33033
|
|
|
33000
33034
|
// src/components/resource/panels/ReferencesPanel.tsx
|
|
33001
|
-
import { useState as
|
|
33035
|
+
import { useState as useState31, useRef as useRef24, useEffect as useEffect36, useCallback as useCallback24, useMemo as useMemo12 } from "react";
|
|
33002
33036
|
import { getTextPositionSelector as getTextPositionSelector6, getTargetSelector as getTargetSelector9 } from "@semiont/core";
|
|
33003
33037
|
import { Fragment as Fragment5, jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
33004
33038
|
function getSelectorDisplayText3(selector) {
|
|
@@ -33036,23 +33070,23 @@ function ReferencesPanel({
|
|
|
33036
33070
|
sourceLanguage
|
|
33037
33071
|
}) {
|
|
33038
33072
|
const t12 = useTranslations("ReferencesPanel");
|
|
33039
|
-
const [selectedEntityTypes, setSelectedEntityTypes] =
|
|
33040
|
-
const [lastAnnotationLog, setLastDetectionLog] =
|
|
33041
|
-
const [pendingEntityTypes, setPendingEntityTypes] =
|
|
33042
|
-
const [includeDescriptiveReferences, setIncludeDescriptiveReferences] =
|
|
33043
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
33073
|
+
const [selectedEntityTypes, setSelectedEntityTypes] = useState31([]);
|
|
33074
|
+
const [lastAnnotationLog, setLastDetectionLog] = useState31(null);
|
|
33075
|
+
const [pendingEntityTypes, setPendingEntityTypes] = useState31([]);
|
|
33076
|
+
const [includeDescriptiveReferences, setIncludeDescriptiveReferences] = useState31(false);
|
|
33077
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState31(null);
|
|
33044
33078
|
const containerRef = useRef24(null);
|
|
33045
|
-
const [isAssistExpanded, setIsDetectExpanded] =
|
|
33079
|
+
const [isAssistExpanded, setIsDetectExpanded] = useState31(() => {
|
|
33046
33080
|
if (typeof window === "undefined") return true;
|
|
33047
33081
|
const stored = localStorage.getItem("assist-section-expanded-reference");
|
|
33048
33082
|
return stored ? stored === "true" : true;
|
|
33049
33083
|
});
|
|
33050
|
-
|
|
33084
|
+
useEffect36(() => {
|
|
33051
33085
|
if (typeof window === "undefined") return;
|
|
33052
33086
|
localStorage.setItem("assist-section-expanded-reference", String(isAssistExpanded));
|
|
33053
33087
|
}, [isAssistExpanded]);
|
|
33054
33088
|
const entryRefs = useRef24(/* @__PURE__ */ new Map());
|
|
33055
|
-
const sortedAnnotations =
|
|
33089
|
+
const sortedAnnotations = useMemo12(() => {
|
|
33056
33090
|
return [...annotations].sort((a15, b8) => {
|
|
33057
33091
|
const aSelector = getTextPositionSelector6(getTargetSelector9(a15.target));
|
|
33058
33092
|
const bSelector = getTextPositionSelector6(getTargetSelector9(b8.target));
|
|
@@ -33067,7 +33101,7 @@ function ReferencesPanel({
|
|
|
33067
33101
|
entryRefs.current.delete(id2);
|
|
33068
33102
|
}
|
|
33069
33103
|
}, []);
|
|
33070
|
-
|
|
33104
|
+
useEffect36(() => {
|
|
33071
33105
|
if (!scrollToAnnotationId) return;
|
|
33072
33106
|
const element = entryRefs.current.get(scrollToAnnotationId);
|
|
33073
33107
|
if (element && containerRef.current) {
|
|
@@ -33086,7 +33120,7 @@ function ReferencesPanel({
|
|
|
33086
33120
|
console.warn("[ReferencesPanel] Element not found for scrollToAnnotationId:", scrollToAnnotationId);
|
|
33087
33121
|
}
|
|
33088
33122
|
}, [scrollToAnnotationId]);
|
|
33089
|
-
|
|
33123
|
+
useEffect36(() => {
|
|
33090
33124
|
if (!hoveredAnnotationId) return;
|
|
33091
33125
|
const element = entryRefs.current.get(hoveredAnnotationId);
|
|
33092
33126
|
if (!element || !containerRef.current) return;
|
|
@@ -33121,7 +33155,7 @@ function ReferencesPanel({
|
|
|
33121
33155
|
});
|
|
33122
33156
|
};
|
|
33123
33157
|
const hasSavedLogRef = useRef24(false);
|
|
33124
|
-
|
|
33158
|
+
useEffect36(() => {
|
|
33125
33159
|
if (isAssisting) {
|
|
33126
33160
|
hasSavedLogRef.current = false;
|
|
33127
33161
|
return;
|
|
@@ -33149,7 +33183,7 @@ function ReferencesPanel({
|
|
|
33149
33183
|
setPendingEntityTypes([]);
|
|
33150
33184
|
}
|
|
33151
33185
|
};
|
|
33152
|
-
|
|
33186
|
+
useEffect36(() => {
|
|
33153
33187
|
if (!pendingAnnotation) return;
|
|
33154
33188
|
const handleEscape = (e6) => {
|
|
33155
33189
|
if (e6.key === "Escape") {
|
|
@@ -33589,7 +33623,7 @@ function StatisticsPanel({
|
|
|
33589
33623
|
}
|
|
33590
33624
|
|
|
33591
33625
|
// src/components/resource/panels/TagEntry.tsx
|
|
33592
|
-
import { useMemo as
|
|
33626
|
+
import { useMemo as useMemo13 } from "react";
|
|
33593
33627
|
import { getAnnotationExactText as getAnnotationExactText5 } from "@semiont/core";
|
|
33594
33628
|
import { jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
33595
33629
|
function TagEntry({
|
|
@@ -33603,7 +33637,7 @@ function TagEntry({
|
|
|
33603
33637
|
const selectedText = getAnnotationExactText5(tag);
|
|
33604
33638
|
const category = getTagCategory(tag);
|
|
33605
33639
|
const schemaId = getTagSchemaId(tag);
|
|
33606
|
-
const tagSchemas$ =
|
|
33640
|
+
const tagSchemas$ = useMemo13(
|
|
33607
33641
|
() => session?.client.browse.tagSchemas() ?? null,
|
|
33608
33642
|
[session]
|
|
33609
33643
|
);
|
|
@@ -33641,7 +33675,7 @@ function TagEntry({
|
|
|
33641
33675
|
}
|
|
33642
33676
|
|
|
33643
33677
|
// src/components/resource/panels/TaggingPanel.tsx
|
|
33644
|
-
import { useState as
|
|
33678
|
+
import { useState as useState32, useEffect as useEffect37, useRef as useRef25, useCallback as useCallback25, useMemo as useMemo14 } from "react";
|
|
33645
33679
|
import { getTextPositionSelector as getTextPositionSelector7, getTargetSelector as getTargetSelector10 } from "@semiont/core";
|
|
33646
33680
|
import { Fragment as Fragment7, jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
33647
33681
|
function getSelectorDisplayText4(selector) {
|
|
@@ -33672,28 +33706,28 @@ function TaggingPanel({
|
|
|
33672
33706
|
sourceLanguage
|
|
33673
33707
|
}) {
|
|
33674
33708
|
const t12 = useTranslations("TaggingPanel");
|
|
33675
|
-
const tagSchemas$ =
|
|
33709
|
+
const tagSchemas$ = useMemo14(
|
|
33676
33710
|
() => session?.client.browse.tagSchemas() ?? null,
|
|
33677
33711
|
[session]
|
|
33678
33712
|
);
|
|
33679
33713
|
const schemasObserved = useObservable(tagSchemas$);
|
|
33680
33714
|
const schemas = schemasObserved ?? [];
|
|
33681
33715
|
const noSchemasRegistered = schemasObserved !== void 0 && schemasObserved.length === 0;
|
|
33682
|
-
const [selectedSchemaId, setSelectedSchemaId] =
|
|
33683
|
-
const [selectedCategories, setSelectedCategories] =
|
|
33684
|
-
|
|
33716
|
+
const [selectedSchemaId, setSelectedSchemaId] = useState32("");
|
|
33717
|
+
const [selectedCategories, setSelectedCategories] = useState32(/* @__PURE__ */ new Set());
|
|
33718
|
+
useEffect37(() => {
|
|
33685
33719
|
if (!selectedSchemaId && schemas.length > 0) {
|
|
33686
33720
|
setSelectedSchemaId(schemas[0].id);
|
|
33687
33721
|
}
|
|
33688
33722
|
}, [schemas, selectedSchemaId]);
|
|
33689
|
-
const [focusedAnnotationId, setFocusedAnnotationId] =
|
|
33723
|
+
const [focusedAnnotationId, setFocusedAnnotationId] = useState32(null);
|
|
33690
33724
|
const containerRef = useRef25(null);
|
|
33691
|
-
const [isAssistExpanded, setIsDetectExpanded] =
|
|
33725
|
+
const [isAssistExpanded, setIsDetectExpanded] = useState32(() => {
|
|
33692
33726
|
if (typeof window === "undefined") return true;
|
|
33693
33727
|
const stored = localStorage.getItem("assist-section-expanded-tag");
|
|
33694
33728
|
return stored ? stored === "true" : true;
|
|
33695
33729
|
});
|
|
33696
|
-
|
|
33730
|
+
useEffect37(() => {
|
|
33697
33731
|
if (typeof window === "undefined") return;
|
|
33698
33732
|
localStorage.setItem("assist-section-expanded-tag", String(isAssistExpanded));
|
|
33699
33733
|
}, [isAssistExpanded]);
|
|
@@ -33705,7 +33739,7 @@ function TaggingPanel({
|
|
|
33705
33739
|
"browse:click": handleAnnotationClick2
|
|
33706
33740
|
});
|
|
33707
33741
|
const entryRefs = useRef25(/* @__PURE__ */ new Map());
|
|
33708
|
-
const sortedAnnotations =
|
|
33742
|
+
const sortedAnnotations = useMemo14(() => {
|
|
33709
33743
|
return [...annotations].sort((a15, b8) => {
|
|
33710
33744
|
const aSelector = getTextPositionSelector7(getTargetSelector10(a15.target));
|
|
33711
33745
|
const bSelector = getTextPositionSelector7(getTargetSelector10(b8.target));
|
|
@@ -33720,7 +33754,7 @@ function TaggingPanel({
|
|
|
33720
33754
|
entryRefs.current.delete(id2);
|
|
33721
33755
|
}
|
|
33722
33756
|
}, []);
|
|
33723
|
-
|
|
33757
|
+
useEffect37(() => {
|
|
33724
33758
|
if (!scrollToAnnotationId) return;
|
|
33725
33759
|
const element = entryRefs.current.get(scrollToAnnotationId);
|
|
33726
33760
|
if (element && containerRef.current) {
|
|
@@ -33735,7 +33769,7 @@ function TaggingPanel({
|
|
|
33735
33769
|
if (onScrollCompleted) onScrollCompleted();
|
|
33736
33770
|
}
|
|
33737
33771
|
}, [scrollToAnnotationId]);
|
|
33738
|
-
|
|
33772
|
+
useEffect37(() => {
|
|
33739
33773
|
if (!hoveredAnnotationId) return;
|
|
33740
33774
|
const element = entryRefs.current.get(hoveredAnnotationId);
|
|
33741
33775
|
if (!element || !containerRef.current) return;
|
|
@@ -33786,7 +33820,7 @@ function TaggingPanel({
|
|
|
33786
33820
|
setSelectedCategories(/* @__PURE__ */ new Set());
|
|
33787
33821
|
}
|
|
33788
33822
|
};
|
|
33789
|
-
|
|
33823
|
+
useEffect37(() => {
|
|
33790
33824
|
if (!pendingAnnotation) return;
|
|
33791
33825
|
const handleEscape = (e6) => {
|
|
33792
33826
|
if (e6.key === "Escape") {
|
|
@@ -34017,7 +34051,7 @@ function TaggingPanel({
|
|
|
34017
34051
|
}
|
|
34018
34052
|
|
|
34019
34053
|
// src/components/resource/panels/UnifiedAnnotationsPanel.tsx
|
|
34020
|
-
import { useState as
|
|
34054
|
+
import { useState as useState33, useEffect as useEffect38 } from "react";
|
|
34021
34055
|
import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
34022
34056
|
var TAB_ORDER = ["statistics", "reference", "highlight", "assessment", "comment", "tag"];
|
|
34023
34057
|
function UnifiedAnnotationsPanel(props) {
|
|
@@ -34039,7 +34073,7 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
34039
34073
|
}
|
|
34040
34074
|
}
|
|
34041
34075
|
const grouped = groups;
|
|
34042
|
-
const [activeTab, setActiveTab] =
|
|
34076
|
+
const [activeTab, setActiveTab] = useState33(() => {
|
|
34043
34077
|
if (typeof window === "undefined") return props.initialTab || "statistics";
|
|
34044
34078
|
const storageKey = props.resourceId ? `annotations-tab-${props.resourceId}` : "annotations-tab-global";
|
|
34045
34079
|
const stored = localStorage.getItem(storageKey);
|
|
@@ -34048,17 +34082,17 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
34048
34082
|
}
|
|
34049
34083
|
return props.initialTab || "statistics";
|
|
34050
34084
|
});
|
|
34051
|
-
|
|
34085
|
+
useEffect38(() => {
|
|
34052
34086
|
if (typeof window === "undefined") return;
|
|
34053
34087
|
const storageKey = props.resourceId ? `annotations-tab-${props.resourceId}` : "annotations-tab-global";
|
|
34054
34088
|
localStorage.setItem(storageKey, activeTab);
|
|
34055
34089
|
}, [activeTab, props.resourceId]);
|
|
34056
|
-
|
|
34090
|
+
useEffect38(() => {
|
|
34057
34091
|
if (props.initialTab && props.initialTabGeneration !== void 0) {
|
|
34058
34092
|
setActiveTab(props.initialTab);
|
|
34059
34093
|
}
|
|
34060
34094
|
}, [props.initialTabGeneration]);
|
|
34061
|
-
|
|
34095
|
+
useEffect38(() => {
|
|
34062
34096
|
if (props.pendingAnnotation) {
|
|
34063
34097
|
const motivationToTab = {
|
|
34064
34098
|
"linking": "reference",
|
|
@@ -34220,7 +34254,7 @@ function ImageViewer({ imageUrl, alt = "Resource image" }) {
|
|
|
34220
34254
|
}
|
|
34221
34255
|
|
|
34222
34256
|
// src/components/navigation/Footer.tsx
|
|
34223
|
-
import { useState as
|
|
34257
|
+
import { useState as useState34 } from "react";
|
|
34224
34258
|
import { Fragment as Fragment8, jsx as jsx45, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
34225
34259
|
function Footer({
|
|
34226
34260
|
Link,
|
|
@@ -34231,7 +34265,7 @@ function Footer({
|
|
|
34231
34265
|
sourceCodeUrl = "https://github.com/The-AI-Alliance/semiont",
|
|
34232
34266
|
showPolicyLinks = true
|
|
34233
34267
|
}) {
|
|
34234
|
-
const [showCookiePreferences, setShowCookiePreferences] =
|
|
34268
|
+
const [showCookiePreferences, setShowCookiePreferences] = useState34(false);
|
|
34235
34269
|
return /* @__PURE__ */ jsxs38(Fragment8, { children: [
|
|
34236
34270
|
/* @__PURE__ */ jsx45("footer", { role: "contentinfo", className: "semiont-footer", children: /* @__PURE__ */ jsx45("div", { className: "semiont-footer__container", children: /* @__PURE__ */ jsxs38("div", { className: "semiont-footer__content", children: [
|
|
34237
34271
|
/* @__PURE__ */ jsx45("div", { className: "semiont-footer__copyright", children: t12("copyright", { year: (/* @__PURE__ */ new Date()).getFullYear() }) }),
|
|
@@ -34361,7 +34395,7 @@ function NavigationMenu({
|
|
|
34361
34395
|
}
|
|
34362
34396
|
|
|
34363
34397
|
// src/components/navigation/ObservableLink.tsx
|
|
34364
|
-
import { useCallback as useCallback26, useRef as useRef26, useEffect as
|
|
34398
|
+
import { useCallback as useCallback26, useRef as useRef26, useEffect as useEffect39 } from "react";
|
|
34365
34399
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
34366
34400
|
function ObservableLink({
|
|
34367
34401
|
href,
|
|
@@ -34372,7 +34406,7 @@ function ObservableLink({
|
|
|
34372
34406
|
}) {
|
|
34373
34407
|
const semiont = useSemiont();
|
|
34374
34408
|
const onClickRef = useRef26(onClick);
|
|
34375
|
-
|
|
34409
|
+
useEffect39(() => {
|
|
34376
34410
|
onClickRef.current = onClick;
|
|
34377
34411
|
});
|
|
34378
34412
|
const handleClick = useCallback26((e6) => {
|
|
@@ -34394,7 +34428,7 @@ function ObservableLink({
|
|
|
34394
34428
|
}
|
|
34395
34429
|
|
|
34396
34430
|
// src/components/navigation/SimpleNavigation.tsx
|
|
34397
|
-
import { useState as
|
|
34431
|
+
import { useState as useState35, useRef as useRef27, useEffect as useEffect40 } from "react";
|
|
34398
34432
|
import { jsx as jsx48, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
34399
34433
|
function SimpleNavigation({
|
|
34400
34434
|
title,
|
|
@@ -34409,12 +34443,12 @@ function SimpleNavigation({
|
|
|
34409
34443
|
}) {
|
|
34410
34444
|
const ChevronLeftIcon = icons.chevronLeft;
|
|
34411
34445
|
const BarsIcon = icons.bars;
|
|
34412
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
34446
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState35(false);
|
|
34413
34447
|
const dropdownRef = useRef27(null);
|
|
34414
34448
|
const semiont = useSemiont();
|
|
34415
34449
|
const toggleDropdown = () => setIsDropdownOpen(!isDropdownOpen);
|
|
34416
34450
|
const closeDropdown = () => setIsDropdownOpen(false);
|
|
34417
|
-
|
|
34451
|
+
useEffect40(() => {
|
|
34418
34452
|
const handleClickOutside = (event) => {
|
|
34419
34453
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
34420
34454
|
closeDropdown();
|
|
@@ -34490,19 +34524,19 @@ function SimpleNavigation({
|
|
|
34490
34524
|
}
|
|
34491
34525
|
|
|
34492
34526
|
// src/components/navigation/CollapsibleResourceNavigation.tsx
|
|
34493
|
-
import { useCallback as useCallback32, useState as
|
|
34527
|
+
import { useCallback as useCallback32, useState as useState39, useRef as useRef32, useEffect as useEffect45 } from "react";
|
|
34494
34528
|
|
|
34495
34529
|
// ../../node_modules/@dnd-kit/core/dist/core.esm.js
|
|
34496
|
-
import React18, { createContext as createContext5, useContext as useContext5, useEffect as
|
|
34530
|
+
import React18, { createContext as createContext5, useContext as useContext5, useEffect as useEffect42, useState as useState37, useCallback as useCallback29, useMemo as useMemo16, useRef as useRef29, memo as memo3, useReducer, cloneElement, forwardRef } from "react";
|
|
34497
34531
|
import { createPortal, unstable_batchedUpdates } from "react-dom";
|
|
34498
34532
|
|
|
34499
34533
|
// ../../node_modules/@dnd-kit/utilities/dist/utilities.esm.js
|
|
34500
|
-
import { useMemo as
|
|
34534
|
+
import { useMemo as useMemo15, useLayoutEffect, useEffect as useEffect41, useRef as useRef28, useCallback as useCallback27 } from "react";
|
|
34501
34535
|
function useCombinedRefs() {
|
|
34502
34536
|
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34503
34537
|
refs[_key] = arguments[_key];
|
|
34504
34538
|
}
|
|
34505
|
-
return
|
|
34539
|
+
return useMemo15(
|
|
34506
34540
|
() => (node) => {
|
|
34507
34541
|
refs.forEach((ref) => ref(node));
|
|
34508
34542
|
},
|
|
@@ -34565,7 +34599,7 @@ function getOwnerDocument(target) {
|
|
|
34565
34599
|
}
|
|
34566
34600
|
return document;
|
|
34567
34601
|
}
|
|
34568
|
-
var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect :
|
|
34602
|
+
var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect41;
|
|
34569
34603
|
function useEvent(handler) {
|
|
34570
34604
|
const handlerRef = useRef28(handler);
|
|
34571
34605
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -34605,7 +34639,7 @@ function useLatestValue(value, dependencies) {
|
|
|
34605
34639
|
}
|
|
34606
34640
|
function useLazyMemo(callback, dependencies) {
|
|
34607
34641
|
const valueRef = useRef28();
|
|
34608
|
-
return
|
|
34642
|
+
return useMemo15(
|
|
34609
34643
|
() => {
|
|
34610
34644
|
const newValue = callback(valueRef.current);
|
|
34611
34645
|
valueRef.current = newValue;
|
|
@@ -34632,14 +34666,14 @@ function useNodeRef(onChange) {
|
|
|
34632
34666
|
}
|
|
34633
34667
|
function usePrevious(value) {
|
|
34634
34668
|
const ref = useRef28();
|
|
34635
|
-
|
|
34669
|
+
useEffect41(() => {
|
|
34636
34670
|
ref.current = value;
|
|
34637
34671
|
}, [value]);
|
|
34638
34672
|
return ref.current;
|
|
34639
34673
|
}
|
|
34640
34674
|
var ids = {};
|
|
34641
34675
|
function useUniqueId(prefix, value) {
|
|
34642
|
-
return
|
|
34676
|
+
return useMemo15(() => {
|
|
34643
34677
|
if (value) {
|
|
34644
34678
|
return value;
|
|
34645
34679
|
}
|
|
@@ -34773,7 +34807,7 @@ function findFirstFocusableNode(element) {
|
|
|
34773
34807
|
}
|
|
34774
34808
|
|
|
34775
34809
|
// ../../node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js
|
|
34776
|
-
import React17, { useState as
|
|
34810
|
+
import React17, { useState as useState36, useCallback as useCallback28 } from "react";
|
|
34777
34811
|
var hiddenStyles = {
|
|
34778
34812
|
display: "none"
|
|
34779
34813
|
};
|
|
@@ -34816,7 +34850,7 @@ function LiveRegion(_ref) {
|
|
|
34816
34850
|
}, announcement);
|
|
34817
34851
|
}
|
|
34818
34852
|
function useAnnouncement() {
|
|
34819
|
-
const [announcement, setAnnouncement] =
|
|
34853
|
+
const [announcement, setAnnouncement] = useState36("");
|
|
34820
34854
|
const announce = useCallback28((value) => {
|
|
34821
34855
|
if (value != null) {
|
|
34822
34856
|
setAnnouncement(value);
|
|
@@ -34832,7 +34866,7 @@ function useAnnouncement() {
|
|
|
34832
34866
|
var DndMonitorContext = /* @__PURE__ */ createContext5(null);
|
|
34833
34867
|
function useDndMonitor(listener) {
|
|
34834
34868
|
const registerListener = useContext5(DndMonitorContext);
|
|
34835
|
-
|
|
34869
|
+
useEffect42(() => {
|
|
34836
34870
|
if (!registerListener) {
|
|
34837
34871
|
throw new Error("useDndMonitor must be used within a children of <DndContext>");
|
|
34838
34872
|
}
|
|
@@ -34841,7 +34875,7 @@ function useDndMonitor(listener) {
|
|
|
34841
34875
|
}, [listener, registerListener]);
|
|
34842
34876
|
}
|
|
34843
34877
|
function useDndMonitorProvider() {
|
|
34844
|
-
const [listeners] =
|
|
34878
|
+
const [listeners] = useState37(() => /* @__PURE__ */ new Set());
|
|
34845
34879
|
const registerListener = useCallback29((listener) => {
|
|
34846
34880
|
listeners.add(listener);
|
|
34847
34881
|
return () => listeners.delete(listener);
|
|
@@ -34907,11 +34941,11 @@ function Accessibility(_ref) {
|
|
|
34907
34941
|
announcement
|
|
34908
34942
|
} = useAnnouncement();
|
|
34909
34943
|
const liveRegionId = useUniqueId("DndLiveRegion");
|
|
34910
|
-
const [mounted, setMounted] =
|
|
34911
|
-
|
|
34944
|
+
const [mounted, setMounted] = useState37(false);
|
|
34945
|
+
useEffect42(() => {
|
|
34912
34946
|
setMounted(true);
|
|
34913
34947
|
}, []);
|
|
34914
|
-
useDndMonitor(
|
|
34948
|
+
useDndMonitor(useMemo16(() => ({
|
|
34915
34949
|
onDragStart(_ref2) {
|
|
34916
34950
|
let {
|
|
34917
34951
|
active
|
|
@@ -34989,7 +35023,7 @@ var Action;
|
|
|
34989
35023
|
function noop() {
|
|
34990
35024
|
}
|
|
34991
35025
|
function useSensor(sensor, options) {
|
|
34992
|
-
return
|
|
35026
|
+
return useMemo16(
|
|
34993
35027
|
() => ({
|
|
34994
35028
|
sensor,
|
|
34995
35029
|
options: options != null ? options : {}
|
|
@@ -35002,7 +35036,7 @@ function useSensors() {
|
|
|
35002
35036
|
for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35003
35037
|
sensors[_key] = arguments[_key];
|
|
35004
35038
|
}
|
|
35005
|
-
return
|
|
35039
|
+
return useMemo16(
|
|
35006
35040
|
() => [...sensors].filter((sensor) => sensor != null),
|
|
35007
35041
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35008
35042
|
[...sensors]
|
|
@@ -36252,7 +36286,7 @@ function useAutoScroller(_ref) {
|
|
|
36252
36286
|
x: 0,
|
|
36253
36287
|
y: 0
|
|
36254
36288
|
});
|
|
36255
|
-
const rect =
|
|
36289
|
+
const rect = useMemo16(() => {
|
|
36256
36290
|
switch (activator) {
|
|
36257
36291
|
case AutoScrollActivator.Pointer:
|
|
36258
36292
|
return pointerCoordinates ? {
|
|
@@ -36275,8 +36309,8 @@ function useAutoScroller(_ref) {
|
|
|
36275
36309
|
const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;
|
|
36276
36310
|
scrollContainer.scrollBy(scrollLeft, scrollTop);
|
|
36277
36311
|
}, []);
|
|
36278
|
-
const sortedScrollableAncestors =
|
|
36279
|
-
|
|
36312
|
+
const sortedScrollableAncestors = useMemo16(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]);
|
|
36313
|
+
useEffect42(
|
|
36280
36314
|
() => {
|
|
36281
36315
|
if (!enabled || !scrollableAncestors.length || !rect) {
|
|
36282
36316
|
clearAutoScrollInterval();
|
|
@@ -36389,7 +36423,7 @@ function useCachedNode(draggableNodes, id2) {
|
|
|
36389
36423
|
}, [node, id2]);
|
|
36390
36424
|
}
|
|
36391
36425
|
function useCombineActivators(sensors, getSyntheticHandler) {
|
|
36392
|
-
return
|
|
36426
|
+
return useMemo16(() => sensors.reduce((accumulator, sensor) => {
|
|
36393
36427
|
const {
|
|
36394
36428
|
sensor: Sensor
|
|
36395
36429
|
} = sensor;
|
|
@@ -36417,7 +36451,7 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
36417
36451
|
dependencies,
|
|
36418
36452
|
config
|
|
36419
36453
|
} = _ref;
|
|
36420
|
-
const [queue, setQueue] =
|
|
36454
|
+
const [queue, setQueue] = useState37(null);
|
|
36421
36455
|
const {
|
|
36422
36456
|
frequency,
|
|
36423
36457
|
measure,
|
|
@@ -36466,10 +36500,10 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
36466
36500
|
}
|
|
36467
36501
|
return previousValue;
|
|
36468
36502
|
}, [containers, queue, dragging, disabled, measure]);
|
|
36469
|
-
|
|
36503
|
+
useEffect42(() => {
|
|
36470
36504
|
containersRef.current = containers;
|
|
36471
36505
|
}, [containers]);
|
|
36472
|
-
|
|
36506
|
+
useEffect42(
|
|
36473
36507
|
() => {
|
|
36474
36508
|
if (disabled) {
|
|
36475
36509
|
return;
|
|
@@ -36479,7 +36513,7 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
36479
36513
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36480
36514
|
[dragging, disabled]
|
|
36481
36515
|
);
|
|
36482
|
-
|
|
36516
|
+
useEffect42(
|
|
36483
36517
|
() => {
|
|
36484
36518
|
if (queue && queue.length > 0) {
|
|
36485
36519
|
setQueue(null);
|
|
@@ -36488,7 +36522,7 @@ function useDroppableMeasuring(containers, _ref) {
|
|
|
36488
36522
|
//eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36489
36523
|
[JSON.stringify(queue)]
|
|
36490
36524
|
);
|
|
36491
|
-
|
|
36525
|
+
useEffect42(
|
|
36492
36526
|
() => {
|
|
36493
36527
|
if (disabled || typeof frequency !== "number" || timeoutId.current !== null) {
|
|
36494
36528
|
return;
|
|
@@ -36537,7 +36571,7 @@ function useMutationObserver(_ref) {
|
|
|
36537
36571
|
disabled
|
|
36538
36572
|
} = _ref;
|
|
36539
36573
|
const handleMutations = useEvent(callback);
|
|
36540
|
-
const mutationObserver =
|
|
36574
|
+
const mutationObserver = useMemo16(() => {
|
|
36541
36575
|
if (disabled || typeof window === "undefined" || typeof window.MutationObserver === "undefined") {
|
|
36542
36576
|
return void 0;
|
|
36543
36577
|
}
|
|
@@ -36546,7 +36580,7 @@ function useMutationObserver(_ref) {
|
|
|
36546
36580
|
} = window;
|
|
36547
36581
|
return new MutationObserver2(handleMutations);
|
|
36548
36582
|
}, [handleMutations, disabled]);
|
|
36549
|
-
|
|
36583
|
+
useEffect42(() => {
|
|
36550
36584
|
return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
36551
36585
|
}, [mutationObserver]);
|
|
36552
36586
|
return mutationObserver;
|
|
@@ -36557,7 +36591,7 @@ function useResizeObserver(_ref) {
|
|
|
36557
36591
|
disabled
|
|
36558
36592
|
} = _ref;
|
|
36559
36593
|
const handleResize = useEvent(callback);
|
|
36560
|
-
const resizeObserver =
|
|
36594
|
+
const resizeObserver = useMemo16(
|
|
36561
36595
|
() => {
|
|
36562
36596
|
if (disabled || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") {
|
|
36563
36597
|
return void 0;
|
|
@@ -36570,7 +36604,7 @@ function useResizeObserver(_ref) {
|
|
|
36570
36604
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36571
36605
|
[disabled]
|
|
36572
36606
|
);
|
|
36573
|
-
|
|
36607
|
+
useEffect42(() => {
|
|
36574
36608
|
return () => resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
36575
36609
|
}, [resizeObserver]);
|
|
36576
36610
|
return resizeObserver;
|
|
@@ -36582,7 +36616,7 @@ function useRect(element, measure, fallbackRect2) {
|
|
|
36582
36616
|
if (measure === void 0) {
|
|
36583
36617
|
measure = defaultMeasure;
|
|
36584
36618
|
}
|
|
36585
|
-
const [rect, setRect] =
|
|
36619
|
+
const [rect, setRect] = useState37(null);
|
|
36586
36620
|
function measureRect() {
|
|
36587
36621
|
setRect((currentRect) => {
|
|
36588
36622
|
if (!element) {
|
|
@@ -36650,13 +36684,13 @@ function useScrollableAncestors(node) {
|
|
|
36650
36684
|
}
|
|
36651
36685
|
return getScrollableAncestors(node);
|
|
36652
36686
|
}, [node]);
|
|
36653
|
-
|
|
36687
|
+
useEffect42(() => {
|
|
36654
36688
|
previousNode.current = node;
|
|
36655
36689
|
}, [node]);
|
|
36656
36690
|
return ancestors;
|
|
36657
36691
|
}
|
|
36658
36692
|
function useScrollOffsets(elements) {
|
|
36659
|
-
const [scrollCoordinates, setScrollCoordinates] =
|
|
36693
|
+
const [scrollCoordinates, setScrollCoordinates] = useState37(null);
|
|
36660
36694
|
const prevElements = useRef29(elements);
|
|
36661
36695
|
const handleScroll = useCallback29((event) => {
|
|
36662
36696
|
const scrollingElement = getScrollableElement(event.target);
|
|
@@ -36671,7 +36705,7 @@ function useScrollOffsets(elements) {
|
|
|
36671
36705
|
return new Map(scrollCoordinates2);
|
|
36672
36706
|
});
|
|
36673
36707
|
}, []);
|
|
36674
|
-
|
|
36708
|
+
useEffect42(() => {
|
|
36675
36709
|
const previousElements = prevElements.current;
|
|
36676
36710
|
if (elements !== previousElements) {
|
|
36677
36711
|
cleanup(previousElements);
|
|
@@ -36699,7 +36733,7 @@ function useScrollOffsets(elements) {
|
|
|
36699
36733
|
});
|
|
36700
36734
|
}
|
|
36701
36735
|
}, [handleScroll, elements]);
|
|
36702
|
-
return
|
|
36736
|
+
return useMemo16(() => {
|
|
36703
36737
|
if (elements.length) {
|
|
36704
36738
|
return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);
|
|
36705
36739
|
}
|
|
@@ -36711,14 +36745,14 @@ function useScrollOffsetsDelta(scrollOffsets, dependencies) {
|
|
|
36711
36745
|
dependencies = [];
|
|
36712
36746
|
}
|
|
36713
36747
|
const initialScrollOffsets = useRef29(null);
|
|
36714
|
-
|
|
36748
|
+
useEffect42(
|
|
36715
36749
|
() => {
|
|
36716
36750
|
initialScrollOffsets.current = null;
|
|
36717
36751
|
},
|
|
36718
36752
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36719
36753
|
dependencies
|
|
36720
36754
|
);
|
|
36721
|
-
|
|
36755
|
+
useEffect42(() => {
|
|
36722
36756
|
const hasScrollOffsets = scrollOffsets !== defaultCoordinates;
|
|
36723
36757
|
if (hasScrollOffsets && !initialScrollOffsets.current) {
|
|
36724
36758
|
initialScrollOffsets.current = scrollOffsets;
|
|
@@ -36730,7 +36764,7 @@ function useScrollOffsetsDelta(scrollOffsets, dependencies) {
|
|
|
36730
36764
|
return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;
|
|
36731
36765
|
}
|
|
36732
36766
|
function useSensorSetup(sensors) {
|
|
36733
|
-
|
|
36767
|
+
useEffect42(
|
|
36734
36768
|
() => {
|
|
36735
36769
|
if (!canUseDOM) {
|
|
36736
36770
|
return;
|
|
@@ -36758,7 +36792,7 @@ function useSensorSetup(sensors) {
|
|
|
36758
36792
|
);
|
|
36759
36793
|
}
|
|
36760
36794
|
function useSyntheticListeners(listeners, id2) {
|
|
36761
|
-
return
|
|
36795
|
+
return useMemo16(() => {
|
|
36762
36796
|
return listeners.reduce((acc, _ref) => {
|
|
36763
36797
|
let {
|
|
36764
36798
|
eventName,
|
|
@@ -36772,7 +36806,7 @@ function useSyntheticListeners(listeners, id2) {
|
|
|
36772
36806
|
}, [listeners, id2]);
|
|
36773
36807
|
}
|
|
36774
36808
|
function useWindowRect(element) {
|
|
36775
|
-
return
|
|
36809
|
+
return useMemo16(() => element ? getWindowClientRect(element) : null, [element]);
|
|
36776
36810
|
}
|
|
36777
36811
|
var defaultValue$2 = [];
|
|
36778
36812
|
function useRects(elements, measure) {
|
|
@@ -36781,7 +36815,7 @@ function useRects(elements, measure) {
|
|
|
36781
36815
|
}
|
|
36782
36816
|
const [firstElement] = elements;
|
|
36783
36817
|
const windowRect2 = useWindowRect(firstElement ? getWindow(firstElement) : null);
|
|
36784
|
-
const [rects, setRects] =
|
|
36818
|
+
const [rects, setRects] = useState37(defaultValue$2);
|
|
36785
36819
|
function measureRects() {
|
|
36786
36820
|
setRects(() => {
|
|
36787
36821
|
if (!elements.length) {
|
|
@@ -36814,7 +36848,7 @@ function useDragOverlayMeasuring(_ref) {
|
|
|
36814
36848
|
let {
|
|
36815
36849
|
measure
|
|
36816
36850
|
} = _ref;
|
|
36817
|
-
const [rect, setRect] =
|
|
36851
|
+
const [rect, setRect] = useState37(null);
|
|
36818
36852
|
const handleResize = useCallback29((entries) => {
|
|
36819
36853
|
for (const {
|
|
36820
36854
|
target
|
|
@@ -36844,7 +36878,7 @@ function useDragOverlayMeasuring(_ref) {
|
|
|
36844
36878
|
setRect(node ? measure(node) : null);
|
|
36845
36879
|
}, [measure, resizeObserver]);
|
|
36846
36880
|
const [nodeRef, setRef] = useNodeRef(handleNodeChange);
|
|
36847
|
-
return
|
|
36881
|
+
return useMemo16(() => ({
|
|
36848
36882
|
nodeRef,
|
|
36849
36883
|
rect,
|
|
36850
36884
|
setRef
|
|
@@ -37070,7 +37104,7 @@ function RestoreFocus(_ref) {
|
|
|
37070
37104
|
} = useContext5(InternalContext);
|
|
37071
37105
|
const previousActivatorEvent = usePrevious(activatorEvent);
|
|
37072
37106
|
const previousActiveId = usePrevious(active == null ? void 0 : active.id);
|
|
37073
|
-
|
|
37107
|
+
useEffect42(() => {
|
|
37074
37108
|
if (disabled) {
|
|
37075
37109
|
return;
|
|
37076
37110
|
}
|
|
@@ -37121,7 +37155,7 @@ function applyModifiers(modifiers2, _ref) {
|
|
|
37121
37155
|
}, transform) : transform;
|
|
37122
37156
|
}
|
|
37123
37157
|
function useMeasuringConfiguration(config) {
|
|
37124
|
-
return
|
|
37158
|
+
return useMemo16(
|
|
37125
37159
|
() => ({
|
|
37126
37160
|
draggable: {
|
|
37127
37161
|
...defaultMeasuringConfiguration.draggable,
|
|
@@ -37215,7 +37249,7 @@ var DndContext = /* @__PURE__ */ memo3(function DndContext2(_ref) {
|
|
|
37215
37249
|
const store = useReducer(reducer, void 0, getInitialState);
|
|
37216
37250
|
const [state, dispatch] = store;
|
|
37217
37251
|
const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();
|
|
37218
|
-
const [status, setStatus] =
|
|
37252
|
+
const [status, setStatus] = useState37(Status.Uninitialized);
|
|
37219
37253
|
const isInitialized = status === Status.Initialized;
|
|
37220
37254
|
const {
|
|
37221
37255
|
draggable: {
|
|
@@ -37232,7 +37266,7 @@ var DndContext = /* @__PURE__ */ memo3(function DndContext2(_ref) {
|
|
|
37232
37266
|
initial: null,
|
|
37233
37267
|
translated: null
|
|
37234
37268
|
});
|
|
37235
|
-
const active =
|
|
37269
|
+
const active = useMemo16(() => {
|
|
37236
37270
|
var _node$data;
|
|
37237
37271
|
return activeId != null ? {
|
|
37238
37272
|
id: activeId,
|
|
@@ -37242,11 +37276,11 @@ var DndContext = /* @__PURE__ */ memo3(function DndContext2(_ref) {
|
|
|
37242
37276
|
} : null;
|
|
37243
37277
|
}, [activeId, node]);
|
|
37244
37278
|
const activeRef = useRef29(null);
|
|
37245
|
-
const [activeSensor, setActiveSensor] =
|
|
37246
|
-
const [activatorEvent, setActivatorEvent] =
|
|
37279
|
+
const [activeSensor, setActiveSensor] = useState37(null);
|
|
37280
|
+
const [activatorEvent, setActivatorEvent] = useState37(null);
|
|
37247
37281
|
const latestProps = useLatestValue(props, Object.values(props));
|
|
37248
37282
|
const draggableDescribedById = useUniqueId("DndDescribedBy", id2);
|
|
37249
|
-
const enabledDroppableContainers =
|
|
37283
|
+
const enabledDroppableContainers = useMemo16(() => droppableContainers.getEnabled(), [droppableContainers]);
|
|
37250
37284
|
const measuringConfiguration = useMeasuringConfiguration(measuring);
|
|
37251
37285
|
const {
|
|
37252
37286
|
droppableRects,
|
|
@@ -37258,7 +37292,7 @@ var DndContext = /* @__PURE__ */ memo3(function DndContext2(_ref) {
|
|
|
37258
37292
|
config: measuringConfiguration.droppable
|
|
37259
37293
|
});
|
|
37260
37294
|
const activeNode = useCachedNode(draggableNodes, activeId);
|
|
37261
|
-
const activationCoordinates =
|
|
37295
|
+
const activationCoordinates = useMemo16(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]);
|
|
37262
37296
|
const autoScrollOptions = getAutoScrollerOptions();
|
|
37263
37297
|
const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
|
|
37264
37298
|
useLayoutShiftScrollCompensation({
|
|
@@ -37327,7 +37361,7 @@ var DndContext = /* @__PURE__ */ memo3(function DndContext2(_ref) {
|
|
|
37327
37361
|
pointerCoordinates
|
|
37328
37362
|
}) : null;
|
|
37329
37363
|
const overId = getFirstCollision(collisions, "id");
|
|
37330
|
-
const [over, setOver] =
|
|
37364
|
+
const [over, setOver] = useState37(null);
|
|
37331
37365
|
const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
|
|
37332
37366
|
const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
|
|
37333
37367
|
const activeSensorRef = useRef29(null);
|
|
@@ -37521,7 +37555,7 @@ var DndContext = /* @__PURE__ */ memo3(function DndContext2(_ref) {
|
|
|
37521
37555
|
setStatus(Status.Initialized);
|
|
37522
37556
|
}
|
|
37523
37557
|
}, [activeNodeRect, status]);
|
|
37524
|
-
|
|
37558
|
+
useEffect42(
|
|
37525
37559
|
() => {
|
|
37526
37560
|
const {
|
|
37527
37561
|
onDragMove
|
|
@@ -37556,7 +37590,7 @@ var DndContext = /* @__PURE__ */ memo3(function DndContext2(_ref) {
|
|
|
37556
37590
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37557
37591
|
[scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]
|
|
37558
37592
|
);
|
|
37559
|
-
|
|
37593
|
+
useEffect42(
|
|
37560
37594
|
() => {
|
|
37561
37595
|
const {
|
|
37562
37596
|
active: active2,
|
|
@@ -37629,7 +37663,7 @@ var DndContext = /* @__PURE__ */ memo3(function DndContext2(_ref) {
|
|
|
37629
37663
|
scrollableAncestors,
|
|
37630
37664
|
scrollableAncestorRects
|
|
37631
37665
|
});
|
|
37632
|
-
const publicContext =
|
|
37666
|
+
const publicContext = useMemo16(() => {
|
|
37633
37667
|
const context = {
|
|
37634
37668
|
active,
|
|
37635
37669
|
activeNode,
|
|
@@ -37651,7 +37685,7 @@ var DndContext = /* @__PURE__ */ memo3(function DndContext2(_ref) {
|
|
|
37651
37685
|
};
|
|
37652
37686
|
return context;
|
|
37653
37687
|
}, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect2]);
|
|
37654
|
-
const internalContext =
|
|
37688
|
+
const internalContext = useMemo16(() => {
|
|
37655
37689
|
const context = {
|
|
37656
37690
|
activatorEvent,
|
|
37657
37691
|
activators,
|
|
@@ -37746,7 +37780,7 @@ function useDraggable(_ref) {
|
|
|
37746
37780
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37747
37781
|
[draggableNodes, id2]
|
|
37748
37782
|
);
|
|
37749
|
-
const memoizedAttributes =
|
|
37783
|
+
const memoizedAttributes = useMemo16(() => ({
|
|
37750
37784
|
role,
|
|
37751
37785
|
tabIndex,
|
|
37752
37786
|
"aria-disabled": disabled,
|
|
@@ -37839,7 +37873,7 @@ function useDroppable(_ref) {
|
|
|
37839
37873
|
}, [resizeObserver]);
|
|
37840
37874
|
const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);
|
|
37841
37875
|
const dataRef = useLatestValue(data2);
|
|
37842
|
-
|
|
37876
|
+
useEffect42(() => {
|
|
37843
37877
|
if (!resizeObserver || !nodeRef.current) {
|
|
37844
37878
|
return;
|
|
37845
37879
|
}
|
|
@@ -37847,7 +37881,7 @@ function useDroppable(_ref) {
|
|
|
37847
37881
|
resizeObserverConnected.current = false;
|
|
37848
37882
|
resizeObserver.observe(nodeRef.current);
|
|
37849
37883
|
}, [nodeRef, resizeObserver]);
|
|
37850
|
-
|
|
37884
|
+
useEffect42(
|
|
37851
37885
|
() => {
|
|
37852
37886
|
dispatch({
|
|
37853
37887
|
type: Action.RegisterDroppable,
|
|
@@ -37869,7 +37903,7 @@ function useDroppable(_ref) {
|
|
|
37869
37903
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37870
37904
|
[id2]
|
|
37871
37905
|
);
|
|
37872
|
-
|
|
37906
|
+
useEffect42(() => {
|
|
37873
37907
|
if (disabled !== previous.current.disabled) {
|
|
37874
37908
|
dispatch({
|
|
37875
37909
|
type: Action.SetDroppableDisabled,
|
|
@@ -37891,7 +37925,7 @@ function useDroppable(_ref) {
|
|
|
37891
37925
|
}
|
|
37892
37926
|
|
|
37893
37927
|
// ../../node_modules/@dnd-kit/sortable/dist/sortable.esm.js
|
|
37894
|
-
import React19, { useMemo as
|
|
37928
|
+
import React19, { useMemo as useMemo17, useRef as useRef30, useEffect as useEffect43, useState as useState38, useContext as useContext6 } from "react";
|
|
37895
37929
|
function arrayMove(array, from, to) {
|
|
37896
37930
|
const newArray = array.slice();
|
|
37897
37931
|
newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]);
|
|
@@ -38045,7 +38079,7 @@ function SortableContext(_ref) {
|
|
|
38045
38079
|
} = useDndContext();
|
|
38046
38080
|
const containerId = useUniqueId(ID_PREFIX2, id2);
|
|
38047
38081
|
const useDragOverlay = Boolean(dragOverlay.rect !== null);
|
|
38048
|
-
const items =
|
|
38082
|
+
const items = useMemo17(() => userDefinedItems.map((item) => typeof item === "object" && "id" in item ? item.id : item), [userDefinedItems]);
|
|
38049
38083
|
const isDragging = active != null;
|
|
38050
38084
|
const activeIndex = active ? items.indexOf(active.id) : -1;
|
|
38051
38085
|
const overIndex = over ? items.indexOf(over.id) : -1;
|
|
@@ -38058,10 +38092,10 @@ function SortableContext(_ref) {
|
|
|
38058
38092
|
measureDroppableContainers(items);
|
|
38059
38093
|
}
|
|
38060
38094
|
}, [itemsHaveChanged, items, isDragging, measureDroppableContainers]);
|
|
38061
|
-
|
|
38095
|
+
useEffect43(() => {
|
|
38062
38096
|
previousItemsRef.current = items;
|
|
38063
38097
|
}, [items]);
|
|
38064
|
-
const contextValue =
|
|
38098
|
+
const contextValue = useMemo17(
|
|
38065
38099
|
() => ({
|
|
38066
38100
|
activeIndex,
|
|
38067
38101
|
containerId,
|
|
@@ -38132,7 +38166,7 @@ function useDerivedTransform(_ref) {
|
|
|
38132
38166
|
node,
|
|
38133
38167
|
rect
|
|
38134
38168
|
} = _ref;
|
|
38135
|
-
const [derivedTransform, setDerivedtransform] =
|
|
38169
|
+
const [derivedTransform, setDerivedtransform] = useState38(null);
|
|
38136
38170
|
const previousIndex = useRef30(index);
|
|
38137
38171
|
useIsomorphicLayoutEffect(() => {
|
|
38138
38172
|
if (!disabled && index !== previousIndex.current && node.current) {
|
|
@@ -38156,7 +38190,7 @@ function useDerivedTransform(_ref) {
|
|
|
38156
38190
|
previousIndex.current = index;
|
|
38157
38191
|
}
|
|
38158
38192
|
}, [disabled, index, node, rect]);
|
|
38159
|
-
|
|
38193
|
+
useEffect43(() => {
|
|
38160
38194
|
if (derivedTransform) {
|
|
38161
38195
|
setDerivedtransform(null);
|
|
38162
38196
|
}
|
|
@@ -38188,7 +38222,7 @@ function useSortable(_ref) {
|
|
|
38188
38222
|
} = useContext6(Context2);
|
|
38189
38223
|
const disabled = normalizeLocalDisabled(localDisabled, globalDisabled);
|
|
38190
38224
|
const index = items.indexOf(id2);
|
|
38191
|
-
const data2 =
|
|
38225
|
+
const data2 = useMemo17(() => ({
|
|
38192
38226
|
sortable: {
|
|
38193
38227
|
containerId,
|
|
38194
38228
|
index,
|
|
@@ -38196,7 +38230,7 @@ function useSortable(_ref) {
|
|
|
38196
38230
|
},
|
|
38197
38231
|
...customData
|
|
38198
38232
|
}), [containerId, customData, index, items]);
|
|
38199
|
-
const itemsAfterCurrentSortable =
|
|
38233
|
+
const itemsAfterCurrentSortable = useMemo17(() => items.slice(items.indexOf(id2)), [items, id2]);
|
|
38200
38234
|
const {
|
|
38201
38235
|
rect,
|
|
38202
38236
|
node,
|
|
@@ -38278,7 +38312,7 @@ function useSortable(_ref) {
|
|
|
38278
38312
|
node,
|
|
38279
38313
|
rect
|
|
38280
38314
|
});
|
|
38281
|
-
|
|
38315
|
+
useEffect43(() => {
|
|
38282
38316
|
if (isSorting && previous.current.newIndex !== newIndex) {
|
|
38283
38317
|
previous.current.newIndex = newIndex;
|
|
38284
38318
|
}
|
|
@@ -38289,7 +38323,7 @@ function useSortable(_ref) {
|
|
|
38289
38323
|
previous.current.items = items;
|
|
38290
38324
|
}
|
|
38291
38325
|
}, [isSorting, newIndex, containerId, items]);
|
|
38292
|
-
|
|
38326
|
+
useEffect43(() => {
|
|
38293
38327
|
if (activeId === previous.current.activeId) {
|
|
38294
38328
|
return;
|
|
38295
38329
|
}
|
|
@@ -38474,7 +38508,7 @@ function isAfter(a15, b8) {
|
|
|
38474
38508
|
}
|
|
38475
38509
|
|
|
38476
38510
|
// src/components/navigation/SortableResourceTab.tsx
|
|
38477
|
-
import { useCallback as useCallback30, useRef as useRef31, useEffect as
|
|
38511
|
+
import { useCallback as useCallback30, useRef as useRef31, useEffect as useEffect44 } from "react";
|
|
38478
38512
|
import { jsx as jsx49, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
38479
38513
|
function SortableResourceTab({
|
|
38480
38514
|
resource,
|
|
@@ -38498,7 +38532,7 @@ function SortableResourceTab({
|
|
|
38498
38532
|
isDragging: isSortableDragging
|
|
38499
38533
|
} = useSortable({ id: resource.id });
|
|
38500
38534
|
const onReorderRef = useRef31(onReorder);
|
|
38501
|
-
|
|
38535
|
+
useEffect44(() => {
|
|
38502
38536
|
onReorderRef.current = onReorder;
|
|
38503
38537
|
});
|
|
38504
38538
|
const style = {
|
|
@@ -38625,7 +38659,7 @@ function CollapsibleResourceNavigation({
|
|
|
38625
38659
|
}) {
|
|
38626
38660
|
const ChevronLeftIcon = icons.chevronLeft;
|
|
38627
38661
|
const BarsIcon = icons.bars;
|
|
38628
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
38662
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState39(false);
|
|
38629
38663
|
const dropdownRef = useRef32(null);
|
|
38630
38664
|
const { announcePickup, announceDrop, announceKeyboardReorder, announceCannotMove } = useDragAnnouncements();
|
|
38631
38665
|
const t12 = useTranslations("CollapsibleResourceNavigation");
|
|
@@ -38641,7 +38675,7 @@ function CollapsibleResourceNavigation({
|
|
|
38641
38675
|
};
|
|
38642
38676
|
const toggleDropdown = () => setIsDropdownOpen(!isDropdownOpen);
|
|
38643
38677
|
const closeDropdown = () => setIsDropdownOpen(false);
|
|
38644
|
-
|
|
38678
|
+
useEffect45(() => {
|
|
38645
38679
|
const handleClickOutside = (event) => {
|
|
38646
38680
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
38647
38681
|
closeDropdown();
|
|
@@ -38839,10 +38873,10 @@ function CollapsibleResourceNavigation({
|
|
|
38839
38873
|
}
|
|
38840
38874
|
|
|
38841
38875
|
// src/components/modals/ReferenceWizardModal.tsx
|
|
38842
|
-
import { useState as
|
|
38876
|
+
import { useState as useState43, useEffect as useEffect47, useCallback as useCallback33 } from "react";
|
|
38843
38877
|
|
|
38844
38878
|
// src/components/modals/GatherContextStep.tsx
|
|
38845
|
-
import { useState as
|
|
38879
|
+
import { useState as useState40, useEffect as useEffect46, useRef as useRef33 } from "react";
|
|
38846
38880
|
|
|
38847
38881
|
// src/components/modals/ContextSummary.tsx
|
|
38848
38882
|
import { deriveViews } from "@semiont/core";
|
|
@@ -38909,12 +38943,12 @@ function GatherContextStep({
|
|
|
38909
38943
|
onCompose,
|
|
38910
38944
|
translations: t12
|
|
38911
38945
|
}) {
|
|
38912
|
-
const [sourceExpanded, setSourceExpanded] =
|
|
38946
|
+
const [sourceExpanded, setSourceExpanded] = useState40(false);
|
|
38913
38947
|
const contextReady = !contextLoading && !contextError && !!context;
|
|
38914
38948
|
const focus = context?.focus.kind === "annotation" ? context.focus : null;
|
|
38915
38949
|
const resourceFocus = context?.focus.kind === "resource" ? context.focus : null;
|
|
38916
38950
|
const highlightRef = useRef33(null);
|
|
38917
|
-
|
|
38951
|
+
useEffect46(() => {
|
|
38918
38952
|
if (highlightRef.current) {
|
|
38919
38953
|
highlightRef.current.scrollIntoView({ block: "center", behavior: "instant" });
|
|
38920
38954
|
}
|
|
@@ -39055,7 +39089,7 @@ function GatherContextStep({
|
|
|
39055
39089
|
}
|
|
39056
39090
|
|
|
39057
39091
|
// src/components/modals/ConfigureGenerationStep.tsx
|
|
39058
|
-
import { useState as
|
|
39092
|
+
import { useState as useState41 } from "react";
|
|
39059
39093
|
import { LOCALES as LOCALES2 } from "@semiont/core";
|
|
39060
39094
|
import { jsx as jsx53, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
39061
39095
|
function ConfigureGenerationStep({
|
|
@@ -39067,12 +39101,12 @@ function ConfigureGenerationStep({
|
|
|
39067
39101
|
onGenerate,
|
|
39068
39102
|
translations: t12
|
|
39069
39103
|
}) {
|
|
39070
|
-
const [title, setTitle] =
|
|
39071
|
-
const [storagePath, setStoragePath] =
|
|
39072
|
-
const [prompt, setPrompt] =
|
|
39073
|
-
const [language2, setLanguage] =
|
|
39074
|
-
const [temperature, setTemperature] =
|
|
39075
|
-
const [maxTokens, setMaxTokens] =
|
|
39104
|
+
const [title, setTitle] = useState41(defaultTitle);
|
|
39105
|
+
const [storagePath, setStoragePath] = useState41("");
|
|
39106
|
+
const [prompt, setPrompt] = useState41("");
|
|
39107
|
+
const [language2, setLanguage] = useState41(locale);
|
|
39108
|
+
const [temperature, setTemperature] = useState41(0.7);
|
|
39109
|
+
const [maxTokens, setMaxTokens] = useState41(500);
|
|
39076
39110
|
const handleSubmit = (e6) => {
|
|
39077
39111
|
e6.preventDefault();
|
|
39078
39112
|
const trimmedPrompt = prompt.trim();
|
|
@@ -39231,7 +39265,7 @@ function ConfigureGenerationStep({
|
|
|
39231
39265
|
}
|
|
39232
39266
|
|
|
39233
39267
|
// src/components/modals/ConfigureSearchStep.tsx
|
|
39234
|
-
import { useState as
|
|
39268
|
+
import { useState as useState42 } from "react";
|
|
39235
39269
|
import { jsx as jsx54, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
39236
39270
|
function ConfigureSearchStep({
|
|
39237
39271
|
isSearching = false,
|
|
@@ -39240,8 +39274,8 @@ function ConfigureSearchStep({
|
|
|
39240
39274
|
onSearch,
|
|
39241
39275
|
translations: t12
|
|
39242
39276
|
}) {
|
|
39243
|
-
const [limit, setLimit] =
|
|
39244
|
-
const [useSemanticScoring, setUseSemanticScoring] =
|
|
39277
|
+
const [limit, setLimit] = useState42(10);
|
|
39278
|
+
const [useSemanticScoring, setUseSemanticScoring] = useState42(true);
|
|
39245
39279
|
const handleSubmit = (e6) => {
|
|
39246
39280
|
e6.preventDefault();
|
|
39247
39281
|
onSearch({ limit, useSemanticScoring });
|
|
@@ -39433,10 +39467,10 @@ function ReferenceWizardModal({
|
|
|
39433
39467
|
translations: t12
|
|
39434
39468
|
}) {
|
|
39435
39469
|
const session = useObservable(useSemiont().activeSession$);
|
|
39436
|
-
const [wizardStep, setWizardStep] =
|
|
39437
|
-
const [isSearching, setIsSearching] =
|
|
39438
|
-
const [userHint, setUserHint] =
|
|
39439
|
-
|
|
39470
|
+
const [wizardStep, setWizardStep] = useState43({ step: "gather" });
|
|
39471
|
+
const [isSearching, setIsSearching] = useState43(false);
|
|
39472
|
+
const [userHint, setUserHint] = useState43("");
|
|
39473
|
+
useEffect47(() => {
|
|
39440
39474
|
if (isOpen) {
|
|
39441
39475
|
setWizardStep({ step: "gather" });
|
|
39442
39476
|
setIsSearching(false);
|
|
@@ -39625,16 +39659,16 @@ function ReferenceWizardModal({
|
|
|
39625
39659
|
}
|
|
39626
39660
|
|
|
39627
39661
|
// src/components/modals/ResourceGenerateModal.tsx
|
|
39628
|
-
import { useState as
|
|
39662
|
+
import { useState as useState45, useEffect as useEffect48, useCallback as useCallback34 } from "react";
|
|
39629
39663
|
|
|
39630
39664
|
// src/components/modals/ConfigureGatherStep.tsx
|
|
39631
|
-
import { useState as
|
|
39665
|
+
import { useState as useState44 } from "react";
|
|
39632
39666
|
import { jsx as jsx57, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
39633
39667
|
function ConfigureGatherStep({ defaults, onGather, onCancel, translations: t12, children }) {
|
|
39634
|
-
const [includeContent, setIncludeContent] =
|
|
39635
|
-
const [includeSummary, setIncludeSummary] =
|
|
39636
|
-
const [depth, setDepth] =
|
|
39637
|
-
const [maxResources, setMaxResources] =
|
|
39668
|
+
const [includeContent, setIncludeContent] = useState44(defaults?.includeContent ?? true);
|
|
39669
|
+
const [includeSummary, setIncludeSummary] = useState44(defaults?.includeSummary ?? true);
|
|
39670
|
+
const [depth, setDepth] = useState44(defaults?.depth ?? 2);
|
|
39671
|
+
const [maxResources, setMaxResources] = useState44(defaults?.maxResources ?? 10);
|
|
39638
39672
|
const handleSubmit = (e6) => {
|
|
39639
39673
|
e6.preventDefault();
|
|
39640
39674
|
onGather({ includeContent, includeSummary, depth, maxResources });
|
|
@@ -39707,12 +39741,12 @@ function ResourceGenerateModal({
|
|
|
39707
39741
|
onGenerateSubmit,
|
|
39708
39742
|
translations: t12
|
|
39709
39743
|
}) {
|
|
39710
|
-
const [step, setStep] =
|
|
39744
|
+
const [step, setStep] = useState45("configure-gather");
|
|
39711
39745
|
const { context, loading, error, gather, reset } = useResourceGather();
|
|
39712
39746
|
const client = useObservable(useSemiont().activeSession$)?.client;
|
|
39713
39747
|
const entityTypeOptions = useObservable(client?.browse.entityTypes()) ?? [];
|
|
39714
|
-
const [excludeEntityTypes, setExcludeEntityTypes] =
|
|
39715
|
-
|
|
39748
|
+
const [excludeEntityTypes, setExcludeEntityTypes] = useState45([]);
|
|
39749
|
+
useEffect48(() => {
|
|
39716
39750
|
if (isOpen) {
|
|
39717
39751
|
setStep("configure-gather");
|
|
39718
39752
|
setExcludeEntityTypes([]);
|
|
@@ -39878,7 +39912,7 @@ function ResourceGenerateModal({
|
|
|
39878
39912
|
}
|
|
39879
39913
|
|
|
39880
39914
|
// src/components/modals/SearchModal.tsx
|
|
39881
|
-
import { useState as
|
|
39915
|
+
import { useState as useState46, useEffect as useEffect49, useRef as useRef34 } from "react";
|
|
39882
39916
|
var import_operators = __toESM(require_operators(), 1);
|
|
39883
39917
|
import { getResourceId } from "@semiont/core";
|
|
39884
39918
|
import { createSearchPipeline } from "@semiont/sdk";
|
|
@@ -39927,7 +39961,7 @@ function SearchModal({
|
|
|
39927
39961
|
const semiont = useObservable(useSemiont().activeSession$)?.client;
|
|
39928
39962
|
const semiontRef = useRef34(semiont);
|
|
39929
39963
|
semiontRef.current = semiont;
|
|
39930
|
-
const [selectedIndex, setSelectedIndex] =
|
|
39964
|
+
const [selectedIndex, setSelectedIndex] = useState46(0);
|
|
39931
39965
|
const t12 = {
|
|
39932
39966
|
placeholder: translations.placeholder || "Search resources, entities...",
|
|
39933
39967
|
searching: translations.searching || "Searching...",
|
|
@@ -39939,7 +39973,7 @@ function SearchModal({
|
|
|
39939
39973
|
enter: translations.enter || "Enter",
|
|
39940
39974
|
esc: translations.esc || "ESC"
|
|
39941
39975
|
};
|
|
39942
|
-
const [pipeline] =
|
|
39976
|
+
const [pipeline] = useState46(
|
|
39943
39977
|
() => createSearchPipeline(
|
|
39944
39978
|
(q2) => semiontRef.current.browse.resources({ search: q2, limit: SEARCH_LIMIT }).pipe(
|
|
39945
39979
|
(0, import_operators.map)((resources) => {
|
|
@@ -39959,21 +39993,21 @@ function SearchModal({
|
|
|
39959
39993
|
{ debounceMs: SEARCH_DEBOUNCE_MS }
|
|
39960
39994
|
)
|
|
39961
39995
|
);
|
|
39962
|
-
|
|
39996
|
+
useEffect49(() => () => pipeline.dispose(), [pipeline]);
|
|
39963
39997
|
const query = useObservable(pipeline.query$) ?? "";
|
|
39964
39998
|
const searchState = useObservable(pipeline.state$);
|
|
39965
39999
|
const results = searchState?.results ?? [];
|
|
39966
40000
|
const loading = searchState?.isSearching ?? false;
|
|
39967
|
-
|
|
40001
|
+
useEffect49(() => {
|
|
39968
40002
|
if (isOpen) {
|
|
39969
40003
|
pipeline.setQuery("");
|
|
39970
40004
|
setSelectedIndex(0);
|
|
39971
40005
|
}
|
|
39972
40006
|
}, [isOpen, pipeline]);
|
|
39973
|
-
|
|
40007
|
+
useEffect49(() => {
|
|
39974
40008
|
setSelectedIndex(0);
|
|
39975
40009
|
}, [results.length]);
|
|
39976
|
-
|
|
40010
|
+
useEffect49(() => {
|
|
39977
40011
|
if (!query.trim()) return;
|
|
39978
40012
|
if (loading) {
|
|
39979
40013
|
announceSearching();
|
|
@@ -40089,7 +40123,7 @@ function SearchModal({
|
|
|
40089
40123
|
}
|
|
40090
40124
|
|
|
40091
40125
|
// src/components/modals/ResourceSearchModal.tsx
|
|
40092
|
-
import { useState as
|
|
40126
|
+
import { useState as useState47, useEffect as useEffect50, useRef as useRef35 } from "react";
|
|
40093
40127
|
var import_operators2 = __toESM(require_operators(), 1);
|
|
40094
40128
|
import { getResourceId as getResourceId2, getPrimaryRepresentation } from "@semiont/core";
|
|
40095
40129
|
import { createSearchPipeline as createSearchPipeline2 } from "@semiont/sdk";
|
|
@@ -40125,7 +40159,7 @@ function ResourceSearchModal({
|
|
|
40125
40159
|
noResults: translations.noResults || "No documents found",
|
|
40126
40160
|
close: translations.close || "\u2715"
|
|
40127
40161
|
};
|
|
40128
|
-
const [pipeline] =
|
|
40162
|
+
const [pipeline] = useState47(
|
|
40129
40163
|
() => createSearchPipeline2(
|
|
40130
40164
|
(q2) => semiontRef.current.browse.resources({ search: q2, limit: SEARCH_LIMIT2 }).pipe(
|
|
40131
40165
|
(0, import_operators2.map)((resources) => {
|
|
@@ -40136,17 +40170,17 @@ function ResourceSearchModal({
|
|
|
40136
40170
|
{ debounceMs: SEARCH_DEBOUNCE_MS2, initialQuery: searchTerm }
|
|
40137
40171
|
)
|
|
40138
40172
|
);
|
|
40139
|
-
|
|
40173
|
+
useEffect50(() => () => pipeline.dispose(), [pipeline]);
|
|
40140
40174
|
const search = useObservable(pipeline.query$) ?? "";
|
|
40141
40175
|
const searchState = useObservable(pipeline.state$);
|
|
40142
40176
|
const results = searchState?.results ?? [];
|
|
40143
40177
|
const loading = searchState?.isSearching ?? false;
|
|
40144
|
-
|
|
40178
|
+
useEffect50(() => {
|
|
40145
40179
|
if (isOpen && searchTerm) {
|
|
40146
40180
|
pipeline.setQuery(searchTerm);
|
|
40147
40181
|
}
|
|
40148
40182
|
}, [isOpen, searchTerm, pipeline]);
|
|
40149
|
-
|
|
40183
|
+
useEffect50(() => {
|
|
40150
40184
|
if (!search.trim()) return;
|
|
40151
40185
|
if (loading) {
|
|
40152
40186
|
announceSearching();
|
|
@@ -40266,7 +40300,7 @@ function SkipLinks() {
|
|
|
40266
40300
|
}
|
|
40267
40301
|
|
|
40268
40302
|
// src/components/StatusDisplay.tsx
|
|
40269
|
-
import { useEffect as
|
|
40303
|
+
import { useEffect as useEffect51, useState as useState48 } from "react";
|
|
40270
40304
|
import { jsx as jsx62, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
40271
40305
|
function StatusDisplay({
|
|
40272
40306
|
isFullyAuthenticated = false,
|
|
@@ -40274,10 +40308,10 @@ function StatusDisplay({
|
|
|
40274
40308
|
hasValidBackendToken = false
|
|
40275
40309
|
}) {
|
|
40276
40310
|
const semiont = useObservable(useSemiont().activeSession$)?.client;
|
|
40277
|
-
const [data2, setData] =
|
|
40278
|
-
const [loading, setLoading] =
|
|
40279
|
-
const [error, setError] =
|
|
40280
|
-
|
|
40311
|
+
const [data2, setData] = useState48(null);
|
|
40312
|
+
const [loading, setLoading] = useState48(true);
|
|
40313
|
+
const [error, setError] = useState48(null);
|
|
40314
|
+
useEffect51(() => {
|
|
40281
40315
|
if (!semiont) {
|
|
40282
40316
|
setLoading(false);
|
|
40283
40317
|
return;
|
|
@@ -40369,11 +40403,11 @@ function SessionTimer() {
|
|
|
40369
40403
|
}
|
|
40370
40404
|
|
|
40371
40405
|
// src/components/SessionExpiryBanner.tsx
|
|
40372
|
-
import { useState as
|
|
40406
|
+
import { useState as useState49 } from "react";
|
|
40373
40407
|
import { jsx as jsx63, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
40374
40408
|
function SessionExpiryBanner() {
|
|
40375
40409
|
const { timeRemaining, isExpiringSoon } = useSessionExpiry();
|
|
40376
|
-
const [dismissed, setDismissed] =
|
|
40410
|
+
const [dismissed, setDismissed] = useState49(false);
|
|
40377
40411
|
const formattedTime = formatTime(timeRemaining);
|
|
40378
40412
|
if (!isExpiringSoon || dismissed || !formattedTime) {
|
|
40379
40413
|
return null;
|
|
@@ -40594,7 +40628,7 @@ function UnifiedHeader({
|
|
|
40594
40628
|
}
|
|
40595
40629
|
|
|
40596
40630
|
// src/components/layout/LeftSidebar.tsx
|
|
40597
|
-
import { useState as
|
|
40631
|
+
import { useState as useState50, useEffect as useEffect52 } from "react";
|
|
40598
40632
|
import { jsx as jsx67, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
40599
40633
|
function LeftSidebar({
|
|
40600
40634
|
Link,
|
|
@@ -40609,7 +40643,7 @@ function LeftSidebar({
|
|
|
40609
40643
|
isModerator = false,
|
|
40610
40644
|
currentPath
|
|
40611
40645
|
}) {
|
|
40612
|
-
const [isCollapsed, setIsCollapsed] =
|
|
40646
|
+
const [isCollapsed, setIsCollapsed] = useState50(false);
|
|
40613
40647
|
const { width, setWidth, minWidth, maxWidth } = usePanelWidth({
|
|
40614
40648
|
defaultWidth: 256,
|
|
40615
40649
|
// 16rem
|
|
@@ -40619,7 +40653,7 @@ function LeftSidebar({
|
|
|
40619
40653
|
// 25rem
|
|
40620
40654
|
storageKey: "semiont-left-sidebar-width"
|
|
40621
40655
|
});
|
|
40622
|
-
|
|
40656
|
+
useEffect52(() => {
|
|
40623
40657
|
if (collapsible) {
|
|
40624
40658
|
const saved = localStorage.getItem(storageKey);
|
|
40625
40659
|
if (saved === "true") {
|
|
@@ -41582,7 +41616,7 @@ function ExportCard({ onExport, isExporting, translations: t12 }) {
|
|
|
41582
41616
|
}
|
|
41583
41617
|
|
|
41584
41618
|
// src/features/admin-exchange/components/ImportCard.tsx
|
|
41585
|
-
import { useRef as useRef36, useState as
|
|
41619
|
+
import { useRef as useRef36, useState as useState51, useCallback as useCallback36 } from "react";
|
|
41586
41620
|
import { jsx as jsx76, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
41587
41621
|
function ImportCard({
|
|
41588
41622
|
onFileSelected,
|
|
@@ -41594,8 +41628,8 @@ function ImportCard({
|
|
|
41594
41628
|
translations: t12
|
|
41595
41629
|
}) {
|
|
41596
41630
|
const fileInputRef = useRef36(null);
|
|
41597
|
-
const [isDragActive, setIsDragActive] =
|
|
41598
|
-
const [showConfirm, setShowConfirm] =
|
|
41631
|
+
const [isDragActive, setIsDragActive] = useState51(false);
|
|
41632
|
+
const [showConfirm, setShowConfirm] = useState51(false);
|
|
41599
41633
|
const handleDragOver = useCallback36((e6) => {
|
|
41600
41634
|
e6.preventDefault();
|
|
41601
41635
|
setIsDragActive(true);
|
|
@@ -42008,7 +42042,7 @@ function LinkedDataPage({
|
|
|
42008
42042
|
}
|
|
42009
42043
|
|
|
42010
42044
|
// src/features/admin-users/components/AdminUsersPage.tsx
|
|
42011
|
-
import { useState as
|
|
42045
|
+
import { useState as useState52 } from "react";
|
|
42012
42046
|
import { Fragment as Fragment14, jsx as jsx81, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
42013
42047
|
function UserTableRow({
|
|
42014
42048
|
user,
|
|
@@ -42090,9 +42124,9 @@ function AdminUsersPage({
|
|
|
42090
42124
|
Toolbar: Toolbar2,
|
|
42091
42125
|
buttonStyles: buttonStyles2
|
|
42092
42126
|
}) {
|
|
42093
|
-
const [searchTerm, setSearchTerm] =
|
|
42094
|
-
const [selectedRole, setSelectedRole] =
|
|
42095
|
-
const [selectedStatus, setSelectedStatus] =
|
|
42127
|
+
const [searchTerm, setSearchTerm] = useState52("");
|
|
42128
|
+
const [selectedRole, setSelectedRole] = useState52("all");
|
|
42129
|
+
const [selectedStatus, setSelectedStatus] = useState52("all");
|
|
42096
42130
|
const filteredUsers = users.filter((user) => {
|
|
42097
42131
|
const matchesSearch = (user.name || "").toLowerCase().includes(searchTerm.toLowerCase()) || user.email.toLowerCase().includes(searchTerm.toLowerCase());
|
|
42098
42132
|
const userRole = user.isAdmin ? "admin" : "user";
|
|
@@ -42480,7 +42514,7 @@ function SignInForm({
|
|
|
42480
42514
|
}
|
|
42481
42515
|
|
|
42482
42516
|
// src/features/auth/components/SignUpForm.tsx
|
|
42483
|
-
import { useState as
|
|
42517
|
+
import { useState as useState53 } from "react";
|
|
42484
42518
|
import { jsx as jsx83, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
42485
42519
|
function GoogleIcon2() {
|
|
42486
42520
|
return /* @__PURE__ */ jsxs73("svg", { className: "semiont-icon semiont-icon--small semiont-icon--inline", viewBox: "0 0 24 24", children: [
|
|
@@ -42515,7 +42549,7 @@ function GoogleIcon2() {
|
|
|
42515
42549
|
] });
|
|
42516
42550
|
}
|
|
42517
42551
|
function SignUpForm({ onSignUp, Link, translations: t12 }) {
|
|
42518
|
-
const [isLoading, setIsLoading] =
|
|
42552
|
+
const [isLoading, setIsLoading] = useState53(false);
|
|
42519
42553
|
const handleSignUp = async () => {
|
|
42520
42554
|
setIsLoading(true);
|
|
42521
42555
|
try {
|
|
@@ -42972,7 +43006,7 @@ function TagSchemasPage({
|
|
|
42972
43006
|
}
|
|
42973
43007
|
|
|
42974
43008
|
// src/features/resource-compose/components/ResourceComposePage.tsx
|
|
42975
|
-
import { useState as
|
|
43009
|
+
import { useState as useState54, useEffect as useEffect53 } from "react";
|
|
42976
43010
|
import { deriveViews as deriveViews2 } from "@semiont/core";
|
|
42977
43011
|
import { capabilitiesOf as capabilitiesOf5, AUTHORABLE_MEDIA_TYPES, MEDIA_TYPES, mediaTypeForExtension, isSupportedMediaType, LOCALES as LOCALES3 } from "@semiont/core";
|
|
42978
43012
|
|
|
@@ -43075,20 +43109,20 @@ function ResourceComposePage({
|
|
|
43075
43109
|
Toolbar: Toolbar2
|
|
43076
43110
|
}) {
|
|
43077
43111
|
const { announceFormSubmitting, announceFormSuccess, announceFormError } = useFormAnnouncements();
|
|
43078
|
-
const [newResourceName, setNewResourceName] =
|
|
43079
|
-
const [newResourceContent, setNewResourceContent] =
|
|
43080
|
-
const [selectedEntityTypes, setSelectedEntityTypes] =
|
|
43081
|
-
const [isCreating, setIsCreating] =
|
|
43082
|
-
const [inputMethod, setInputMethod] =
|
|
43083
|
-
const [uploadedFile, setUploadedFile] =
|
|
43084
|
-
const [fileMimeType, setFileMimeType] =
|
|
43085
|
-
const [filePreviewUrl, setFilePreviewUrl] =
|
|
43086
|
-
const [selectedFormat, setSelectedFormat] =
|
|
43087
|
-
const [selectedLanguage, setSelectedLanguage] =
|
|
43088
|
-
const [selectedCharset, setSelectedCharset] =
|
|
43089
|
-
const [storagePath, setStoragePath] =
|
|
43090
|
-
const [archiveOriginal, setArchiveOriginal] =
|
|
43091
|
-
|
|
43112
|
+
const [newResourceName, setNewResourceName] = useState54("");
|
|
43113
|
+
const [newResourceContent, setNewResourceContent] = useState54("");
|
|
43114
|
+
const [selectedEntityTypes, setSelectedEntityTypes] = useState54([]);
|
|
43115
|
+
const [isCreating, setIsCreating] = useState54(false);
|
|
43116
|
+
const [inputMethod, setInputMethod] = useState54("write");
|
|
43117
|
+
const [uploadedFile, setUploadedFile] = useState54(null);
|
|
43118
|
+
const [fileMimeType, setFileMimeType] = useState54("text/markdown");
|
|
43119
|
+
const [filePreviewUrl, setFilePreviewUrl] = useState54(null);
|
|
43120
|
+
const [selectedFormat, setSelectedFormat] = useState54("text/markdown");
|
|
43121
|
+
const [selectedLanguage, setSelectedLanguage] = useState54(initialLocale);
|
|
43122
|
+
const [selectedCharset, setSelectedCharset] = useState54("");
|
|
43123
|
+
const [storagePath, setStoragePath] = useState54("");
|
|
43124
|
+
const [archiveOriginal, setArchiveOriginal] = useState54(true);
|
|
43125
|
+
useEffect53(() => {
|
|
43092
43126
|
if (mode === "clone" && cloneData) {
|
|
43093
43127
|
setNewResourceName(cloneData.sourceResource.name);
|
|
43094
43128
|
setNewResourceContent(cloneData.sourceContent);
|
|
@@ -43123,7 +43157,7 @@ function ResourceComposePage({
|
|
|
43123
43157
|
reader.readAsText(file);
|
|
43124
43158
|
}
|
|
43125
43159
|
};
|
|
43126
|
-
|
|
43160
|
+
useEffect53(() => {
|
|
43127
43161
|
return () => {
|
|
43128
43162
|
if (filePreviewUrl) {
|
|
43129
43163
|
URL.revokeObjectURL(filePreviewUrl);
|
|
@@ -43756,7 +43790,7 @@ function ResourceDiscoveryPage({
|
|
|
43756
43790
|
}
|
|
43757
43791
|
|
|
43758
43792
|
// src/features/resource-viewer/components/ResourceViewerPage.tsx
|
|
43759
|
-
import { useState as
|
|
43793
|
+
import { useState as useState55, useEffect as useEffect54, useCallback as useCallback38 } from "react";
|
|
43760
43794
|
import { annotationId } from "@semiont/core";
|
|
43761
43795
|
import { getLanguage, getPrimaryRepresentation as getPrimaryRepresentation2, getPrimaryMediaType as getPrimaryMediaType2, capabilitiesOf as capabilitiesOf6 } from "@semiont/core";
|
|
43762
43796
|
|
|
@@ -43917,7 +43951,7 @@ function ResourceViewerPage({
|
|
|
43917
43951
|
const renderMode = capabilitiesOf6(resourceMediaType)?.render;
|
|
43918
43952
|
const isBinary = renderMode === "image" || renderMode === "pdf";
|
|
43919
43953
|
const { content: textContent, loading: textLoading, error: contentError } = useResourceContent(semiont ?? null, rUri, resource, !isBinary);
|
|
43920
|
-
|
|
43954
|
+
useEffect54(() => {
|
|
43921
43955
|
if (contentError) showError("Failed to load resource representation");
|
|
43922
43956
|
}, [contentError, showError]);
|
|
43923
43957
|
const { token: mediaToken, loading: mediaTokenLoading } = useMediaToken(semiont ?? null, rUri);
|
|
@@ -43950,7 +43984,7 @@ function ResourceViewerPage({
|
|
|
43950
43984
|
const wizardResourceId = wizardState?.resourceId ?? null;
|
|
43951
43985
|
const wizardDefaultTitle = wizardState?.defaultTitle ?? "";
|
|
43952
43986
|
const wizardEntityTypes = wizardState?.entityTypes ?? [];
|
|
43953
|
-
const [generateOpen, setGenerateOpen] =
|
|
43987
|
+
const [generateOpen, setGenerateOpen] = useState55(false);
|
|
43954
43988
|
const handleWizardClose = useCallback38(() => {
|
|
43955
43989
|
stateUnit.closeWizard();
|
|
43956
43990
|
}, [stateUnit]);
|
|
@@ -44008,7 +44042,7 @@ function ResourceViewerPage({
|
|
|
44008
44042
|
reason: "compose-from-wizard"
|
|
44009
44043
|
});
|
|
44010
44044
|
}, [session]);
|
|
44011
|
-
|
|
44045
|
+
useEffect54(() => {
|
|
44012
44046
|
if (resource && rUri) {
|
|
44013
44047
|
const mediaType = getPrimaryMediaType2(resource);
|
|
44014
44048
|
browser2.addOpenResource(rUri, resource.name, mediaType || void 0, resource.storageUri);
|
|
@@ -44017,7 +44051,7 @@ function ResourceViewerPage({
|
|
|
44017
44051
|
}
|
|
44018
44052
|
}
|
|
44019
44053
|
}, [resource, rUri, browser2]);
|
|
44020
|
-
|
|
44054
|
+
useEffect54(() => {
|
|
44021
44055
|
if (pendingAnnotation) {
|
|
44022
44056
|
browser2.emit("panel:open", { panel: "annotations" });
|
|
44023
44057
|
}
|
|
@@ -44117,7 +44151,7 @@ function ResourceViewerPage({
|
|
|
44117
44151
|
announceResourceLoading,
|
|
44118
44152
|
announceResourceLoaded
|
|
44119
44153
|
} = useResourceLoadingAnnouncements();
|
|
44120
|
-
|
|
44154
|
+
useEffect54(() => {
|
|
44121
44155
|
if (contentLoading) {
|
|
44122
44156
|
announceResourceLoading(resource.name);
|
|
44123
44157
|
} else if (content2) {
|
|
@@ -45032,6 +45066,7 @@ export {
|
|
|
45032
45066
|
useHoverDelay,
|
|
45033
45067
|
useHoverEmitter,
|
|
45034
45068
|
useIsTyping,
|
|
45069
|
+
useKBDiscovery,
|
|
45035
45070
|
useKeyboardShortcuts,
|
|
45036
45071
|
useLanguageChangeAnnouncements,
|
|
45037
45072
|
useLineNumbers,
|