@xynolog/react-ui 0.8.0 → 0.8.1

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 (235) hide show
  1. package/README.md +26 -46
  2. package/package.json +12 -9
  3. package/src/components/Button/Button.tsx +0 -188
  4. package/src/components/Button/__tests__/Button.test.tsx +0 -449
  5. package/src/components/CodeMirrorRenderer.tsx +0 -536
  6. package/src/components/DelegateProgress.tsx +0 -308
  7. package/src/components/ErrorBoundary.tsx +0 -174
  8. package/src/components/ItemFoundLog.tsx +0 -42
  9. package/src/components/LiveRegion.tsx +0 -261
  10. package/src/components/ProtectedErrorBoundary.tsx +0 -114
  11. package/src/components/ResizeHandle.tsx +0 -167
  12. package/src/components/ResourceTagsInline.tsx +0 -120
  13. package/src/components/SessionExpiryBanner.tsx +0 -74
  14. package/src/components/SessionTimer.tsx +0 -17
  15. package/src/components/StatusDisplay.tsx +0 -131
  16. package/src/components/Toast.tsx +0 -217
  17. package/src/components/Toolbar.tsx +0 -194
  18. package/src/components/UserMenuSkeleton.tsx +0 -13
  19. package/src/components/__tests__/DelegateProgress.denominator.test.tsx +0 -102
  20. package/src/components/__tests__/DelegateProgress.test.tsx +0 -649
  21. package/src/components/__tests__/ErrorBoundary.test.tsx +0 -565
  22. package/src/components/__tests__/LiveRegion.a11y.test.tsx +0 -258
  23. package/src/components/__tests__/LiveRegion.hooks.test.tsx +0 -140
  24. package/src/components/__tests__/ProtectedErrorBoundary.test.tsx +0 -225
  25. package/src/components/__tests__/ResizeHandle.test.tsx +0 -159
  26. package/src/components/__tests__/ResourceTagsInline.test.tsx +0 -325
  27. package/src/components/__tests__/SessionExpiryBanner.test.tsx +0 -124
  28. package/src/components/__tests__/SessionTimer.test.tsx +0 -199
  29. package/src/components/__tests__/StatusDisplay.test.tsx +0 -179
  30. package/src/components/__tests__/Toast.test.tsx +0 -96
  31. package/src/components/__tests__/Toolbar.test.tsx +0 -111
  32. package/src/components/__tests__/UserMenuSkeleton.test.tsx +0 -182
  33. package/src/components/annotation/AnchoredTextNotice.tsx +0 -36
  34. package/src/components/annotation/AnnotateToolbar.tsx +0 -531
  35. package/src/components/annotation/__tests__/AnnotateToolbar.display.test.tsx +0 -127
  36. package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +0 -304
  37. package/src/components/annotation-popups/JsonLdView.tsx +0 -127
  38. package/src/components/annotation-popups/SharedPopupElements.tsx +0 -131
  39. package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +0 -432
  40. package/src/components/annotation-popups/__tests__/SharedPopupElements.test.tsx +0 -297
  41. package/src/components/branding/XynologBranding.tsx +0 -41
  42. package/src/components/branding/__tests__/XynologBranding.test.tsx +0 -383
  43. package/src/components/error-states/ResourceErrorState.tsx +0 -30
  44. package/src/components/error-states/__tests__/ResourceErrorState.test.tsx +0 -102
  45. package/src/components/image-annotation/AnnotationOverlay.tsx +0 -307
  46. package/src/components/image-annotation/SvgDrawingCanvas.tsx +0 -514
  47. package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +0 -169
  48. package/src/components/image-annotation/__tests__/AnnotationOverlay.hover.test.tsx +0 -83
  49. package/src/components/image-annotation/__tests__/SvgDrawingCanvas.annotate-gate.test.tsx +0 -228
  50. package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +0 -204
  51. package/src/components/layout/LeftSidebar.tsx +0 -150
  52. package/src/components/layout/PageLayout.tsx +0 -49
  53. package/src/components/layout/SkipLinks.tsx +0 -36
  54. package/src/components/layout/UnifiedHeader.tsx +0 -151
  55. package/src/components/layout/__tests__/LeftSidebar.test.tsx +0 -426
  56. package/src/components/layout/__tests__/PageLayout.test.tsx +0 -311
  57. package/src/components/layout/__tests__/SkipLinks.a11y.test.tsx +0 -218
  58. package/src/components/layout/__tests__/UnifiedHeader.test.tsx +0 -555
  59. package/src/components/loading-states/ComposeLoadingState.tsx +0 -19
  60. package/src/components/loading-states/ResourceLoadingState.tsx +0 -13
  61. package/src/components/loading-states/__tests__/ComposeLoadingState.test.tsx +0 -37
  62. package/src/components/loading-states/__tests__/ResourceLoadingState.test.tsx +0 -31
  63. package/src/components/modals/ComposeStep.tsx +0 -245
  64. package/src/components/modals/ConfigureGatherStep.tsx +0 -110
  65. package/src/components/modals/ConfigureGenerationStep.tsx +0 -458
  66. package/src/components/modals/ConfigureSearchStep.tsx +0 -124
  67. package/src/components/modals/ContextSummary.tsx +0 -317
  68. package/src/components/modals/CorpusPane.tsx +0 -96
  69. package/src/components/modals/DiscardPrompt.tsx +0 -44
  70. package/src/components/modals/GatherContextStep.tsx +0 -480
  71. package/src/components/modals/KbIdentityConflictModal.tsx +0 -122
  72. package/src/components/modals/KeyboardShortcutsHelpModal.tsx +0 -238
  73. package/src/components/modals/PermissionDeniedModal.tsx +0 -207
  74. package/src/components/modals/ReferenceWizardModal.tsx +0 -656
  75. package/src/components/modals/ResourceGenerateModal.tsx +0 -457
  76. package/src/components/modals/SearchModal.tsx +0 -334
  77. package/src/components/modals/SearchResultsStep.tsx +0 -117
  78. package/src/components/modals/SessionEndedModal.tsx +0 -148
  79. package/src/components/modals/WizardFooter.tsx +0 -72
  80. package/src/components/modals/__tests__/ComposeStep.test.tsx +0 -187
  81. package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +0 -92
  82. package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +0 -574
  83. package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +0 -124
  84. package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +0 -702
  85. package/src/components/modals/__tests__/KbIdentityConflictModal.test.tsx +0 -102
  86. package/src/components/modals/__tests__/KeyboardShortcutsHelpModal.test.tsx +0 -115
  87. package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +0 -218
  88. package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +0 -936
  89. package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +0 -532
  90. package/src/components/modals/__tests__/SearchModal.accessibility.test.tsx +0 -95
  91. package/src/components/modals/__tests__/SearchModal.basic.test.tsx +0 -84
  92. package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +0 -162
  93. package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +0 -237
  94. package/src/components/modals/__tests__/SearchModal.translations.test.tsx +0 -91
  95. package/src/components/modals/__tests__/SearchResultsStep.test.tsx +0 -95
  96. package/src/components/modals/__tests__/SessionEndedModal.test.tsx +0 -171
  97. package/src/components/modals/__tests__/WizardFooter.test.tsx +0 -446
  98. package/src/components/modals/__tests__/search-modal-harness.ts +0 -82
  99. package/src/components/navigation/CollapsibleResourceNavigation.tsx +0 -364
  100. package/src/components/navigation/NavigationMenu.tsx +0 -66
  101. package/src/components/navigation/ObservableLink.tsx +0 -90
  102. package/src/components/navigation/SimpleNavigation.tsx +0 -169
  103. package/src/components/navigation/SortableResourceTab.tsx +0 -122
  104. package/src/components/navigation/__tests__/NavigationMenu.a11y.test.tsx +0 -302
  105. package/src/components/navigation/__tests__/NavigationMenu.test.tsx +0 -399
  106. package/src/components/navigation/__tests__/ObservableLink.test.tsx +0 -85
  107. package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +0 -193
  108. package/src/components/navigation/__tests__/SortableResourceTab.test.tsx +0 -421
  109. package/src/components/pdf-annotation/PdfAnnotationCanvas.client.tsx +0 -10
  110. package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +0 -632
  111. package/src/components/pdf-annotation/PdfPageView.tsx +0 -527
  112. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.annotate-gate.test.tsx +0 -295
  113. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.pixels-before-anchoring.test.tsx +0 -166
  114. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +0 -1719
  115. package/src/components/pdf-annotation/__tests__/estimate-slot-height.test.ts +0 -61
  116. package/src/components/pdf-annotation/__tests__/rects-for-page.test.ts +0 -110
  117. package/src/components/pdf-annotation/estimate-slot-height.ts +0 -31
  118. package/src/components/pdf-annotation/rects-for-page.ts +0 -50
  119. package/src/components/resource/AnnotateView.tsx +0 -373
  120. package/src/components/resource/AnnotationHistory.tsx +0 -169
  121. package/src/components/resource/BrowseView.tsx +0 -440
  122. package/src/components/resource/DownloadFileLink.tsx +0 -53
  123. package/src/components/resource/HistoryEvent.tsx +0 -186
  124. package/src/components/resource/ResourceViewer.tsx +0 -617
  125. package/src/components/resource/__tests__/AnnotateView.code-point-offsets.test.tsx +0 -482
  126. package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +0 -78
  127. package/src/components/resource/__tests__/AnnotateView.focus.test.tsx +0 -147
  128. package/src/components/resource/__tests__/AnnotateView.registry.test.tsx +0 -143
  129. package/src/components/resource/__tests__/AnnotationHistory.test.tsx +0 -257
  130. package/src/components/resource/__tests__/BrowseView.code-point-offsets.test.tsx +0 -123
  131. package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +0 -76
  132. package/src/components/resource/__tests__/BrowseView.links.test.tsx +0 -84
  133. package/src/components/resource/__tests__/BrowseView.overlay-async.test.tsx +0 -165
  134. package/src/components/resource/__tests__/BrowseView.reference-hover.test.tsx +0 -200
  135. package/src/components/resource/__tests__/BrowseView.registry.test.tsx +0 -57
  136. package/src/components/resource/__tests__/BrowseView.test.tsx +0 -915
  137. package/src/components/resource/__tests__/HistoryEvent.test.tsx +0 -571
  138. package/src/components/resource/__tests__/ResourceViewer.delete-failure.test.tsx +0 -103
  139. package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +0 -250
  140. package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +0 -262
  141. package/src/components/resource/__tests__/ResourceViewer.multi-mount-invalidation.test.tsx +0 -166
  142. package/src/components/resource/__tests__/ResourceViewer.registry.test.tsx +0 -112
  143. package/src/components/resource/__tests__/ResourceViewer.toolbar-opt-out.test.tsx +0 -207
  144. package/src/components/resource/__tests__/ResourceViewer.toolbar-prefs.test.tsx +0 -274
  145. package/src/components/resource/__tests__/annotation-interactions.test.tsx +0 -116
  146. package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +0 -183
  147. package/src/components/resource/__tests__/browse-renderers.test.tsx +0 -47
  148. package/src/components/resource/__tests__/download-link.test.tsx +0 -171
  149. package/src/components/resource/__tests__/event-formatting.test.ts +0 -379
  150. package/src/components/resource/__tests__/inline-embedding.test.tsx +0 -133
  151. package/src/components/resource/__tests__/media-completeness.test.tsx +0 -144
  152. package/src/components/resource/annotate-renderers.tsx +0 -186
  153. package/src/components/resource/browse-renderers.tsx +0 -133
  154. package/src/components/resource/event-formatting.ts +0 -393
  155. package/src/components/resource/panels/AssessmentEntry.tsx +0 -127
  156. package/src/components/resource/panels/AssessmentPanel.tsx +0 -309
  157. package/src/components/resource/panels/CollaborationPanel.tsx +0 -228
  158. package/src/components/resource/panels/CommentEntry.tsx +0 -242
  159. package/src/components/resource/panels/CommentsPanel.tsx +0 -320
  160. package/src/components/resource/panels/DelegateSection.tsx +0 -282
  161. package/src/components/resource/panels/DelegateShell.tsx +0 -134
  162. package/src/components/resource/panels/HighlightEntry.tsx +0 -83
  163. package/src/components/resource/panels/HighlightPanel.tsx +0 -212
  164. package/src/components/resource/panels/JsonLdPanel.tsx +0 -119
  165. package/src/components/resource/panels/PanelHeader.tsx +0 -22
  166. package/src/components/resource/panels/ReferenceEntry.tsx +0 -232
  167. package/src/components/resource/panels/ReferencesPanel.tsx +0 -626
  168. package/src/components/resource/panels/ResourceInfoPanel.tsx +0 -433
  169. package/src/components/resource/panels/StatisticsPanel.tsx +0 -145
  170. package/src/components/resource/panels/TagEntry.tsx +0 -87
  171. package/src/components/resource/panels/TaggingPanel.tsx +0 -554
  172. package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +0 -384
  173. package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +0 -292
  174. package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +0 -685
  175. package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +0 -685
  176. package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +0 -750
  177. package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +0 -877
  178. package/src/components/resource/panels/__tests__/DelegateSection.test.tsx +0 -623
  179. package/src/components/resource/panels/__tests__/DelegateShell.test.tsx +0 -212
  180. package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +0 -236
  181. package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +0 -506
  182. package/src/components/resource/panels/__tests__/HighlightPanel.out-of-order.test.tsx +0 -132
  183. package/src/components/resource/panels/__tests__/JsonLdPanel.test.tsx +0 -230
  184. package/src/components/resource/panels/__tests__/PanelHeader.test.tsx +0 -54
  185. package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +0 -578
  186. package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +0 -193
  187. package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +0 -193
  188. package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +0 -1080
  189. package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +0 -812
  190. package/src/components/resource/panels/__tests__/ResourceInfoPanel.text-layer.test.tsx +0 -106
  191. package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +0 -329
  192. package/src/components/resource/panels/__tests__/TagEntry.test.tsx +0 -250
  193. package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +0 -772
  194. package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.delegated-job.test.tsx +0 -207
  195. package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.failure.test.tsx +0 -89
  196. package/src/components/resource/panels/__tests__/agent-label.test.ts +0 -136
  197. package/src/components/resource/panels/agent-label.ts +0 -35
  198. package/src/components/settings/SettingsPanel.tsx +0 -251
  199. package/src/components/settings/__tests__/SettingsPanel.test.tsx +0 -260
  200. package/src/components/viewers/ImageViewer.tsx +0 -18
  201. package/src/components/viewers/__tests__/ImageViewer.test.tsx +0 -57
  202. package/src/components/viewers/index.ts +0 -1
  203. package/src/features/auth/__tests__/AuthErrorDisplay.test.tsx +0 -181
  204. package/src/features/auth/components/AuthErrorDisplay.tsx +0 -89
  205. package/src/features/moderate-entity-tags/__tests__/EntityTagsPage.test.tsx +0 -387
  206. package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +0 -161
  207. package/src/features/moderate-entity-tags/state/__tests__/entity-tags-state-unit.test.ts +0 -183
  208. package/src/features/moderate-entity-tags/state/entity-tags-state-unit.ts +0 -73
  209. package/src/features/moderate-recent/__tests__/RecentDocumentsPage.test.tsx +0 -422
  210. package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +0 -117
  211. package/src/features/moderate-tag-schemas/__tests__/TagSchemasPage.test.tsx +0 -481
  212. package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +0 -161
  213. package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +0 -600
  214. package/src/features/resource-compose/__tests__/UploadProgressBar.test.tsx +0 -256
  215. package/src/features/resource-compose/components/ResourceComposePage.tsx +0 -809
  216. package/src/features/resource-compose/components/UploadProgressBar.tsx +0 -125
  217. package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +0 -195
  218. package/src/features/resource-compose/state/compose-page-state-unit.ts +0 -187
  219. package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +0 -338
  220. package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +0 -449
  221. package/src/features/resource-discovery/components/ResourceCard.tsx +0 -80
  222. package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +0 -330
  223. package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +0 -477
  224. package/src/features/resource-discovery/state/discover-state-unit.ts +0 -162
  225. package/src/features/resource-viewer/__tests__/ResourceViewerPage.content-loading.test.tsx +0 -260
  226. package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +0 -570
  227. package/src/features/resource-viewer/__tests__/generation-params.test.ts +0 -49
  228. package/src/features/resource-viewer/components/ResourceViewerPage.tsx +0 -1058
  229. package/src/features/resource-viewer/generation-params.ts +0 -23
  230. package/src/features/resource-viewer/hooks/__tests__/useResourceViewedReport.test.tsx +0 -77
  231. package/src/features/resource-viewer/hooks/useResourceViewedReport.ts +0 -38
  232. package/src/features/resource-viewer/state/__tests__/resource-loader-state-unit.test.ts +0 -178
  233. package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +0 -505
  234. package/src/features/resource-viewer/state/resource-loader-state-unit.ts +0 -93
  235. package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +0 -156
@@ -1,433 +0,0 @@
1
- 'use client';
2
-
3
- import type {
4
- AnchoredTextAnswer,
5
- JobId,
6
- ResourceId,
7
- YieldJobDone,
8
- } from '@xynolog/core';
9
- import { useCallback, useEffect, useState } from 'react';
10
- import { useTranslations } from '../../../contexts/TranslationContext';
11
- import { readyValue, type XynologSession } from '@xynolog/sdk';
12
- import { formatLocaleDisplay } from '@xynolog/core';
13
- import { type components } from '@xynolog/core';
14
- import { useEventSubscription } from '../../../contexts/useEventSubscription';
15
- import { useObservable } from '../../../hooks/useObservable';
16
- import { renderAgentLabel } from './agent-label';
17
- import { DelegateShell } from './DelegateShell';
18
- import { delegateProgressTranslations } from '../../../lib/delegate-progress-copy';
19
- import { delegatedJobControls } from '../../../lib/delegated-job-controls';
20
- import './ResourceInfoPanel.css';
21
-
22
- type Agent = components['schemas']['Agent'];
23
- type JobProgress = components['schemas']['JobProgress'];
24
-
25
- interface Props {
26
- /** Session carrying the client and event bus; null renders inert. */
27
- session: XynologSession | null;
28
- resourceId: ResourceId;
29
- documentEntityTypes: string[];
30
- documentLocale?: string | undefined;
31
- primaryMediaType?: string | undefined;
32
- primaryByteSize?: number | undefined;
33
- storageUri?: string | undefined;
34
- isArchived?: boolean;
35
- dateCreated?: string | undefined;
36
- dateModified?: string | undefined;
37
- wasAttributedTo?: Agent | Agent[] | undefined;
38
- wasDerivedFrom?: components['schemas']['ResourceDescriptor']['wasDerivedFrom'];
39
- generator?: Agent | Agent[] | undefined;
40
- /**
41
- * Open the resource-generate flow. UI-only — the SDK isn't involved in
42
- * *opening* the display (if collaborative gather ever lands, this graduates
43
- * to a verb). Omit to hide the Generate action.
44
- */
45
- onGenerate?: () => void;
46
- /**
47
- * Generation lifecycle, page-held (`yield.isGenerating$` / `yield.progress$`
48
- * / `yield.outcome$`): this panel is generation's progress surface — the
49
- * run reports where it was started.
50
- */
51
- isGenerating?: boolean;
52
- generationProgress?: JobProgress | null;
53
- /**
54
- * The id of the generation job (`yield.jobId$`): what the cancel control
55
- * names. Null until the queue has answered the job's creation and once the
56
- * job is over, and then there is no control.
57
- */
58
- generationJobId?: JobId | null;
59
- /** The finished run's result; the ended frame links it by name. */
60
- generationOutcome?: YieldJobDone | null;
61
- /**
62
- * The run ended cancelled (`yield.failure$` holds a `JobCancelledError`):
63
- * its display stays, in its cancelled form, until dismissed.
64
- */
65
- generationCancelled?: boolean;
66
- /** Clear the finished display — wires `yield.dismissProgress()`. */
67
- onDismissProgress?: () => void;
68
- }
69
-
70
- /**
71
- * Panel for displaying resource metadata and management actions
72
- *
73
- * @emits yield:clone - Clone this resource
74
- * @emits mark:unarchive - Unarchive this resource
75
- * @emits mark:archive - Archive this resource
76
- * @emits browse:resource-open - Open a resource this panel links to, the generated one among them. Payload: { resourceId: string }
77
- */
78
- export function ResourceInfoPanel({
79
- session,
80
- resourceId,
81
- documentEntityTypes,
82
- documentLocale,
83
- primaryMediaType,
84
- primaryByteSize,
85
- storageUri,
86
- isArchived = false,
87
- dateCreated,
88
- dateModified,
89
- wasAttributedTo,
90
- wasDerivedFrom,
91
- generator,
92
- onGenerate,
93
- isGenerating = false,
94
- generationProgress = null,
95
- generationJobId = null,
96
- generationOutcome = null,
97
- generationCancelled = false,
98
- onDismissProgress,
99
- }: Props) {
100
- const t = useTranslations('ResourceInfoPanel');
101
- const ta = useTranslations('DelegateProgress');
102
-
103
- // The text layer's standing — the user-facing face of `smelt:settled`. The
104
- // row renders the wire's own vocabulary, translated; `unknown` and
105
- // not-yet-asked render NO row: no claim, no invented state. The bridged
106
- // settle for THIS resource refreshes in place.
107
- const [textLayerKind, setTextLayerKind] = useState<
108
- AnchoredTextAnswer['kind'] | null
109
- >(null);
110
- const refreshTextLayer = useCallback(() => {
111
- if (!session) return;
112
- session.client.browse.resourceAnchoredText(resourceId).then(
113
- (answer) => setTextLayerKind(answer.kind),
114
- () => {
115
- /* transport failure: keep whatever stood — no claim */
116
- },
117
- );
118
- }, [session, resourceId]);
119
- useEffect(() => {
120
- setTextLayerKind(null);
121
- refreshTextLayer();
122
- }, [refreshTextLayer]);
123
- useEventSubscription('smelt:settled', (settled) => {
124
- if (settled.resourceId === resourceId) refreshTextLayer();
125
- });
126
- const showTextLayerRow =
127
- textLayerKind !== null && textLayerKind !== 'unknown';
128
-
129
- // Single attribution surface. `wasAttributedTo` is the canonical list
130
- // of responsible parties; if a producer set only `generator` we
131
- // render that as the attribution chain.
132
- const attribution: Agent[] = wasAttributedTo
133
- ? Array.isArray(wasAttributedTo)
134
- ? wasAttributedTo
135
- : [wasAttributedTo]
136
- : generator
137
- ? Array.isArray(generator)
138
- ? generator
139
- : [generator]
140
- : [];
141
-
142
- return (
143
- <div className="xynolog-resource-info-panel">
144
- {/* Panel Title */}
145
- <h3 className="xynolog-resource-info-panel__title">{t('title')}</h3>
146
-
147
- {/* Locale Section */}
148
- <div className="xynolog-resource-info-panel__section">
149
- <h3 className="xynolog-resource-info-panel__heading">{t('locale')}</h3>
150
- {documentLocale ? (
151
- <div className="xynolog-resource-info-panel__value">
152
- {formatLocaleDisplay(documentLocale)}
153
- </div>
154
- ) : (
155
- <div className="xynolog-resource-info-panel__value xynolog-resource-info-panel__value--empty">
156
- {t('notSpecified')}
157
- </div>
158
- )}
159
- </div>
160
-
161
- {/* Representation Section */}
162
- {(primaryMediaType ||
163
- primaryByteSize !== undefined ||
164
- showTextLayerRow) && (
165
- <div className="xynolog-resource-info-panel__section">
166
- <h3 className="xynolog-resource-info-panel__heading">
167
- {t('representation')}
168
- </h3>
169
- <div className="xynolog-resource-info-panel__field-group">
170
- {primaryMediaType && (
171
- <div>
172
- <span className="xynolog-resource-info-panel__label">
173
- {t('mediaType')}
174
- </span>
175
- <span className="xynolog-resource-info-panel__value">
176
- {primaryMediaType}
177
- </span>
178
- </div>
179
- )}
180
- {primaryByteSize !== undefined && (
181
- <div>
182
- <span className="xynolog-resource-info-panel__label">
183
- {t('byteSize')}
184
- </span>
185
- <span className="xynolog-resource-info-panel__value">
186
- {primaryByteSize.toLocaleString()} bytes
187
- </span>
188
- </div>
189
- )}
190
- {showTextLayerRow && (
191
- <div>
192
- <span className="xynolog-resource-info-panel__label">
193
- {t('textLayer')}
194
- </span>
195
- <span
196
- className="xynolog-resource-info-panel__value"
197
- data-kind={textLayerKind}
198
- >
199
- {textLayerKind === 'extracted'
200
- ? t('textLayerReady')
201
- : textLayerKind === 'not-yet'
202
- ? t('textLayerPreparing')
203
- : textLayerKind === 'declined'
204
- ? t('textLayerNone')
205
- : t('textLayerNotApplicable')}
206
- </span>
207
- </div>
208
- )}
209
- {storageUri && (
210
- <div>
211
- <span className="xynolog-resource-info-panel__label">
212
- {t('storageUri')}
213
- </span>
214
- <span className="xynolog-resource-info-panel__value">
215
- {storageUri}
216
- </span>
217
- </div>
218
- )}
219
- </div>
220
- </div>
221
- )}
222
-
223
- {/* Provenance Section */}
224
- {(dateCreated ||
225
- dateModified ||
226
- attribution.length > 0 ||
227
- wasDerivedFrom) && (
228
- <div className="xynolog-resource-info-panel__section">
229
- <h3 className="xynolog-resource-info-panel__heading">
230
- {t('provenance')}
231
- </h3>
232
- <div className="xynolog-resource-info-panel__field-group">
233
- {dateCreated && (
234
- <div>
235
- <span className="xynolog-resource-info-panel__label">
236
- {t('createdAt')}
237
- </span>
238
- <span className="xynolog-resource-info-panel__value">
239
- {new Date(dateCreated).toLocaleString()}
240
- </span>
241
- </div>
242
- )}
243
- {dateModified && (
244
- <div>
245
- <span className="xynolog-resource-info-panel__label">
246
- {t('modifiedAt')}
247
- </span>
248
- <span className="xynolog-resource-info-panel__value">
249
- {new Date(dateModified).toLocaleString()}
250
- </span>
251
- </div>
252
- )}
253
- {attribution.length > 0 && (
254
- <div>
255
- <span className="xynolog-resource-info-panel__label">
256
- {t('attributedTo')}
257
- </span>
258
- <span className="xynolog-resource-info-panel__value">
259
- {attribution.map(renderAgentLabel).join(', ')}
260
- </span>
261
- </div>
262
- )}
263
- {wasDerivedFrom && (
264
- <div>
265
- <span className="xynolog-resource-info-panel__label">
266
- {t('derivedFrom')}
267
- </span>
268
- <span className="xynolog-resource-info-panel__value">
269
- {(Array.isArray(wasDerivedFrom)
270
- ? wasDerivedFrom
271
- : [wasDerivedFrom]
272
- ).map((id, i) => (
273
- <DerivedFromLink
274
- key={id}
275
- session={session}
276
- id={id}
277
- first={i === 0}
278
- />
279
- ))}
280
- </span>
281
- </div>
282
- )}
283
- </div>
284
- </div>
285
- )}
286
-
287
- {/* Entity Type Tags Section */}
288
- {documentEntityTypes.length > 0 && (
289
- <div className="xynolog-resource-info-panel__section">
290
- <h3 className="xynolog-resource-info-panel__heading">
291
- {t('entityTypeTags')}
292
- </h3>
293
- <div className="xynolog-resource-info-panel__tag-list">
294
- {documentEntityTypes.map((tag) => (
295
- <span key={tag} className="xynolog-tag" data-variant="blue">
296
- {tag}
297
- </span>
298
- ))}
299
- </div>
300
- </div>
301
- )}
302
-
303
- {/* Generate — the run reports where it was started: the same DelegateShell
304
- every delegated job uses, its form the Generate control, the progress frame
305
- in its place while a generation runs. */}
306
- {onGenerate && (
307
- <DelegateShell
308
- delegateType="generation"
309
- title={t('generate')}
310
- isDelegating={isGenerating}
311
- cancelled={generationCancelled}
312
- progress={generationProgress}
313
- controls={delegatedJobControls(
314
- session,
315
- generationJobId ?? null,
316
- onDismissProgress,
317
- )}
318
- progressProps={{
319
- ...(generationOutcome
320
- ? {
321
- outcome: {
322
- label: generationOutcome.resourceName,
323
- onOpen: () =>
324
- session?.client.browse.openResource(
325
- generationOutcome.resourceId,
326
- ),
327
- },
328
- // The terminal sentence derives from the OUTCOME, not the final
329
- // progress frame — whose fire-and-forget emit can lose the race
330
- // with job:complete and leave "creating…" beside a ✅.
331
- endedMessage: generationOutcome.truncated
332
- ? ta('codeCompleteGeneratedTruncated')
333
- : ta('codeCompleteGenerated'),
334
- }
335
- : {}),
336
- translations: delegateProgressTranslations(ta),
337
- }}
338
- form={
339
- <>
340
- <button
341
- onClick={onGenerate}
342
- className="xynolog-resource-button xynolog-resource-button--secondary"
343
- >
344
- ✨ {t('generate')}
345
- </button>
346
- <p className="xynolog-resource-info-panel__description">
347
- {t('generateDescription')}
348
- </p>
349
- </>
350
- }
351
- />
352
- )}
353
-
354
- {/* Clone Action */}
355
- <div className="xynolog-resource-info-panel__action-section">
356
- <button
357
- onClick={() => session?.client.yield.clone()}
358
- className="xynolog-resource-button xynolog-resource-button--secondary"
359
- >
360
- 🔗 {t('clone')}
361
- </button>
362
- <p className="xynolog-resource-info-panel__description">
363
- {t('cloneDescription')}
364
- </p>
365
- </div>
366
-
367
- {/* Archive/Unarchive Actions */}
368
- <div className="xynolog-resource-info-panel__action-section">
369
- {isArchived ? (
370
- <>
371
- <button
372
- onClick={() => session?.client.mark.unarchive(resourceId)}
373
- className="xynolog-resource-button xynolog-resource-button--secondary"
374
- >
375
- 📤 {t('unarchive')}
376
- </button>
377
- <p className="xynolog-resource-info-panel__description">
378
- {t('unarchiveDescription')}
379
- </p>
380
- </>
381
- ) : (
382
- <>
383
- <button
384
- onClick={() => session?.client.mark.archive(resourceId)}
385
- className="xynolog-resource-button xynolog-resource-button--archive"
386
- >
387
- 📦 {t('archive')}
388
- </button>
389
- <p className="xynolog-resource-info-panel__description">
390
- {t('archiveDescription')}
391
- </p>
392
- </>
393
- )}
394
- </div>
395
- </div>
396
- );
397
- }
398
-
399
- /**
400
- * One derived-from entry: linked by id (wire identity), labeled by the source
401
- * resource's NAME once `browse.resource` serves its descriptor. The raw id is
402
- * the honest label until then — and stays if the descriptor never resolves
403
- * (deleted source, no session). Own component because the id list maps in a
404
- * loop and the subscription is a hook.
405
- *
406
- * @emits browse:resource-open - Open the source resource. Payload: { resourceId: string }
407
- */
408
- function DerivedFromLink({
409
- session,
410
- id,
411
- first,
412
- }: {
413
- session: XynologSession | null;
414
- id: ResourceId;
415
- first: boolean;
416
- }) {
417
- // `browse.resource` is stable per id (cache + scope wrappers memoize), so
418
- // subscribing straight off the render read is safe; `failed` is an emission,
419
- // never a stream error, so `readyValue` covers every unresolved state.
420
- const descriptor = useObservable(
421
- session ? session.client.browse.resource(id) : null,
422
- );
423
- const name = descriptor ? readyValue(descriptor)?.name : undefined;
424
- return (
425
- <button
426
- className="xynolog-resource-info-panel__link"
427
- onClick={() => session?.client.browse.openResource(id)}
428
- >
429
- {!first && ', '}
430
- {name ?? id}
431
- </button>
432
- );
433
- }
@@ -1,145 +0,0 @@
1
- 'use client';
2
-
3
- import { useTranslations } from '../../../contexts/TranslationContext';
4
- import { isBodyResolved } from '@xynolog/core';
5
- import { getEntityTypes } from '@xynolog/core';
6
- import './StatisticsPanel.css';
7
-
8
- import type { Annotation } from '@xynolog/core';
9
-
10
- interface StatisticsPanelProps {
11
- highlights: Annotation[];
12
- comments: Annotation[];
13
- assessments: Annotation[];
14
- references: Annotation[];
15
- tags: Annotation[];
16
- }
17
-
18
- export function StatisticsPanel({
19
- highlights,
20
- comments,
21
- assessments,
22
- references,
23
- tags,
24
- }: StatisticsPanelProps) {
25
- const t = useTranslations('StatisticsPanel');
26
-
27
- // Count stub vs resolved references
28
- const stubCount = references.filter((r) => !isBodyResolved(r.body)).length;
29
- const resolvedCount = references.filter((r) => isBodyResolved(r.body)).length;
30
-
31
- // Count entity types from references (at annotation level)
32
- const entityTypeCounts = new Map<string, number>();
33
- references.forEach((ref) => {
34
- const entityTypes = getEntityTypes(ref);
35
- entityTypes.forEach((type: string) => {
36
- entityTypeCounts.set(type, (entityTypeCounts.get(type) || 0) + 1);
37
- });
38
- });
39
-
40
- const entityTypesList = Array.from(entityTypeCounts.entries()).sort(
41
- (a, b) => b[1] - a[1],
42
- ); // Sort by count descending
43
-
44
- return (
45
- <div className="xynolog-statistics-panel">
46
- <div className="xynolog-statistics-panel__content">
47
- <h2 className="xynolog-statistics-panel__title">{t('title')}</h2>
48
-
49
- <div className="xynolog-statistics-panel__list">
50
- {/* Highlights */}
51
- <div className="xynolog-statistics-panel__item">
52
- <span className="xynolog-statistics-panel__label">
53
- {t('highlights')}
54
- </span>
55
- <span className="xynolog-statistics-panel__value">
56
- {highlights.length}
57
- </span>
58
- </div>
59
-
60
- {/* Comments */}
61
- <div className="xynolog-statistics-panel__item">
62
- <span className="xynolog-statistics-panel__label">
63
- {t('comments')}
64
- </span>
65
- <span className="xynolog-statistics-panel__value">
66
- {comments.length}
67
- </span>
68
- </div>
69
-
70
- {/* Assessments */}
71
- <div className="xynolog-statistics-panel__item">
72
- <span className="xynolog-statistics-panel__label">
73
- {t('assessments')}
74
- </span>
75
- <span className="xynolog-statistics-panel__value">
76
- {assessments.length}
77
- </span>
78
- </div>
79
-
80
- {/* Tags */}
81
- <div className="xynolog-statistics-panel__item">
82
- <span className="xynolog-statistics-panel__label">{t('tags')}</span>
83
- <span className="xynolog-statistics-panel__value">
84
- {tags.length}
85
- </span>
86
- </div>
87
-
88
- {/* References */}
89
- <div className="xynolog-statistics-panel__item">
90
- <span className="xynolog-statistics-panel__label">
91
- {t('references')}
92
- </span>
93
- <span className="xynolog-statistics-panel__value">
94
- {references.length}
95
- </span>
96
-
97
- {/* Sub-categories indented */}
98
- <div className="xynolog-statistics-panel__subitems">
99
- <div className="xynolog-statistics-panel__subitem">
100
- <span className="xynolog-statistics-panel__sublabel">
101
- {t('stub')}
102
- </span>
103
- <span className="xynolog-statistics-panel__subvalue">
104
- {stubCount}
105
- </span>
106
- </div>
107
- <div className="xynolog-statistics-panel__subitem">
108
- <span className="xynolog-statistics-panel__sublabel">
109
- {t('resolved')}
110
- </span>
111
- <span className="xynolog-statistics-panel__subvalue">
112
- {resolvedCount}
113
- </span>
114
- </div>
115
- </div>
116
- </div>
117
-
118
- {/* Entity Types */}
119
- {entityTypesList.length > 0 && (
120
- <div className="xynolog-statistics-panel__entity-types">
121
- <span className="xynolog-statistics-panel__label">
122
- {t('entityTypes')}
123
- </span>
124
- <div className="xynolog-statistics-panel__entity-list">
125
- {entityTypesList.map(([type, count]) => (
126
- <div
127
- key={type}
128
- className="xynolog-statistics-panel__entity-item"
129
- >
130
- <span className="xynolog-statistics-panel__entity-name">
131
- {type}
132
- </span>
133
- <span className="xynolog-tag" data-variant="blue">
134
- {count}
135
- </span>
136
- </div>
137
- ))}
138
- </div>
139
- </div>
140
- )}
141
- </div>
142
- </div>
143
- </div>
144
- );
145
- }
@@ -1,87 +0,0 @@
1
- 'use client';
2
-
3
- import { useMemo } from 'react';
4
- import { isReady } from '@xynolog/sdk';
5
- import type { Ref } from 'react';
6
- import type { Annotation } from '@xynolog/core';
7
- import { getAnnotationExactText } from '@xynolog/core';
8
- import { getTagCategory, getTagSchemaId } from '@xynolog/core';
9
- import { useObservable } from '../../../hooks/useObservable';
10
- import type { XynologSession } from '@xynolog/sdk';
11
- import { useHoverEmitter } from '../../../hooks/useHoverEmitter';
12
- import { renderAgentLabels } from './agent-label';
13
-
14
- interface TagEntryProps {
15
- /** Session for interaction routing (browse.click, tag schemas); the panel threads it. */
16
- session: XynologSession | null;
17
- tag: Annotation;
18
- isFocused: boolean;
19
- isHovered?: boolean;
20
- ref?: Ref<HTMLDivElement>;
21
- }
22
-
23
- /**
24
- * @emits browse:click - This entry clicked. Payload: { annotationId: string }
25
- */
26
- export function TagEntry({
27
- session,
28
- tag,
29
- isFocused,
30
- isHovered = false,
31
- ref,
32
- }: TagEntryProps) {
33
- const hoverProps = useHoverEmitter(session, tag.id);
34
-
35
- const selectedText = getAnnotationExactText(tag);
36
- const category = getTagCategory(tag);
37
- const schemaId = getTagSchemaId(tag);
38
-
39
- // Resolve the schema's display name from the per-KB tag-schema registry.
40
- // The registry is runtime-populated (frame.addTagSchema); during the
41
- // initial fetch the observable yields `undefined`, which we treat as
42
- // "no schema name available yet" — render the category badge alone
43
- // until the registry resolves.
44
- const tagSchemas$ = useMemo(
45
- () => session?.client.browse.tagSchemas() ?? null,
46
- [session],
47
- );
48
- const schemas = useObservable(tagSchemas$);
49
- const schema =
50
- schemaId && schemas && isReady(schemas)
51
- ? (schemas.value.find((s) => s.id === schemaId) ?? null)
52
- : null;
53
-
54
- return (
55
- <div
56
- ref={ref}
57
- onClick={() => {
58
- session?.client.browse.click(tag.id);
59
- }}
60
- {...hoverProps}
61
- className={`xynolog-annotation-entry${isHovered ? ' xynolog-annotation-pulse' : ''}`}
62
- data-type="tag"
63
- data-focused={isFocused ? 'true' : 'false'}
64
- >
65
- {/* Category badge */}
66
- <div className="xynolog-annotation-entry__header">
67
- <span className="xynolog-tag-badge" data-variant="tag">
68
- {category}
69
- </span>
70
- {schema && (
71
- <span className="xynolog-annotation-entry__meta">{schema.name}</span>
72
- )}
73
- </div>
74
-
75
- {/* Selected text */}
76
- <div className="xynolog-annotation-entry__quote" data-type="tag">
77
- "{selectedText.substring(0, 150)}
78
- {selectedText.length > 150 ? '...' : ''}"
79
- </div>
80
- {tag.generator && renderAgentLabels(tag.generator) && (
81
- <div className="xynolog-annotation-entry__metadata">
82
- Via {renderAgentLabels(tag.generator)}
83
- </div>
84
- )}
85
- </div>
86
- );
87
- }