@semiont/react-ui 0.4.20 → 0.4.22

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.
Files changed (125) hide show
  1. package/README.md +8 -5
  2. package/dist/{PdfAnnotationCanvas.client-CHDCGQBR.mjs → PdfAnnotationCanvas.client-5QESNO5H.mjs} +13 -16
  3. package/dist/PdfAnnotationCanvas.client-5QESNO5H.mjs.map +1 -0
  4. package/dist/TranslationManager-9Xj3MIWQ.d.mts +16 -0
  5. package/dist/chunk-4NOUO3W6.mjs +7788 -0
  6. package/dist/chunk-4NOUO3W6.mjs.map +1 -0
  7. package/dist/index.d.mts +212 -1206
  8. package/dist/index.mjs +3332 -13712
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/test-utils.d.mts +48 -21
  11. package/dist/test-utils.mjs +2505 -87
  12. package/dist/test-utils.mjs.map +1 -1
  13. package/package.json +2 -2
  14. package/src/components/AnnotateReferencesProgressWidget.tsx +21 -28
  15. package/src/components/CodeMirrorRenderer.tsx +12 -12
  16. package/src/components/LiveRegion.tsx +1 -2
  17. package/src/components/StatusDisplay.tsx +42 -16
  18. package/src/components/Toolbar.tsx +4 -4
  19. package/src/components/__tests__/AnnotateReferencesProgressWidget.test.tsx +34 -20
  20. package/src/components/__tests__/StatusDisplay.test.tsx +50 -65
  21. package/src/components/__tests__/Toolbar.test.tsx +4 -4
  22. package/src/components/annotation/AnnotateToolbar.tsx +8 -9
  23. package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +31 -77
  24. package/src/components/annotation-popups/JsonLdView.tsx +1 -2
  25. package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +1 -2
  26. package/src/components/image-annotation/AnnotationOverlay.tsx +15 -18
  27. package/src/components/image-annotation/SvgDrawingCanvas.tsx +12 -17
  28. package/src/components/modals/ConfigureGenerationStep.tsx +1 -2
  29. package/src/components/modals/PermissionDeniedModal.tsx +11 -11
  30. package/src/components/modals/ReferenceWizardModal.tsx +14 -18
  31. package/src/components/modals/ResourceSearchModal.tsx +12 -8
  32. package/src/components/modals/SearchModal.tsx +11 -6
  33. package/src/components/modals/SearchResultsStep.tsx +1 -3
  34. package/src/components/modals/SessionExpiredModal.tsx +11 -11
  35. package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +7 -7
  36. package/src/components/modals/__tests__/ResourceSearchModal.test.tsx +10 -8
  37. package/src/components/modals/__tests__/SearchModal.accessibility.test.tsx +6 -2
  38. package/src/components/modals/__tests__/SearchModal.basic.test.tsx +6 -2
  39. package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +6 -2
  40. package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +10 -7
  41. package/src/components/modals/__tests__/SearchModal.visual.test.tsx +6 -2
  42. package/src/components/modals/__tests__/SessionExpiredModal.test.tsx +5 -5
  43. package/src/components/navigation/CollapsibleResourceNavigation.tsx +10 -10
  44. package/src/components/navigation/ObservableLink.tsx +6 -6
  45. package/src/components/navigation/SimpleNavigation.tsx +4 -4
  46. package/src/components/navigation/__tests__/ObservableLink.test.tsx +4 -4
  47. package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +4 -4
  48. package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +15 -18
  49. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +1 -2
  50. package/src/components/resource/AnnotateView.tsx +8 -10
  51. package/src/components/resource/AnnotationHistory.tsx +9 -12
  52. package/src/components/resource/BrowseView.tsx +11 -8
  53. package/src/components/resource/ResourceViewer.tsx +22 -34
  54. package/src/components/resource/__tests__/AnnotationHistory.test.tsx +54 -192
  55. package/src/components/resource/__tests__/BrowseView.test.tsx +38 -87
  56. package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +41 -31
  57. package/src/components/resource/__tests__/event-formatting.test.ts +6 -2
  58. package/src/components/resource/event-formatting.ts +2 -3
  59. package/src/components/resource/panels/AssessmentEntry.tsx +7 -8
  60. package/src/components/resource/panels/AssessmentPanel.tsx +21 -17
  61. package/src/components/resource/panels/AssistSection.tsx +15 -21
  62. package/src/components/resource/panels/CollaborationPanel.tsx +29 -7
  63. package/src/components/resource/panels/CommentEntry.tsx +7 -8
  64. package/src/components/resource/panels/CommentsPanel.tsx +11 -13
  65. package/src/components/resource/panels/HighlightEntry.tsx +7 -8
  66. package/src/components/resource/panels/HighlightPanel.tsx +12 -13
  67. package/src/components/resource/panels/ReferenceEntry.tsx +13 -15
  68. package/src/components/resource/panels/ReferencesPanel.tsx +17 -19
  69. package/src/components/resource/panels/ResourceInfoPanel.tsx +8 -7
  70. package/src/components/resource/panels/StatisticsPanel.tsx +2 -3
  71. package/src/components/resource/panels/TagEntry.tsx +7 -8
  72. package/src/components/resource/panels/TaggingPanel.tsx +14 -23
  73. package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +4 -3
  74. package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +4 -4
  75. package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +22 -57
  76. package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +51 -20
  77. package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +4 -4
  78. package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +22 -61
  79. package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +4 -4
  80. package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +1 -2
  81. package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +7 -8
  82. package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +153 -0
  83. package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +51 -106
  84. package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +28 -53
  85. package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +3 -3
  86. package/src/components/resource/panels/__tests__/TagEntry.test.tsx +4 -4
  87. package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +19 -52
  88. package/src/components/settings/SettingsPanel.tsx +9 -9
  89. package/src/components/settings/__tests__/SettingsPanel.test.tsx +15 -15
  90. package/src/features/admin-devops/components/AdminDevOpsPage.tsx +1 -2
  91. package/src/features/admin-exchange/components/AdminExchangePage.tsx +1 -1
  92. package/src/features/admin-exchange/components/ImportCard.tsx +2 -7
  93. package/src/features/admin-security/components/AdminSecurityPage.tsx +1 -2
  94. package/src/features/admin-users/components/AdminUsersPage.tsx +1 -1
  95. package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +1 -2
  96. package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +1 -2
  97. package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +1 -1
  98. package/src/features/moderation-linked-data/components/LinkedDataPage.tsx +1 -1
  99. package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +5 -3
  100. package/src/features/resource-compose/components/ResourceComposePage.tsx +6 -22
  101. package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +4 -3
  102. package/src/features/resource-discovery/components/ResourceCard.tsx +1 -2
  103. package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +3 -4
  104. package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +37 -45
  105. package/src/features/resource-viewer/components/ResourceViewerPage.tsx +129 -197
  106. package/dist/KnowledgeBaseSessionContext-BNNunwzO.d.mts +0 -175
  107. package/dist/PdfAnnotationCanvas.client-CHDCGQBR.mjs.map +0 -1
  108. package/dist/chunk-OZICDVH7.mjs +0 -62
  109. package/dist/chunk-OZICDVH7.mjs.map +0 -1
  110. package/dist/chunk-R4CCMFJH.mjs +0 -877
  111. package/dist/chunk-R4CCMFJH.mjs.map +0 -1
  112. package/dist/chunk-VN5NY4SN.mjs +0 -200
  113. package/dist/chunk-VN5NY4SN.mjs.map +0 -1
  114. package/src/components/modals/ProposeEntitiesModal.tsx +0 -179
  115. package/src/components/modals/__tests__/ProposeEntitiesModal.test.tsx +0 -129
  116. package/src/features/resource-viewer/__tests__/AnnotationCreationPending.test.tsx +0 -323
  117. package/src/features/resource-viewer/__tests__/AnnotationDeletionIntegration.test.tsx +0 -245
  118. package/src/features/resource-viewer/__tests__/AnnotationProgressDismissal.test.tsx +0 -303
  119. package/src/features/resource-viewer/__tests__/BindFlowIntegration.test.tsx +0 -150
  120. package/src/features/resource-viewer/__tests__/DetectionFlowBug.test.tsx +0 -243
  121. package/src/features/resource-viewer/__tests__/DetectionFlowIntegration.test.tsx +0 -383
  122. package/src/features/resource-viewer/__tests__/ResourceMutations.test.tsx +0 -299
  123. package/src/features/resource-viewer/__tests__/ToastNotifications.test.tsx +0 -186
  124. package/src/features/resource-viewer/__tests__/YieldFlowIntegration.test.tsx +0 -429
  125. package/src/features/resource-viewer/__tests__/annotation-progress-flow.test.tsx +0 -348
@@ -1,11 +1,10 @@
1
- import { ReactElement } from 'react';
1
+ import React__default, { ReactElement } from 'react';
2
2
  import { RenderOptions, RenderResult } from '@testing-library/react';
3
3
  export * from '@testing-library/react';
4
- import { QueryClient } from '@tanstack/react-query';
5
- import { T as TranslationManager, e as KnowledgeBaseSessionValue, O as OpenResourcesManager } from './KnowledgeBaseSessionContext-BNNunwzO.mjs';
4
+ import { SemiontBrowser, SemiontClient } from '@semiont/sdk';
6
5
  import { EventBus } from '@semiont/core';
6
+ import { T as TranslationManager } from './TranslationManager-9Xj3MIWQ.mjs';
7
7
  export { vi } from 'vitest';
8
- import 'react/jsx-runtime';
9
8
 
10
9
  /**
11
10
  * Test utilities for @semiont/react-ui
@@ -14,21 +13,11 @@ import 'react/jsx-runtime';
14
13
  * for testing, with customizable mock implementations.
15
14
  */
16
15
 
17
- /**
18
- * Default mock context value for KnowledgeBaseSessionProvider in tests.
19
- * Tests override individual fields via `createMockKnowledgeBaseSession`.
20
- */
21
- declare const defaultMockKnowledgeBaseSession: KnowledgeBaseSessionValue;
22
- /**
23
- * Construct a mock KnowledgeBaseSession context value with overrides.
24
- */
25
- declare function createMockKnowledgeBaseSession(overrides?: Partial<KnowledgeBaseSessionValue>): KnowledgeBaseSessionValue;
26
16
  /**
27
17
  * Default mock implementations
28
18
  */
29
19
  declare const defaultMocks: {
30
20
  translationManager: TranslationManager;
31
- openResourcesManager: OpenResourcesManager;
32
21
  };
33
22
  /**
34
23
  * Options for renderWithProviders
@@ -36,25 +25,63 @@ declare const defaultMocks: {
36
25
  interface TestProvidersOptions {
37
26
  translationManager?: TranslationManager;
38
27
  apiBaseUrl?: string;
39
- knowledgeBaseSession?: KnowledgeBaseSessionValue;
40
- openResourcesManager?: OpenResourcesManager;
41
- queryClient?: QueryClient;
28
+ /** Inject a specific SemiontBrowser (e.g. one seeded with a kbs list). */
29
+ browser?: SemiontBrowser;
42
30
  }
43
31
  interface RenderWithProvidersOptions extends TestProvidersOptions, Omit<RenderOptions, 'wrapper'> {
44
- /** If true, returns the event bus instance along with render result */
32
+ /**
33
+ * If true, returns the session (client) EventBus — session-scoped
34
+ * channels (mark:*, beckon:*, gather:*, match:*, bind:*, yield:*,
35
+ * browse:click, browse:reference-navigate, browse:entity-type-clicked).
36
+ */
45
37
  returnEventBus?: boolean;
38
+ /**
39
+ * If true, returns the app-scoped (SemiontBrowser) EventBus — panel:*,
40
+ * shell:*, tabs:*, nav:*, settings:*.
41
+ */
42
+ returnShellBus?: boolean;
46
43
  }
47
44
  interface RenderWithProvidersResult extends RenderResult {
45
+ /** Session-scoped bus (from the fake client inside the fake browser). */
48
46
  eventBus?: EventBus;
47
+ /** App-scoped bus (the fake browser's own bus). */
48
+ shellBus?: EventBus;
49
49
  }
50
50
  declare function renderWithProviders(ui: ReactElement, options?: RenderWithProvidersOptions): RenderWithProvidersResult;
51
+ /**
52
+ * Build a minimal `<SemiontProvider>` wrapper for tests that roll their
53
+ * own render wrapper (instead of `renderWithProviders`). The returned
54
+ * `eventBus` is the bus backing the fake session's client — same
55
+ * reference production code pokes via `session.client.emit(...)`.
56
+ */
57
+ declare function createTestSemiontWrapper(apiBaseUrl?: string): {
58
+ SemiontWrapper: React__default.ComponentType<{
59
+ children: React__default.ReactNode;
60
+ }>;
61
+ /** Session-scoped bus (from the fake client). */
62
+ eventBus: EventBus;
63
+ /** App-scoped bus (the fake browser's own bus). */
64
+ shellBus: EventBus;
65
+ /** The fake session's client — for tests that need to spy on namespace methods. */
66
+ client: SemiontClient;
67
+ };
51
68
  /**
52
69
  * Create a mock translation manager with custom translations
53
70
  */
54
71
  declare function createMockTranslationManager(translations: Record<string, Record<string, string>>): TranslationManager;
55
72
  /**
56
- * Create a mock open resources manager with custom resources
73
+ * Build a fake SemiontBrowser with the active FrontendSessionSignals
74
+ * observables pre-populated. Used by SessionExpiredModal and
75
+ * PermissionDeniedModal tests that need to control the modal flags
76
+ * without driving a real session through its state machine.
57
77
  */
58
- declare function createMockOpenResourcesManager(resources?: OpenResourcesManager['openResources']): OpenResourcesManager;
78
+ declare function createMockKnowledgeBaseSession(overrides?: {
79
+ permissionDeniedAt?: number | null;
80
+ permissionDeniedMessage?: string | null;
81
+ sessionExpiredAt?: number | null;
82
+ sessionExpiredMessage?: string | null;
83
+ acknowledgePermissionDenied?: () => void;
84
+ acknowledgeSessionExpired?: () => void;
85
+ }): SemiontBrowser;
59
86
 
60
- export { type RenderWithProvidersOptions, type RenderWithProvidersResult, type TestProvidersOptions, createMockKnowledgeBaseSession, createMockOpenResourcesManager, createMockTranslationManager, defaultMockKnowledgeBaseSession, defaultMocks, renderWithProviders };
87
+ export { type RenderWithProvidersOptions, type RenderWithProvidersResult, type TestProvidersOptions, createMockKnowledgeBaseSession, createMockTranslationManager, createTestSemiontWrapper, defaultMocks, renderWithProviders };