@semiont/react-ui 0.2.43 → 0.2.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +50 -42
- package/dist/index.mjs +710 -663
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/resource/ResourceViewer.tsx +2 -2
- package/src/components/resource/panels/AssessmentPanel.tsx +1 -1
- package/src/components/resource/panels/CommentsPanel.tsx +1 -1
- package/src/components/resource/panels/HighlightPanel.tsx +2 -2
- package/src/components/resource/panels/ReferencesPanel.tsx +1 -1
- package/src/components/resource/panels/TaggingPanel.tsx +1 -1
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +4 -4
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +3 -3
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +4 -4
- package/src/features/resource-viewer/__tests__/AnnotationCreationPending.test.tsx +11 -11
- package/src/features/resource-viewer/__tests__/AnnotationDeletionIntegration.test.tsx +2 -2
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +40 -1
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +7 -2
package/dist/index.d.mts
CHANGED
|
@@ -14,17 +14,17 @@ import { WidgetType } from '@codemirror/view';
|
|
|
14
14
|
import { TagSchema } from '@semiont/ontology';
|
|
15
15
|
export { TAG_SCHEMAS, TagCategory, TagSchema, getAllTagSchemas, getSchemaCategory as getTagCategory, getTagSchema, getTagSchemasByDomain, isValidCategory } from '@semiont/ontology';
|
|
16
16
|
|
|
17
|
-
type Annotation$
|
|
17
|
+
type Annotation$m = components['schemas']['Annotation'];
|
|
18
18
|
/**
|
|
19
19
|
* Collection of all annotation types for a resource.
|
|
20
20
|
* Replaces separate highlights, references, assessments, comments, tags props.
|
|
21
21
|
*/
|
|
22
22
|
interface AnnotationsCollection {
|
|
23
|
-
highlights: Annotation$
|
|
24
|
-
references: Annotation$
|
|
25
|
-
assessments: Annotation$
|
|
26
|
-
comments: Annotation$
|
|
27
|
-
tags: Annotation$
|
|
23
|
+
highlights: Annotation$m[];
|
|
24
|
+
references: Annotation$m[];
|
|
25
|
+
assessments: Annotation$m[];
|
|
26
|
+
comments: Annotation$m[];
|
|
27
|
+
tags: Annotation$m[];
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Event handlers for annotation interactions.
|
|
@@ -32,7 +32,7 @@ interface AnnotationsCollection {
|
|
|
32
32
|
*/
|
|
33
33
|
interface AnnotationHandlers {
|
|
34
34
|
/** Unified click handler - routes based on annotation type and current mode */
|
|
35
|
-
onClick?: (annotation: Annotation$
|
|
35
|
+
onClick?: (annotation: Annotation$m, event?: React.MouseEvent) => void;
|
|
36
36
|
/** Unified hover handler for all annotation types */
|
|
37
37
|
onHover?: (annotationId: string | null) => void;
|
|
38
38
|
/** Hover handler specifically for comment panel highlighting */
|
|
@@ -81,7 +81,7 @@ interface UICreateAnnotationParams {
|
|
|
81
81
|
* - linking: Shows Quick Reference popup FIRST, creates when user confirms
|
|
82
82
|
*/
|
|
83
83
|
interface AnnotationCreationHandler {
|
|
84
|
-
onCreate?: (params: UICreateAnnotationParams) => void | Promise<void> | Promise<Annotation$
|
|
84
|
+
onCreate?: (params: UICreateAnnotationParams) => void | Promise<void> | Promise<Annotation$m | undefined>;
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* UI state for annotation toolbar and interactions.
|
|
@@ -114,7 +114,7 @@ interface AnnotationConfig {
|
|
|
114
114
|
annotateMode?: boolean;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
type Annotation$
|
|
117
|
+
type Annotation$l = components['schemas']['Annotation'];
|
|
118
118
|
/**
|
|
119
119
|
* Parameters for creating an annotation
|
|
120
120
|
*/
|
|
@@ -161,7 +161,7 @@ interface AnnotationManager {
|
|
|
161
161
|
* @param params - Creation parameters (rUri, motivation, selector, body)
|
|
162
162
|
* @returns Promise resolving to the created annotation, or undefined if creation fails
|
|
163
163
|
*/
|
|
164
|
-
createAnnotation: (params: CreateAnnotationParams) => Promise<Annotation$
|
|
164
|
+
createAnnotation: (params: CreateAnnotationParams) => Promise<Annotation$l | undefined>;
|
|
165
165
|
/**
|
|
166
166
|
* Delete an annotation
|
|
167
167
|
* @param params - Deletion parameters (annotationId, rUri)
|
|
@@ -265,7 +265,7 @@ interface NavigationProps {
|
|
|
265
265
|
*/
|
|
266
266
|
|
|
267
267
|
type SemiontResource$4 = components['schemas']['ResourceDescriptor'];
|
|
268
|
-
type Annotation$
|
|
268
|
+
type Annotation$k = components['schemas']['Annotation'];
|
|
269
269
|
type Motivation$8 = components['schemas']['Motivation'];
|
|
270
270
|
/**
|
|
271
271
|
* Selection for creating annotations
|
|
@@ -293,7 +293,7 @@ interface TextSelection {
|
|
|
293
293
|
* No aliasing, wrappers, or compatibility layers elsewhere.
|
|
294
294
|
*/
|
|
295
295
|
|
|
296
|
-
type Annotation$
|
|
296
|
+
type Annotation$j = components['schemas']['Annotation'];
|
|
297
297
|
type Motivation$7 = components['schemas']['Motivation'];
|
|
298
298
|
/**
|
|
299
299
|
* Detection configuration for SSE-based annotation detection
|
|
@@ -330,7 +330,7 @@ interface Annotator {
|
|
|
330
330
|
isClickable: boolean;
|
|
331
331
|
hasHoverInteraction: boolean;
|
|
332
332
|
hasSidePanel: boolean;
|
|
333
|
-
matchesAnnotation: (annotation: Annotation$
|
|
333
|
+
matchesAnnotation: (annotation: Annotation$j) => boolean;
|
|
334
334
|
announceOnCreate: string;
|
|
335
335
|
detection?: DetectionConfig;
|
|
336
336
|
create: CreateConfig;
|
|
@@ -388,8 +388,7 @@ declare function useResources(): {
|
|
|
388
388
|
};
|
|
389
389
|
create: {
|
|
390
390
|
useMutation: () => _tanstack_react_query.UseMutationResult<{
|
|
391
|
-
|
|
392
|
-
annotations: _semiont_core.components["schemas"]["Annotation"][];
|
|
391
|
+
resourceId: string;
|
|
393
392
|
}, Error, {
|
|
394
393
|
name: string;
|
|
395
394
|
file: File | Buffer;
|
|
@@ -402,11 +401,7 @@ declare function useResources(): {
|
|
|
402
401
|
}, unknown>;
|
|
403
402
|
};
|
|
404
403
|
update: {
|
|
405
|
-
useMutation: () => _tanstack_react_query.UseMutationResult<{
|
|
406
|
-
resource: _semiont_core.components["schemas"]["ResourceDescriptor"];
|
|
407
|
-
annotations: _semiont_core.components["schemas"]["Annotation"][];
|
|
408
|
-
entityReferences: _semiont_core.components["schemas"]["Annotation"][];
|
|
409
|
-
}, Error, {
|
|
404
|
+
useMutation: () => _tanstack_react_query.UseMutationResult<void, Error, {
|
|
410
405
|
rUri: ResourceUri;
|
|
411
406
|
data: Parameters<SemiontApiClient["updateResource"]>[1];
|
|
412
407
|
}, unknown>;
|
|
@@ -426,8 +421,7 @@ declare function useResources(): {
|
|
|
426
421
|
};
|
|
427
422
|
createFromToken: {
|
|
428
423
|
useMutation: () => _tanstack_react_query.UseMutationResult<{
|
|
429
|
-
|
|
430
|
-
annotations: _semiont_core.components["schemas"]["Annotation"][];
|
|
424
|
+
resourceId: string;
|
|
431
425
|
}, Error, {
|
|
432
426
|
token: string;
|
|
433
427
|
name: string;
|
|
@@ -504,7 +498,7 @@ declare function useAnnotations(): {
|
|
|
504
498
|
};
|
|
505
499
|
create: {
|
|
506
500
|
useMutation: () => _tanstack_react_query.UseMutationResult<{
|
|
507
|
-
|
|
501
|
+
annotationId: string;
|
|
508
502
|
}, Error, {
|
|
509
503
|
rUri: ResourceUri;
|
|
510
504
|
data: Parameters<SemiontApiClient["createAnnotation"]>[1];
|
|
@@ -517,9 +511,7 @@ declare function useAnnotations(): {
|
|
|
517
511
|
}, unknown>;
|
|
518
512
|
};
|
|
519
513
|
updateBody: {
|
|
520
|
-
useMutation: () => _tanstack_react_query.UseMutationResult<{
|
|
521
|
-
annotation: _semiont_core.components["schemas"]["Annotation"];
|
|
522
|
-
}, Error, {
|
|
514
|
+
useMutation: () => _tanstack_react_query.UseMutationResult<void, Error, {
|
|
523
515
|
annotationUri: ResourceAnnotationUri;
|
|
524
516
|
data: Parameters<SemiontApiClient["updateAnnotationBody"]>[1];
|
|
525
517
|
}, unknown>;
|
|
@@ -562,16 +554,10 @@ declare function useEntityTypes(): {
|
|
|
562
554
|
}, Error>;
|
|
563
555
|
};
|
|
564
556
|
add: {
|
|
565
|
-
useMutation: () => _tanstack_react_query.UseMutationResult<
|
|
566
|
-
success: boolean;
|
|
567
|
-
entityTypes: string[];
|
|
568
|
-
}, Error, string, unknown>;
|
|
557
|
+
useMutation: () => _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
569
558
|
};
|
|
570
559
|
addBulk: {
|
|
571
|
-
useMutation: () => _tanstack_react_query.UseMutationResult<
|
|
572
|
-
success: boolean;
|
|
573
|
-
entityTypes: string[];
|
|
574
|
-
}, Error, string[], unknown>;
|
|
560
|
+
useMutation: () => _tanstack_react_query.UseMutationResult<void, Error, string[], unknown>;
|
|
575
561
|
};
|
|
576
562
|
};
|
|
577
563
|
/**
|
|
@@ -791,7 +777,7 @@ declare const jsonLightHighlightStyle: HighlightStyle;
|
|
|
791
777
|
* clicks and hovers via a single set of delegated handlers.
|
|
792
778
|
*/
|
|
793
779
|
|
|
794
|
-
type Annotation$
|
|
780
|
+
type Annotation$i = components['schemas']['Annotation'];
|
|
795
781
|
/**
|
|
796
782
|
* Reference Resolution Widget
|
|
797
783
|
* Shows a small indicator next to references with hover preview.
|
|
@@ -800,10 +786,10 @@ type Annotation$j = components['schemas']['Annotation'];
|
|
|
800
786
|
* and CodeMirrorRenderer handles events via container-level listeners.
|
|
801
787
|
*/
|
|
802
788
|
declare class ReferenceResolutionWidget extends WidgetType {
|
|
803
|
-
readonly annotation: Annotation$
|
|
789
|
+
readonly annotation: Annotation$i;
|
|
804
790
|
readonly targetDocumentName?: string | undefined;
|
|
805
791
|
readonly isGenerating?: boolean | undefined;
|
|
806
|
-
constructor(annotation: Annotation$
|
|
792
|
+
constructor(annotation: Annotation$i, targetDocumentName?: string | undefined, isGenerating?: boolean | undefined);
|
|
807
793
|
eq(other: ReferenceResolutionWidget): boolean;
|
|
808
794
|
toDOM(): HTMLSpanElement;
|
|
809
795
|
ignoreEvent(event: Event): boolean;
|
|
@@ -957,7 +943,7 @@ declare const QUERY_KEYS: {
|
|
|
957
943
|
* the overlay spans — no markdown re-parse, no AST walk.
|
|
958
944
|
*/
|
|
959
945
|
|
|
960
|
-
type Annotation$
|
|
946
|
+
type Annotation$h = components['schemas']['Annotation'];
|
|
961
947
|
interface OverlayAnnotation {
|
|
962
948
|
id: string;
|
|
963
949
|
exact: string;
|
|
@@ -1012,7 +998,7 @@ declare function clearHighlights(container: HTMLElement): void;
|
|
|
1012
998
|
* Convert W3C Annotations to the simplified overlay format.
|
|
1013
999
|
* Extracts TextPositionSelector offsets and annotation type.
|
|
1014
1000
|
*/
|
|
1015
|
-
declare function toOverlayAnnotations(annotations: Annotation$
|
|
1001
|
+
declare function toOverlayAnnotations(annotations: Annotation$h[]): OverlayAnnotation[];
|
|
1016
1002
|
|
|
1017
1003
|
/**
|
|
1018
1004
|
* Resource utilities
|
|
@@ -1325,6 +1311,29 @@ declare function useResourceEvents({ rUri, onEvent, onAnnotationAdded, onAnnotat
|
|
|
1325
1311
|
isConnected: boolean;
|
|
1326
1312
|
};
|
|
1327
1313
|
|
|
1314
|
+
/**
|
|
1315
|
+
* React hook for subscribing to global system-level events via SSE
|
|
1316
|
+
*
|
|
1317
|
+
* Opens a long-lived SSE connection to GET /api/events/stream to receive
|
|
1318
|
+
* domain events that are not scoped to a specific resource (e.g., entity type changes).
|
|
1319
|
+
*
|
|
1320
|
+
* Automatically invalidates relevant React Query caches when system events arrive.
|
|
1321
|
+
*
|
|
1322
|
+
* @example
|
|
1323
|
+
* ```tsx
|
|
1324
|
+
* // In your app layout:
|
|
1325
|
+
* useGlobalEvents(); // That's it — auto-connects and invalidates queries
|
|
1326
|
+
* ```
|
|
1327
|
+
*/
|
|
1328
|
+
declare function useGlobalEvents({ autoConnect }?: {
|
|
1329
|
+
autoConnect?: boolean;
|
|
1330
|
+
}): {
|
|
1331
|
+
status: StreamStatus;
|
|
1332
|
+
connect: () => Promise<void>;
|
|
1333
|
+
disconnect: () => void;
|
|
1334
|
+
isConnected: boolean;
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1328
1337
|
interface UseRovingTabIndexOptions {
|
|
1329
1338
|
orientation?: 'horizontal' | 'vertical' | 'grid';
|
|
1330
1339
|
loop?: boolean;
|
|
@@ -1578,10 +1587,9 @@ declare function OpenResourcesProvider({ openResourcesManager, children }: {
|
|
|
1578
1587
|
*/
|
|
1579
1588
|
declare function useOpenResources(): OpenResourcesManager;
|
|
1580
1589
|
|
|
1581
|
-
type Annotation$h = components['schemas']['Annotation'];
|
|
1582
1590
|
interface ResourceAnnotationsContextType {
|
|
1583
1591
|
newAnnotationIds: Set<string>;
|
|
1584
|
-
createAnnotation: (rUri: ResourceUri, motivation: 'highlighting' | 'linking' | 'assessing' | 'commenting' | 'tagging', selector: Selector | Selector[], body?: any[]) => Promise<
|
|
1592
|
+
createAnnotation: (rUri: ResourceUri, motivation: 'highlighting' | 'linking' | 'assessing' | 'commenting' | 'tagging', selector: Selector | Selector[], body?: any[]) => Promise<string | undefined>;
|
|
1585
1593
|
clearNewAnnotationId: (id: AnnotationUri) => void;
|
|
1586
1594
|
triggerSparkleAnimation: (annotationId: string) => void;
|
|
1587
1595
|
}
|
|
@@ -3965,4 +3973,4 @@ interface BindFlowState {
|
|
|
3965
3973
|
*/
|
|
3966
3974
|
declare function useBindFlow(rUri: ResourceUri): BindFlowState;
|
|
3967
3975
|
|
|
3968
|
-
export { ANNOTATORS, AUTH_EVENTS, AVAILABLE_LOCALES, AdminDevOpsPage, type AdminDevOpsPageProps, AdminSecurityPage, type AdminSecurityPageProps, type AdminUser, type AdminUserStats, AdminUsersPage, type AdminUsersPageProps, AnnotateReferencesProgressWidget, AnnotateToolbar, AnnotateView, type Annotation$
|
|
3976
|
+
export { ANNOTATORS, AUTH_EVENTS, AVAILABLE_LOCALES, AdminDevOpsPage, type AdminDevOpsPageProps, AdminSecurityPage, type AdminSecurityPageProps, type AdminUser, type AdminUserStats, AdminUsersPage, type AdminUsersPageProps, AnnotateReferencesProgressWidget, AnnotateToolbar, AnnotateView, type Annotation$k as Annotation, type AnnotationConfig, type AnnotationCreationHandler, type AnnotationHandlers, AnnotationHistory, type AnnotationManager, AnnotationOverlay, AnnotationProvider, type AnnotationProviderProps, type AnnotationUIState, type AnnotationsCollection, type Annotator, ApiClientProvider, type ApiClientProviderProps, AssessmentEntry, AssessmentPanel, AssistSection, AsyncErrorBoundary, AuthErrorDisplay, type AuthErrorDisplayProps, type AuthEventDetail, type AuthEventType, AuthTokenProvider, type AuthTokenProviderProps, type AvailableLocale, type BeckonFlowState, type BindFlowState, type BorderRadiusToken, BrowseView, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, COMMON_PANELS, type CacheManager, CacheProvider, type CacheProviderProps, type ClickAction, CodeMirrorRenderer, CollaborationPanel, CollapsibleResourceNavigation, type CollapsibleResourceNavigationProps, type ColorToken, CommentEntry, CommentsPanel, ComposeLoadingState, type ComposeLoadingStateProps, type ContextGatherFlowConfig, type ContextGatherFlowState, type CreateAnnotationParams, type CreateConfig, type DeleteAnnotationParams, type DetectionConfig, type DevOpsFeature, type DrawingMode, EntityTagsPage, type EntityTagsPageProps, EntityTypeBadges, ErrorBoundary, Footer, type GenerationOptions, HOVER_DELAY_MS, HighlightEntry, HighlightPanel, HistoryEvent, type HoverEmitterProps, type HoverHandlers, ImageURLSchema, ImageViewer, JsonLdPanel, JsonLdView, type KeyboardShortcut, KeyboardShortcutsHelpModal, LeftSidebar, type LinkComponentProps, LiveRegionProvider, type MarkFlowState, type Motivation$8 as Motivation, type NavigationItem, NavigationMenu, type NavigationMenuHelper, type NavigationProps, type OAuthProvider, type OAuthUser, OAuthUserSchema, ObservableLink, type ObservableLinkProps, type OpenResource, OpenResourcesManager, OpenResourcesProvider, type OverlayAnnotation, PageLayout, type PanelBrowseState, PanelHeader, PopupContainer, PopupHeader, ProposeEntitiesModal, QUERY_KEYS, RESOURCE_PANELS, RecentDocumentsPage, type RecentDocumentsPageProps, ReferenceEntry, ReferenceResolutionWidget, ReferencesPanel, ResizeHandle, type ResolvedTheme, ResourceAnnotationsProvider, ResourceCard, type ResourceCardProps, ResourceComposePage, type ResourceComposePageProps, ResourceDiscoveryPage, type ResourceDiscoveryPageProps, ResourceErrorState, type ResourceErrorStateProps, ResourceInfoPanel, ResourceLoadingState, ResourceSearchModal, type ResourceSearchModalProps, ResourceTagsInline, ResourceViewer, ResourceViewerPage, type ResourceViewerPageProps, type RouteBuilder, type SaveResourceParams, SearchModal, type SearchModalProps, SelectedTextDisplay, type SelectionMotivation, type SelectorType, SemiontBranding, SemiontFavicon, type SemiontResource$4 as SemiontResource, SessionExpiryBanner, SessionManager, SessionProvider, SessionTimer, SettingsPanel, type ShadowToken, type ShapeType, SignInForm, type SignInFormProps, SignUpForm, type SignUpFormProps, SimpleNavigation, type SimpleNavigationItem, type SimpleNavigationProps, SkipLinks, SortableResourceTab, type SortableResourceTabProps, type SpacingToken, StatisticsPanel, StatusDisplay, type StreamStatus, SvgDrawingCanvas, TagEntry, TagSchemasPage, type TagSchemasPageProps, TaggingPanel, type TextSegment, type TextSelection, type Theme, ThemeProvider, ToastContainer, type ToastMessage, ToastProvider, type ToastType, Toolbar, type ToolbarPanelType, type TransitionToken, TranslationManager, TranslationProvider, type TranslationProviderProps, type TypographyToken, type UICreateAnnotationParams, UnifiedAnnotationsPanel, UnifiedHeader, type UseResourceContentResult, UserMenuSkeleton, WelcomePage, type WelcomePageProps, type YieldFlowState, applyHighlights, buildSourceToRenderedMap, buildTextNodeIndex, buttonStyles, clearHighlights, createHoverHandlers, cssVariables, dispatch401Error, dispatch403Error, dispatchAuthEvent, faviconPaths, formatTime, generateCSSVariables, getResourceIcon, getSelectedShapeForSelectorType, getSelectorType, getShortcutDisplay, getSupportedShapes, hideWidgetPreview, isShapeSupported, jsonLightHighlightStyle, jsonLightTheme, onAuthEvent, resolveAnnotationRanges, sanitizeImageURL, saveSelectedShapeForSelectorType, showWidgetPreview, supportsDetection, toOverlayAnnotations, tokens, useAdmin, useAnnotationManager, useAnnotations, useApiClient, useAuthApi, useAuthToken, useBeckonFlow, useBindFlow, useCacheManager, useContextGatherFlow, useDebounce, useDebouncedCallback, useDocumentAnnouncements, useDoubleKeyPress, useDropdown, useEntityTypes, useEventSubscription, useEventSubscriptions, useFormAnnouncements, useGlobalEvents, useHealth, useHoverDelay, useHoverEmitter, useIsTyping, useKeyboardShortcuts, useLanguageChangeAnnouncements, useLineNumbers, useLiveRegion, useLoadingState, useLocalStorage, useMarkFlow, useObservableExternalNavigation, useObservableRouter, useOpenResources, usePanelBrowse, usePanelWidth, usePreloadTranslations, useResourceAnnotations, useResourceContent, useResourceEvents, useResourceLoadingAnnouncements, useResources, useRovingTabIndex, useSearchAnnouncements, useSessionContext, useSessionExpiry, useTheme, useToast, useTranslations, useYieldFlow };
|