@semiont/react-ui 0.4.20 → 0.4.21

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 (108) hide show
  1. package/README.md +8 -5
  2. package/dist/{PdfAnnotationCanvas.client-CHDCGQBR.mjs → PdfAnnotationCanvas.client-6ZGFEN2N.mjs} +9 -13
  3. package/dist/PdfAnnotationCanvas.client-6ZGFEN2N.mjs.map +1 -0
  4. package/dist/TranslationManager-9Xj3MIWQ.d.mts +16 -0
  5. package/dist/chunk-KEDFYI6N.mjs +7788 -0
  6. package/dist/chunk-KEDFYI6N.mjs.map +1 -0
  7. package/dist/index.d.mts +171 -1140
  8. package/dist/index.mjs +3263 -13644
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/test-utils.d.mts +46 -21
  11. package/dist/test-utils.mjs +2499 -87
  12. package/dist/test-utils.mjs.map +1 -1
  13. package/package.json +1 -2
  14. package/src/components/AnnotateReferencesProgressWidget.tsx +21 -28
  15. package/src/components/CodeMirrorRenderer.tsx +9 -11
  16. package/src/components/StatusDisplay.tsx +42 -16
  17. package/src/components/Toolbar.tsx +4 -4
  18. package/src/components/__tests__/AnnotateReferencesProgressWidget.test.tsx +34 -20
  19. package/src/components/__tests__/StatusDisplay.test.tsx +47 -64
  20. package/src/components/__tests__/Toolbar.test.tsx +4 -4
  21. package/src/components/annotation/AnnotateToolbar.tsx +8 -7
  22. package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +31 -77
  23. package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +0 -1
  24. package/src/components/image-annotation/AnnotationOverlay.tsx +12 -13
  25. package/src/components/image-annotation/SvgDrawingCanvas.tsx +7 -7
  26. package/src/components/modals/PermissionDeniedModal.tsx +11 -11
  27. package/src/components/modals/ReferenceWizardModal.tsx +14 -18
  28. package/src/components/modals/ResourceSearchModal.tsx +10 -6
  29. package/src/components/modals/SearchModal.tsx +10 -6
  30. package/src/components/modals/SessionExpiredModal.tsx +11 -11
  31. package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +7 -7
  32. package/src/components/modals/__tests__/ResourceSearchModal.test.tsx +10 -8
  33. package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +10 -7
  34. package/src/components/modals/__tests__/SessionExpiredModal.test.tsx +5 -5
  35. package/src/components/navigation/CollapsibleResourceNavigation.tsx +10 -10
  36. package/src/components/navigation/ObservableLink.tsx +6 -6
  37. package/src/components/navigation/SimpleNavigation.tsx +4 -4
  38. package/src/components/navigation/__tests__/ObservableLink.test.tsx +4 -4
  39. package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +4 -4
  40. package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +9 -11
  41. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +0 -1
  42. package/src/components/resource/AnnotateView.tsx +7 -6
  43. package/src/components/resource/AnnotationHistory.tsx +9 -12
  44. package/src/components/resource/BrowseView.tsx +8 -7
  45. package/src/components/resource/ResourceViewer.tsx +17 -25
  46. package/src/components/resource/__tests__/AnnotationHistory.test.tsx +54 -192
  47. package/src/components/resource/__tests__/BrowseView.test.tsx +34 -83
  48. package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +40 -31
  49. package/src/components/resource/panels/AssessmentEntry.tsx +5 -4
  50. package/src/components/resource/panels/AssessmentPanel.tsx +19 -15
  51. package/src/components/resource/panels/AssistSection.tsx +11 -13
  52. package/src/components/resource/panels/CollaborationPanel.tsx +29 -7
  53. package/src/components/resource/panels/CommentEntry.tsx +5 -4
  54. package/src/components/resource/panels/CommentsPanel.tsx +9 -11
  55. package/src/components/resource/panels/HighlightEntry.tsx +5 -4
  56. package/src/components/resource/panels/HighlightPanel.tsx +10 -11
  57. package/src/components/resource/panels/ReferenceEntry.tsx +8 -8
  58. package/src/components/resource/panels/ReferencesPanel.tsx +13 -12
  59. package/src/components/resource/panels/ResourceInfoPanel.tsx +7 -6
  60. package/src/components/resource/panels/TagEntry.tsx +5 -4
  61. package/src/components/resource/panels/TaggingPanel.tsx +10 -16
  62. package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +3 -2
  63. package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +18 -52
  64. package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +51 -20
  65. package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +18 -56
  66. package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +0 -1
  67. package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +4 -5
  68. package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +153 -0
  69. package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +51 -106
  70. package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +15 -47
  71. package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +15 -47
  72. package/src/components/settings/SettingsPanel.tsx +8 -8
  73. package/src/components/settings/__tests__/SettingsPanel.test.tsx +12 -12
  74. package/src/features/admin-devops/components/AdminDevOpsPage.tsx +1 -1
  75. package/src/features/admin-exchange/components/AdminExchangePage.tsx +1 -1
  76. package/src/features/admin-exchange/components/ImportCard.tsx +2 -6
  77. package/src/features/admin-security/components/AdminSecurityPage.tsx +1 -1
  78. package/src/features/admin-users/components/AdminUsersPage.tsx +1 -1
  79. package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +1 -1
  80. package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +1 -1
  81. package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +1 -1
  82. package/src/features/moderation-linked-data/components/LinkedDataPage.tsx +1 -1
  83. package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +5 -3
  84. package/src/features/resource-compose/components/ResourceComposePage.tsx +5 -22
  85. package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +4 -3
  86. package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +1 -1
  87. package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +38 -45
  88. package/src/features/resource-viewer/components/ResourceViewerPage.tsx +123 -192
  89. package/dist/KnowledgeBaseSessionContext-BNNunwzO.d.mts +0 -175
  90. package/dist/PdfAnnotationCanvas.client-CHDCGQBR.mjs.map +0 -1
  91. package/dist/chunk-OZICDVH7.mjs +0 -62
  92. package/dist/chunk-OZICDVH7.mjs.map +0 -1
  93. package/dist/chunk-R4CCMFJH.mjs +0 -877
  94. package/dist/chunk-R4CCMFJH.mjs.map +0 -1
  95. package/dist/chunk-VN5NY4SN.mjs +0 -200
  96. package/dist/chunk-VN5NY4SN.mjs.map +0 -1
  97. package/src/components/modals/ProposeEntitiesModal.tsx +0 -179
  98. package/src/components/modals/__tests__/ProposeEntitiesModal.test.tsx +0 -129
  99. package/src/features/resource-viewer/__tests__/AnnotationCreationPending.test.tsx +0 -323
  100. package/src/features/resource-viewer/__tests__/AnnotationDeletionIntegration.test.tsx +0 -245
  101. package/src/features/resource-viewer/__tests__/AnnotationProgressDismissal.test.tsx +0 -303
  102. package/src/features/resource-viewer/__tests__/BindFlowIntegration.test.tsx +0 -150
  103. package/src/features/resource-viewer/__tests__/DetectionFlowBug.test.tsx +0 -243
  104. package/src/features/resource-viewer/__tests__/DetectionFlowIntegration.test.tsx +0 -383
  105. package/src/features/resource-viewer/__tests__/ResourceMutations.test.tsx +0 -299
  106. package/src/features/resource-viewer/__tests__/ToastNotifications.test.tsx +0 -186
  107. package/src/features/resource-viewer/__tests__/YieldFlowIntegration.test.tsx +0 -429
  108. 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 } from '@semiont/api-client';
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,61 @@ 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
+ };
51
66
  /**
52
67
  * Create a mock translation manager with custom translations
53
68
  */
54
69
  declare function createMockTranslationManager(translations: Record<string, Record<string, string>>): TranslationManager;
55
70
  /**
56
- * Create a mock open resources manager with custom resources
71
+ * Build a fake SemiontBrowser with the active FrontendSessionSignals
72
+ * observables pre-populated. Used by SessionExpiredModal and
73
+ * PermissionDeniedModal tests that need to control the modal flags
74
+ * without driving a real session through its state machine.
57
75
  */
58
- declare function createMockOpenResourcesManager(resources?: OpenResourcesManager['openResources']): OpenResourcesManager;
76
+ declare function createMockKnowledgeBaseSession(overrides?: {
77
+ permissionDeniedAt?: number | null;
78
+ permissionDeniedMessage?: string | null;
79
+ sessionExpiredAt?: number | null;
80
+ sessionExpiredMessage?: string | null;
81
+ acknowledgePermissionDenied?: () => void;
82
+ acknowledgeSessionExpired?: () => void;
83
+ }): SemiontBrowser;
59
84
 
60
- export { type RenderWithProvidersOptions, type RenderWithProvidersResult, type TestProvidersOptions, createMockKnowledgeBaseSession, createMockOpenResourcesManager, createMockTranslationManager, defaultMockKnowledgeBaseSession, defaultMocks, renderWithProviders };
85
+ export { type RenderWithProvidersOptions, type RenderWithProvidersResult, type TestProvidersOptions, createMockKnowledgeBaseSession, createMockTranslationManager, createTestSemiontWrapper, defaultMocks, renderWithProviders };