@semiont/react-ui 0.2.28-build.40
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/README.md +287 -0
- package/dist/TranslationManager-Co_5fSxl.d.mts +118 -0
- package/dist/ar-TQSFB35U.mjs +325 -0
- package/dist/ar-TQSFB35U.mjs.map +1 -0
- package/dist/bn-525U24T3.mjs +325 -0
- package/dist/bn-525U24T3.mjs.map +1 -0
- package/dist/chunk-3JTO27MH.mjs +50 -0
- package/dist/chunk-3JTO27MH.mjs.map +1 -0
- package/dist/chunk-BHAP6MVA.mjs +325 -0
- package/dist/chunk-BHAP6MVA.mjs.map +1 -0
- package/dist/chunk-W6E2UESX.mjs +387 -0
- package/dist/chunk-W6E2UESX.mjs.map +1 -0
- package/dist/cs-OYWTGLFM.mjs +325 -0
- package/dist/cs-OYWTGLFM.mjs.map +1 -0
- package/dist/da-BDXG2ITK.mjs +325 -0
- package/dist/da-BDXG2ITK.mjs.map +1 -0
- package/dist/de-NB5JLMES.mjs +325 -0
- package/dist/de-NB5JLMES.mjs.map +1 -0
- package/dist/el-3SVXEAJI.mjs +325 -0
- package/dist/el-3SVXEAJI.mjs.map +1 -0
- package/dist/en-DVB4OE2R.mjs +39 -0
- package/dist/en-DVB4OE2R.mjs.map +1 -0
- package/dist/es-YBOFA3W5.mjs +325 -0
- package/dist/es-YBOFA3W5.mjs.map +1 -0
- package/dist/fa-7MU36AMY.mjs +325 -0
- package/dist/fa-7MU36AMY.mjs.map +1 -0
- package/dist/fi-PQKJB32G.mjs +325 -0
- package/dist/fi-PQKJB32G.mjs.map +1 -0
- package/dist/fr-U4HK5GM6.mjs +325 -0
- package/dist/fr-U4HK5GM6.mjs.map +1 -0
- package/dist/he-F5MNZHAL.mjs +325 -0
- package/dist/he-F5MNZHAL.mjs.map +1 -0
- package/dist/hi-2PHI37ZX.mjs +325 -0
- package/dist/hi-2PHI37ZX.mjs.map +1 -0
- package/dist/id-JPRBNCGS.mjs +325 -0
- package/dist/id-JPRBNCGS.mjs.map +1 -0
- package/dist/index.d.mts +3003 -0
- package/dist/index.mjs +51026 -0
- package/dist/index.mjs.map +1 -0
- package/dist/it-MRLWI5OS.mjs +325 -0
- package/dist/it-MRLWI5OS.mjs.map +1 -0
- package/dist/ja-YQ6RPI2T.mjs +325 -0
- package/dist/ja-YQ6RPI2T.mjs.map +1 -0
- package/dist/ko-DUAVCEXX.mjs +325 -0
- package/dist/ko-DUAVCEXX.mjs.map +1 -0
- package/dist/magic-string.es-7FJ3LUGB.mjs +1310 -0
- package/dist/magic-string.es-7FJ3LUGB.mjs.map +1 -0
- package/dist/ms-FBHSR4PG.mjs +325 -0
- package/dist/ms-FBHSR4PG.mjs.map +1 -0
- package/dist/nl-IC2MPZXN.mjs +325 -0
- package/dist/nl-IC2MPZXN.mjs.map +1 -0
- package/dist/no-LLD43NRM.mjs +325 -0
- package/dist/no-LLD43NRM.mjs.map +1 -0
- package/dist/pl-DDOJBR4D.mjs +325 -0
- package/dist/pl-DDOJBR4D.mjs.map +1 -0
- package/dist/pt-7TFHQRRN.mjs +325 -0
- package/dist/pt-7TFHQRRN.mjs.map +1 -0
- package/dist/ro-P4PJEGDU.mjs +325 -0
- package/dist/ro-P4PJEGDU.mjs.map +1 -0
- package/dist/sv-LF3VEQD2.mjs +325 -0
- package/dist/sv-LF3VEQD2.mjs.map +1 -0
- package/dist/test-utils.d.mts +104 -0
- package/dist/test-utils.mjs +34240 -0
- package/dist/test-utils.mjs.map +1 -0
- package/dist/th-YUQAOFXF.mjs +325 -0
- package/dist/th-YUQAOFXF.mjs.map +1 -0
- package/dist/tr-CSIGLMJC.mjs +325 -0
- package/dist/tr-CSIGLMJC.mjs.map +1 -0
- package/dist/uk-LW3QBKSR.mjs +325 -0
- package/dist/uk-LW3QBKSR.mjs.map +1 -0
- package/dist/vi-W464Y6ZC.mjs +325 -0
- package/dist/vi-W464Y6ZC.mjs.map +1 -0
- package/dist/zh-R5XLM3EI.mjs +325 -0
- package/dist/zh-R5XLM3EI.mjs.map +1 -0
- package/package.json +62 -0
- package/translations/ar.json +287 -0
- package/translations/bn.json +287 -0
- package/translations/cs.json +287 -0
- package/translations/da.json +287 -0
- package/translations/de.json +287 -0
- package/translations/el.json +287 -0
- package/translations/en.json +287 -0
- package/translations/es.json +287 -0
- package/translations/fa.json +287 -0
- package/translations/fi.json +287 -0
- package/translations/fr.json +287 -0
- package/translations/he.json +287 -0
- package/translations/hi.json +287 -0
- package/translations/id.json +287 -0
- package/translations/it.json +287 -0
- package/translations/ja.json +287 -0
- package/translations/ko.json +287 -0
- package/translations/ms.json +287 -0
- package/translations/nl.json +287 -0
- package/translations/no.json +287 -0
- package/translations/pl.json +287 -0
- package/translations/pt.json +287 -0
- package/translations/ro.json +287 -0
- package/translations/sv.json +287 -0
- package/translations/th.json +287 -0
- package/translations/tr.json +287 -0
- package/translations/uk.json +287 -0
- package/translations/vi.json +287 -0
- package/translations/zh.json +287 -0
package/README.md
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# @semiont/react-ui
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@semiont/react-ui)
|
|
4
|
+
[](https://github.com/The-AI-Alliance/semiont/actions/workflows/package-tests.yml?query=branch%3Amain+is%3Asuccess+job%3A%22Test+react-ui%22)
|
|
5
|
+
[](https://github.com/The-AI-Alliance/semiont/actions/workflows/accessibility-tests.yml)
|
|
6
|
+
[](https://www.w3.org/WAI/WCAG2AA-Conformance)
|
|
7
|
+
|
|
8
|
+
Framework-agnostic React component library for building Semiont knowledge management applications.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
`@semiont/react-ui` provides reusable React components, hooks, and utilities for creating Semiont applications. The library is designed to be **completely framework-agnostic**, working seamlessly with Next.js, Create React App, Vite, Remix, or any other React framework.
|
|
13
|
+
|
|
14
|
+
## Key Features
|
|
15
|
+
|
|
16
|
+
- **Framework Independence** - Zero dependencies on Next.js, next-auth, or next-intl
|
|
17
|
+
- **Component Composition** - Components accept framework-specific implementations (Link, routing) as props
|
|
18
|
+
- **Provider Pattern** - Consistent approach for session, translations, API client, and routing
|
|
19
|
+
- **Type-Safe API Hooks** - React Query wrappers for all Semiont API operations
|
|
20
|
+
- **Authentication Components** - Sign-in, sign-up, and error display components
|
|
21
|
+
- **Accessibility First** - WCAG compliant with keyboard navigation, screen reader support
|
|
22
|
+
- **Comprehensive Testing** - 1250+ tests with extensive coverage
|
|
23
|
+
- **Annotation System** - Rich annotation and tagging capabilities
|
|
24
|
+
- **Built-in Translations** - English and Spanish included, with dynamic loading for optimal bundle size
|
|
25
|
+
- **Flexible i18n** - Three modes: default English, built-in locales, or custom translation system
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @semiont/react-ui @semiont/api-client @tanstack/react-query
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Peer Dependencies
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"react": "^18.0.0",
|
|
38
|
+
"react-dom": "^18.0.0",
|
|
39
|
+
"@tanstack/react-query": "^5.0.0",
|
|
40
|
+
"@semiont/api-client": "*"
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
### 1. Set Up Providers
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import {
|
|
50
|
+
TranslationProvider,
|
|
51
|
+
ApiClientProvider,
|
|
52
|
+
SessionProvider,
|
|
53
|
+
} from '@semiont/react-ui';
|
|
54
|
+
import { QueryClientProvider } from '@tanstack/react-query';
|
|
55
|
+
|
|
56
|
+
function App({ children }) {
|
|
57
|
+
const translationManager = useTranslationManager(); // Your implementation
|
|
58
|
+
const apiClientManager = useApiClientManager(); // Your implementation
|
|
59
|
+
const sessionManager = useSessionManager(); // Your implementation
|
|
60
|
+
const queryClient = new QueryClient();
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<SessionProvider sessionManager={sessionManager}>
|
|
64
|
+
<TranslationProvider translationManager={translationManager}>
|
|
65
|
+
<ApiClientProvider apiClientManager={apiClientManager}>
|
|
66
|
+
<QueryClientProvider client={queryClient}>
|
|
67
|
+
{children}
|
|
68
|
+
</QueryClientProvider>
|
|
69
|
+
</ApiClientProvider>
|
|
70
|
+
</TranslationProvider>
|
|
71
|
+
</SessionProvider>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 2. Use Components
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
import { ResourceViewer, useResources } from '@semiont/react-ui';
|
|
80
|
+
|
|
81
|
+
function MyComponent() {
|
|
82
|
+
const resources = useResources();
|
|
83
|
+
const { data, isLoading } = resources.list.useQuery();
|
|
84
|
+
|
|
85
|
+
if (isLoading) return <div>Loading...</div>;
|
|
86
|
+
|
|
87
|
+
return <ResourceViewer resource={data[0]} />;
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 3. Use Translations
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { useTranslations } from '@semiont/react-ui';
|
|
95
|
+
|
|
96
|
+
// Option 1: Default English (no provider needed)
|
|
97
|
+
function Toolbar() {
|
|
98
|
+
const t = useTranslations('Toolbar');
|
|
99
|
+
return <button>{t('save')}</button>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Option 2: Built-in locales
|
|
103
|
+
import { TranslationProvider } from '@semiont/react-ui';
|
|
104
|
+
|
|
105
|
+
function App() {
|
|
106
|
+
return (
|
|
107
|
+
<TranslationProvider locale="es">
|
|
108
|
+
<Toolbar />
|
|
109
|
+
</TranslationProvider>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Option 3: Custom translation system
|
|
114
|
+
const myTranslationManager = {
|
|
115
|
+
t: (namespace, key, params) => myI18n.translate(`${namespace}.${key}`, params)
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
function App() {
|
|
119
|
+
return (
|
|
120
|
+
<TranslationProvider translationManager={myTranslationManager}>
|
|
121
|
+
<Toolbar />
|
|
122
|
+
</TranslationProvider>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Architecture
|
|
128
|
+
|
|
129
|
+
The library follows strict architectural principles:
|
|
130
|
+
|
|
131
|
+
- **No Aliasing or Wrappers** - Direct API access, no compatibility layers
|
|
132
|
+
- **Provider Pattern** - Consistent dependency injection via React Context
|
|
133
|
+
- **Framework Agnostic** - Apps provide framework-specific implementations
|
|
134
|
+
- **TypeScript First** - Full type safety throughout
|
|
135
|
+
|
|
136
|
+
## Core Concepts
|
|
137
|
+
|
|
138
|
+
### Providers
|
|
139
|
+
|
|
140
|
+
All cross-cutting concerns use the Provider Pattern:
|
|
141
|
+
|
|
142
|
+
- **SessionProvider** - Authentication state management
|
|
143
|
+
- **TranslationProvider** - Internationalization
|
|
144
|
+
- **ApiClientProvider** - Authenticated API client
|
|
145
|
+
- **OpenResourcesProvider** - Recently opened resources
|
|
146
|
+
- **RoutingContext** - Framework-agnostic navigation
|
|
147
|
+
|
|
148
|
+
See [docs/PROVIDERS.md](docs/PROVIDERS.md) for details.
|
|
149
|
+
|
|
150
|
+
### API Integration
|
|
151
|
+
|
|
152
|
+
React Query hooks for all API operations:
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
import { useResources, useAnnotations, useEntityTypes } from '@semiont/react-ui';
|
|
156
|
+
|
|
157
|
+
// List resources
|
|
158
|
+
const resources = useResources();
|
|
159
|
+
const { data } = resources.list.useQuery({ limit: 10 });
|
|
160
|
+
|
|
161
|
+
// Create annotation
|
|
162
|
+
const annotations = useAnnotations();
|
|
163
|
+
const { mutate } = annotations.create.useMutation();
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
See [docs/API-INTEGRATION.md](docs/API-INTEGRATION.md) for details.
|
|
167
|
+
|
|
168
|
+
### Testing
|
|
169
|
+
|
|
170
|
+
Comprehensive test utilities included:
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
import { renderWithProviders } from '@semiont/react-ui/test-utils';
|
|
174
|
+
|
|
175
|
+
it('should render component', () => {
|
|
176
|
+
renderWithProviders(<MyComponent />);
|
|
177
|
+
expect(screen.getByText('Hello')).toBeInTheDocument();
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
See [docs/TESTING.md](docs/TESTING.md) for details.
|
|
182
|
+
|
|
183
|
+
## Documentation
|
|
184
|
+
|
|
185
|
+
- [PROVIDERS.md](docs/PROVIDERS.md) - Provider Pattern and manager interfaces
|
|
186
|
+
- [INTERNATIONALIZATION.md](docs/INTERNATIONALIZATION.md) - Translation approach
|
|
187
|
+
- [TESTING.md](docs/TESTING.md) - Testing utilities and patterns
|
|
188
|
+
- [API-INTEGRATION.md](docs/API-INTEGRATION.md) - Working with the Semiont API
|
|
189
|
+
- [COMPONENTS.md](docs/COMPONENTS.md) - Component library reference
|
|
190
|
+
- [ROUTING.md](docs/ROUTING.md) - Framework-agnostic routing
|
|
191
|
+
- [ARCHITECTURE.md](docs/ARCHITECTURE.md) - Design principles and decisions
|
|
192
|
+
- [ANNOTATIONS.md](docs/ANNOTATIONS.md) - Annotation system (coming soon)
|
|
193
|
+
|
|
194
|
+
## Examples
|
|
195
|
+
|
|
196
|
+
### Next.js Integration
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
// app/providers.tsx
|
|
200
|
+
'use client';
|
|
201
|
+
|
|
202
|
+
import { useSession } from 'next-auth/react';
|
|
203
|
+
import { useLocale } from 'next-intl';
|
|
204
|
+
import { SemiontApiClient } from '@semiont/api-client';
|
|
205
|
+
import { TranslationProvider, ApiClientProvider } from '@semiont/react-ui';
|
|
206
|
+
|
|
207
|
+
export function useTranslationManager() {
|
|
208
|
+
const locale = useLocale();
|
|
209
|
+
const messages = require(`@/messages/${locale}.json`);
|
|
210
|
+
|
|
211
|
+
return {
|
|
212
|
+
t: (namespace, key) => messages[namespace]?.[key] || key
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function useApiClientManager() {
|
|
217
|
+
const { data: session } = useSession();
|
|
218
|
+
|
|
219
|
+
return {
|
|
220
|
+
client: session?.backendToken
|
|
221
|
+
? new SemiontApiClient({ accessToken: session.backendToken })
|
|
222
|
+
: null
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Vite Integration
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
// src/App.tsx
|
|
231
|
+
import { useState } from 'react';
|
|
232
|
+
import { TranslationProvider } from '@semiont/react-ui';
|
|
233
|
+
|
|
234
|
+
function useTranslationManager() {
|
|
235
|
+
const [locale] = useState('en');
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
t: (namespace, key) => `${namespace}.${key}` // Your i18n library
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function App() {
|
|
243
|
+
const translationManager = useTranslationManager();
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<TranslationProvider translationManager={translationManager}>
|
|
247
|
+
{/* Your app */}
|
|
248
|
+
</TranslationProvider>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Development
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Run tests
|
|
257
|
+
npm test
|
|
258
|
+
|
|
259
|
+
# Run tests in watch mode
|
|
260
|
+
npm run test:watch
|
|
261
|
+
|
|
262
|
+
# Run tests with coverage
|
|
263
|
+
npm run test:coverage
|
|
264
|
+
|
|
265
|
+
# Type checking
|
|
266
|
+
npm run typecheck
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Contributing
|
|
270
|
+
|
|
271
|
+
This library follows strict quality standards:
|
|
272
|
+
|
|
273
|
+
- **100% TypeScript** - All code must be properly typed
|
|
274
|
+
- **No `any` casts** - Without explicit permission
|
|
275
|
+
- **No cruft** - Delete dead code immediately, no "legacy" patterns
|
|
276
|
+
- **Direct fixes** - If something is wrong, fix it directly (no aliases/wrappers)
|
|
277
|
+
|
|
278
|
+
See [CLAUDE.md](../../CLAUDE.md) in the repository root for full guidelines.
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
[License information to be added]
|
|
283
|
+
|
|
284
|
+
## Related Packages
|
|
285
|
+
|
|
286
|
+
- [@semiont/api-client](../api-client) - TypeScript client for Semiont API
|
|
287
|
+
- [semiont-frontend](../../apps/frontend) - Reference Next.js implementation
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { SemiontApiClient } from '@semiont/api-client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* API client management interface
|
|
5
|
+
* Apps implement this to provide API client instances based on authentication state
|
|
6
|
+
*/
|
|
7
|
+
interface ApiClientManager {
|
|
8
|
+
/**
|
|
9
|
+
* API client instance
|
|
10
|
+
* null when user is not authenticated or session is invalid
|
|
11
|
+
*/
|
|
12
|
+
client: SemiontApiClient | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Open Resources Manager Interface
|
|
17
|
+
*
|
|
18
|
+
* Manages a list of open resources (documents/files) with persistence.
|
|
19
|
+
* This interface allows apps to provide their own implementation of resource management
|
|
20
|
+
* (localStorage, sessionStorage, database, etc.) while components remain framework-agnostic.
|
|
21
|
+
*
|
|
22
|
+
* Components accept this manager as a prop instead of consuming from Context.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // In app (e.g., frontend/src/hooks/useOpenResourcesManager.ts)
|
|
27
|
+
* export function useOpenResourcesManager(): OpenResourcesManager {
|
|
28
|
+
* const [openResources, setOpenResources] = useState<OpenResource[]>([]);
|
|
29
|
+
*
|
|
30
|
+
* // Implementation details...
|
|
31
|
+
*
|
|
32
|
+
* return {
|
|
33
|
+
* openResources,
|
|
34
|
+
* addResource,
|
|
35
|
+
* removeResource,
|
|
36
|
+
* updateResourceName,
|
|
37
|
+
* reorderResources
|
|
38
|
+
* };
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* // Pass to components as props
|
|
42
|
+
* <KnowledgeNavigation openResourcesManager={openResourcesManager} />
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
interface OpenResource {
|
|
46
|
+
/** Unique identifier for the resource */
|
|
47
|
+
id: string;
|
|
48
|
+
/** Display name of the resource */
|
|
49
|
+
name: string;
|
|
50
|
+
/** Timestamp when the resource was opened */
|
|
51
|
+
openedAt: number;
|
|
52
|
+
/** Order/position for manual sorting (optional for backward compatibility) */
|
|
53
|
+
order?: number;
|
|
54
|
+
/** Media type for icon display (e.g., 'application/pdf', 'text/plain') */
|
|
55
|
+
mediaType?: string;
|
|
56
|
+
}
|
|
57
|
+
interface OpenResourcesManager {
|
|
58
|
+
/** List of currently open resources */
|
|
59
|
+
openResources: OpenResource[];
|
|
60
|
+
/**
|
|
61
|
+
* Add a new resource to the open list or update if already exists
|
|
62
|
+
* @param id - Unique resource identifier
|
|
63
|
+
* @param name - Display name of the resource
|
|
64
|
+
* @param mediaType - Optional media type for icon display
|
|
65
|
+
*/
|
|
66
|
+
addResource: (id: string, name: string, mediaType?: string) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove a resource from the open list
|
|
69
|
+
* @param id - Resource identifier to remove
|
|
70
|
+
*/
|
|
71
|
+
removeResource: (id: string) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Update the display name of an open resource
|
|
74
|
+
* @param id - Resource identifier
|
|
75
|
+
* @param name - New display name
|
|
76
|
+
*/
|
|
77
|
+
updateResourceName: (id: string, name: string) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Reorder resources by moving from one index to another
|
|
80
|
+
* @param oldIndex - Current position index
|
|
81
|
+
* @param newIndex - Desired position index
|
|
82
|
+
*/
|
|
83
|
+
reorderResources: (oldIndex: number, newIndex: number) => void;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Session management interface for handling authentication state and session expiry
|
|
88
|
+
* Apps implement this interface and pass it to SessionProvider
|
|
89
|
+
*/
|
|
90
|
+
interface SessionState {
|
|
91
|
+
/** Whether the user is currently authenticated */
|
|
92
|
+
isAuthenticated: boolean;
|
|
93
|
+
/** When the session expires (null if not authenticated) */
|
|
94
|
+
expiresAt: Date | null;
|
|
95
|
+
/** Time in milliseconds until session expires (null if not authenticated) */
|
|
96
|
+
timeUntilExpiry: number | null;
|
|
97
|
+
/** Whether the session is expiring soon (< 5 minutes) */
|
|
98
|
+
isExpiringSoon: boolean;
|
|
99
|
+
}
|
|
100
|
+
interface SessionManager extends SessionState {
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Translation management interface
|
|
105
|
+
* Apps implement this to provide translations using their preferred i18n library
|
|
106
|
+
*/
|
|
107
|
+
interface TranslationManager {
|
|
108
|
+
/**
|
|
109
|
+
* Translate a key within a namespace
|
|
110
|
+
* @param namespace - Translation namespace (e.g., 'Toolbar', 'ResourceViewer')
|
|
111
|
+
* @param key - Translation key within the namespace
|
|
112
|
+
* @param params - Optional parameters for interpolation
|
|
113
|
+
* @returns Translated string
|
|
114
|
+
*/
|
|
115
|
+
t: (namespace: string, key: string, params?: Record<string, any>) => string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type { ApiClientManager as A, OpenResourcesManager as O, SessionManager as S, TranslationManager as T, OpenResource as a, SessionState as b };
|