@umituz/react-native-design-system 4.27.15 → 4.27.17
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/core/cache/domain/CleanupStrategy.d.ts +62 -0
- package/dist/core/cache/domain/UnifiedCache.d.ts +82 -0
- package/dist/core/cache/domain/types.d.ts +15 -0
- package/dist/core/cache/index.d.ts +13 -0
- package/dist/core/cache/infrastructure/CacheFactory.d.ts +63 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/permissions/domain/PermissionHandler.d.ts +82 -0
- package/dist/core/permissions/domain/types.d.ts +42 -0
- package/dist/core/permissions/index.d.ts +7 -0
- package/dist/core/repositories/domain/RepositoryKeyFactory.d.ts +25 -0
- package/dist/core/repositories/domain/RepositoryUtils.d.ts +39 -0
- package/dist/core/repositories/domain/types.d.ts +53 -0
- package/dist/core/repositories/index.d.ts +10 -0
- package/dist/hooks/index.d.ts +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/media/domain/strategies/CameraPickerStrategy.d.ts +25 -0
- package/dist/media/domain/strategies/LibraryPickerStrategy.d.ts +18 -0
- package/dist/media/domain/strategies/PickerStrategy.d.ts +55 -0
- package/dist/media/domain/strategies/index.d.ts +10 -0
- package/dist/media/infrastructure/services/MediaPickerService.d.ts +49 -6
- package/dist/media/infrastructure/utils/PermissionManager.d.ts +6 -0
- package/dist/media/infrastructure/utils/mediaPickerMappers.d.ts +15 -1
- package/dist/molecules/calendar/infrastructure/services/CalendarService.d.ts +1 -0
- package/dist/molecules/calendar/infrastructure/storage/CalendarStore.d.ts +2 -2
- package/dist/molecules/filter-group/FilterGroup.d.ts +1 -1
- package/dist/molecules/navigation/index.d.ts +1 -1
- package/dist/offline/index.d.ts +1 -1
- package/dist/offline/presentation/hooks/useOffline.d.ts +0 -5
- package/dist/tanstack/domain/repositories/BaseRepository.d.ts +5 -1
- package/dist/tanstack/infrastructure/monitoring/DevMonitor.d.ts +1 -0
- package/dist/utils/constants/TimeConstants.d.ts +27 -0
- package/package.json +11 -6
- package/src/atoms/GlassView/GlassView.tsx +0 -2
- package/src/atoms/picker/components/PickerChips.tsx +27 -21
- package/src/core/cache/index.ts +3 -2
- package/src/core/index.ts +5 -3
- package/src/core/repositories/domain/RepositoryUtils.ts +4 -4
- package/src/core/repositories/domain/types.ts +2 -2
- package/src/hooks/index.ts +22 -25
- package/src/image/presentation/components/ImageGallery.tsx +25 -21
- package/src/infinite-scroll/presentation/hooks/useInfiniteScroll.ts +32 -29
- package/src/media/domain/strategies/CameraPickerStrategy.ts +4 -8
- package/src/media/domain/strategies/index.ts +1 -1
- package/src/media/infrastructure/services/MediaPickerService.ts +3 -14
- package/src/media/infrastructure/utils/mediaPickerMappers.ts +29 -6
- package/src/molecules/avatar/AvatarGroup.tsx +137 -62
- package/src/molecules/filter-group/FilterGroup.tsx +31 -22
- package/src/molecules/icon-grid/IconGrid.tsx +52 -20
- package/src/molecules/swipe-actions/domain/entities/SwipeAction.ts +0 -1
- package/src/offline/index.ts +1 -1
- package/src/offline/presentation/hooks/useOffline.ts +0 -8
- package/src/onboarding/presentation/components/BackgroundImageCollage.tsx +32 -23
- package/src/storage/README.md +0 -1
- package/src/storage/cache/domain/types/README.md +0 -1
- package/src/storage/cache/presentation/README.md +0 -1
- package/src/storage/cache/presentation/useCachedValue.ts +12 -2
- package/src/storage/domain/constants/README.md +0 -1
- package/src/storage/infrastructure/adapters/README.md +0 -1
- package/src/storage/presentation/hooks/README.md +0 -6
- package/src/storage/presentation/hooks/useStorageState.ts +13 -4
- package/src/tanstack/domain/repositories/BaseRepository.ts +1 -1
- package/src/theme/hooks/useAppDesignTokens.ts +29 -3
- package/src/timezone/infrastructure/services/TimezoneProvider.ts +2 -2
- package/src/init/index.ts +0 -29
- package/src/layouts/ScreenLayout/index.ts +0 -1
- package/src/layouts/index.ts +0 -5
- package/src/molecules/SearchBar/index.ts +0 -4
- package/src/molecules/StepProgress/index.ts +0 -1
- package/src/molecules/alerts/index.ts +0 -47
- package/src/molecules/bottom-sheet/index.ts +0 -10
- package/src/molecules/circular-menu/index.ts +0 -3
- package/src/molecules/filter-group/index.ts +0 -3
- package/src/molecules/index.ts +0 -38
- package/src/molecules/info-grid/index.ts +0 -3
- package/src/molecules/swipe-actions/index.ts +0 -6
- package/src/presentation/utils/variants/index.ts +0 -6
- package/src/timezone/infrastructure/utils/SimpleCache.ts +0 -64
- package/src/utilities/index.ts +0 -6
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cleanup Strategy
|
|
3
|
+
*
|
|
4
|
+
* Strategy pattern for cache cleanup mechanisms.
|
|
5
|
+
* Allows switching between interval-based and recursive timeout-based cleanup.
|
|
6
|
+
*/
|
|
7
|
+
import type { CleanupType } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Cleanup strategy interface for cache expiration
|
|
10
|
+
*/
|
|
11
|
+
export interface CleanupStrategy {
|
|
12
|
+
/**
|
|
13
|
+
* Start cleanup mechanism
|
|
14
|
+
* @param callback - Function to call on each cleanup cycle
|
|
15
|
+
*/
|
|
16
|
+
start(callback: () => void): void;
|
|
17
|
+
/**
|
|
18
|
+
* Stop cleanup mechanism and release resources
|
|
19
|
+
*/
|
|
20
|
+
stop(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Strategy type identifier
|
|
23
|
+
*/
|
|
24
|
+
readonly type: CleanupType;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Interval-based cleanup strategy
|
|
28
|
+
* Uses setInterval for periodic cleanup
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const strategy = new IntervalCleanupStrategy(60000); // Every minute
|
|
33
|
+
* strategy.start(() => cache.cleanup());
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class IntervalCleanupStrategy implements CleanupStrategy {
|
|
37
|
+
private readonly intervalMs;
|
|
38
|
+
private interval;
|
|
39
|
+
constructor(intervalMs: number);
|
|
40
|
+
start(callback: () => void): void;
|
|
41
|
+
stop(): void;
|
|
42
|
+
get type(): 'interval';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Timeout-based cleanup strategy
|
|
46
|
+
* Uses recursive setTimeout for cleanup
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const strategy = new TimeoutCleanupStrategy(60000); // Every minute
|
|
51
|
+
* strategy.start(() => cache.cleanup());
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare class TimeoutCleanupStrategy implements CleanupStrategy {
|
|
55
|
+
private readonly timeoutMs;
|
|
56
|
+
private timeout;
|
|
57
|
+
private destroyed;
|
|
58
|
+
constructor(timeoutMs: number);
|
|
59
|
+
start(callback: () => void): void;
|
|
60
|
+
stop(): void;
|
|
61
|
+
get type(): 'timeout';
|
|
62
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Cache
|
|
3
|
+
*
|
|
4
|
+
* Generic TTL-based cache with pluggable cleanup strategy.
|
|
5
|
+
* Merges functionality from SimpleCache and TTLCache.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // With interval cleanup (like TTLCache)
|
|
10
|
+
* const cache = new UnifiedCache<string>({
|
|
11
|
+
* defaultTTL: 60000,
|
|
12
|
+
* cleanupStrategy: new IntervalCleanupStrategy(60000)
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* // With timeout cleanup (like SimpleCache)
|
|
16
|
+
* const cache = new UnifiedCache<string>({
|
|
17
|
+
* defaultTTL: 60000,
|
|
18
|
+
* cleanupStrategy: new TimeoutCleanupStrategy(60000)
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
import type { CacheEntry, CacheConfig } from './types';
|
|
23
|
+
import { CleanupStrategy } from './CleanupStrategy';
|
|
24
|
+
export interface UnifiedCacheConfig extends CacheConfig {
|
|
25
|
+
cleanupStrategy?: CleanupStrategy;
|
|
26
|
+
onExpired?: (key: string, count: number) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Unified generic cache with TTL support and pluggable cleanup
|
|
30
|
+
*/
|
|
31
|
+
export declare class UnifiedCache<T = unknown> {
|
|
32
|
+
protected cache: Map<string, CacheEntry<T>>;
|
|
33
|
+
protected defaultTTL: number;
|
|
34
|
+
private cleanupStrategy;
|
|
35
|
+
private isDestroyed;
|
|
36
|
+
private onExpiredCallback?;
|
|
37
|
+
constructor(config?: UnifiedCacheConfig);
|
|
38
|
+
/**
|
|
39
|
+
* Set value with optional TTL override
|
|
40
|
+
*/
|
|
41
|
+
set(key: string, value: T, ttl?: number): void;
|
|
42
|
+
/**
|
|
43
|
+
* Get value, returns undefined if expired or not found
|
|
44
|
+
*/
|
|
45
|
+
get(key: string): T | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Check if key exists and is not expired
|
|
48
|
+
*/
|
|
49
|
+
has(key: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Delete specific key
|
|
52
|
+
*/
|
|
53
|
+
delete(key: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Clear all entries
|
|
56
|
+
*/
|
|
57
|
+
clear(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get all non-expired keys
|
|
60
|
+
*/
|
|
61
|
+
keys(): string[];
|
|
62
|
+
/**
|
|
63
|
+
* Get cache size (excluding expired entries)
|
|
64
|
+
*/
|
|
65
|
+
size(): number;
|
|
66
|
+
/**
|
|
67
|
+
* Destroy cache and stop cleanup
|
|
68
|
+
*/
|
|
69
|
+
destroy(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Cleanup expired entries
|
|
72
|
+
*/
|
|
73
|
+
protected cleanup(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Check if entry is expired
|
|
76
|
+
*/
|
|
77
|
+
private isExpired;
|
|
78
|
+
/**
|
|
79
|
+
* Warn about operation on destroyed cache
|
|
80
|
+
*/
|
|
81
|
+
private warnDestroyed;
|
|
82
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Cache Domain Types
|
|
3
|
+
*
|
|
4
|
+
* Shared types for cache implementations
|
|
5
|
+
*/
|
|
6
|
+
export interface CacheEntry<T> {
|
|
7
|
+
value: T;
|
|
8
|
+
expires: number;
|
|
9
|
+
timestamp: number;
|
|
10
|
+
}
|
|
11
|
+
export interface CacheConfig {
|
|
12
|
+
defaultTTL?: number;
|
|
13
|
+
cleanupIntervalMs?: number;
|
|
14
|
+
}
|
|
15
|
+
export type CleanupType = 'interval' | 'timeout';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Cache Module
|
|
3
|
+
*
|
|
4
|
+
* Unified cache implementation with strategy pattern.
|
|
5
|
+
* Replaces SimpleCache and TTLCache with single implementation.
|
|
6
|
+
*/
|
|
7
|
+
export { UnifiedCache } from './domain/UnifiedCache';
|
|
8
|
+
export type { UnifiedCacheConfig } from './domain/UnifiedCache';
|
|
9
|
+
export type { CleanupStrategy } from './domain/CleanupStrategy';
|
|
10
|
+
export { IntervalCleanupStrategy, TimeoutCleanupStrategy } from './domain/CleanupStrategy';
|
|
11
|
+
export type { CleanupType } from './domain/types';
|
|
12
|
+
export { CacheFactory } from './infrastructure/CacheFactory';
|
|
13
|
+
export type { CacheEntry, CacheConfig } from './domain/types';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache Factory
|
|
3
|
+
*
|
|
4
|
+
* Factory for creating cache instances with common configurations.
|
|
5
|
+
* Provides convenient methods for different cache types.
|
|
6
|
+
*/
|
|
7
|
+
import { UnifiedCache } from '../domain/UnifiedCache';
|
|
8
|
+
import type { UnifiedCacheConfig } from '../domain/UnifiedCache';
|
|
9
|
+
/**
|
|
10
|
+
* Factory for creating cache instances
|
|
11
|
+
*/
|
|
12
|
+
export declare class CacheFactory {
|
|
13
|
+
/**
|
|
14
|
+
* Create cache with interval-based cleanup (like TTLCache)
|
|
15
|
+
*
|
|
16
|
+
* @param defaultTTL - Default time-to-live in milliseconds
|
|
17
|
+
* @param cleanupInterval - Cleanup interval in milliseconds
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const cache = CacheFactory.createIntervalCache(60000, 60000);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
static createIntervalCache<T = unknown>(defaultTTL?: number, cleanupInterval?: number): UnifiedCache<T>;
|
|
25
|
+
/**
|
|
26
|
+
* Create cache with timeout-based cleanup (like SimpleCache)
|
|
27
|
+
*
|
|
28
|
+
* @param defaultTTL - Default time-to-live in milliseconds
|
|
29
|
+
* @param cleanupTimeout - Cleanup timeout in milliseconds
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const cache = CacheFactory.createTimeoutCache(60000, 60000);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
static createTimeoutCache<T = unknown>(defaultTTL?: number, cleanupTimeout?: number): UnifiedCache<T>;
|
|
37
|
+
/**
|
|
38
|
+
* Create cache with custom configuration
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const cache = CacheFactory.createCustomCache({
|
|
43
|
+
* defaultTTL: 120000,
|
|
44
|
+
* cleanupStrategy: new IntervalCleanupStrategy(30000),
|
|
45
|
+
* onExpired: (key, count) => console.log(`Expired ${count} items`)
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
static createCustomCache<T = unknown>(config: UnifiedCacheConfig): UnifiedCache<T>;
|
|
50
|
+
/**
|
|
51
|
+
* Create cache without automatic cleanup (manual cleanup only)
|
|
52
|
+
*
|
|
53
|
+
* @param defaultTTL - Default time-to-live in milliseconds
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const cache = CacheFactory.createManualCache(60000);
|
|
58
|
+
* // ... later
|
|
59
|
+
* cache.cleanup(); // Manual cleanup
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
static createManualCache<T = unknown>(defaultTTL?: number): UnifiedCache<T>;
|
|
63
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Module
|
|
3
|
+
*
|
|
4
|
+
* Shared abstractions and utilities for the design system.
|
|
5
|
+
* Provides cache, permissions, errors, and repository foundations.
|
|
6
|
+
*/
|
|
7
|
+
export { UnifiedCache } from './cache/domain/UnifiedCache';
|
|
8
|
+
export { CacheFactory } from './cache/infrastructure/CacheFactory';
|
|
9
|
+
export type { CleanupStrategy } from './cache/domain/CleanupStrategy';
|
|
10
|
+
export { IntervalCleanupStrategy, TimeoutCleanupStrategy } from './cache/domain/CleanupStrategy';
|
|
11
|
+
export type { UnifiedCacheConfig } from './cache/domain/UnifiedCache';
|
|
12
|
+
export type { CacheEntry, CacheConfig, CleanupType } from './cache/domain/types';
|
|
13
|
+
export { PermissionHandler } from './permissions/domain/PermissionHandler';
|
|
14
|
+
export type { PermissionMethod, PermissionStatus, PermissionResult, PermissionHandlerConfig, PermissionMethods } from './permissions/domain/types';
|
|
15
|
+
export { createRepositoryKeyFactory } from './repositories/domain/RepositoryKeyFactory';
|
|
16
|
+
export { mergeRepositoryOptions, getCacheOptions, normalizeListParams, createRepositoryLogger } from './repositories/domain/RepositoryUtils';
|
|
17
|
+
export type { RepositoryOptions, ListParams, CreateParams, UpdateParams, QueryKeyFactory } from './repositories/domain/types';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Permission Handler
|
|
3
|
+
*
|
|
4
|
+
* Generic permission handling using strategy pattern.
|
|
5
|
+
* Reduces permission method duplication from 4 methods → 1 generic handler.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const handler = new PermissionHandler({
|
|
10
|
+
* methods: {
|
|
11
|
+
* request: {
|
|
12
|
+
* camera: ImagePicker.requestCameraPermissionsAsync,
|
|
13
|
+
* mediaLibrary: ImagePicker.requestMediaLibraryPermissionsAsync,
|
|
14
|
+
* },
|
|
15
|
+
* get: {
|
|
16
|
+
* camera: ImagePicker.getCameraPermissionsAsync,
|
|
17
|
+
* mediaLibrary: ImagePicker.getMediaLibraryPermissionsAsync,
|
|
18
|
+
* },
|
|
19
|
+
* },
|
|
20
|
+
* statusMapper: mapPermissionStatus,
|
|
21
|
+
* defaultStatus: MediaLibraryPermission.DENIED,
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Request permission
|
|
25
|
+
* const status = await handler.handle('request', 'camera');
|
|
26
|
+
*
|
|
27
|
+
* // Check if granted
|
|
28
|
+
* if (handler.isGranted(status)) {
|
|
29
|
+
* // Proceed with operation
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import type { PermissionMethod, PermissionStatus, PermissionHandlerConfig } from './types';
|
|
34
|
+
/**
|
|
35
|
+
* Generic permission handler with configurable methods and status mapping
|
|
36
|
+
*/
|
|
37
|
+
export declare class PermissionHandler<TPermission extends PermissionStatus = PermissionStatus> {
|
|
38
|
+
private methods;
|
|
39
|
+
private statusMapper;
|
|
40
|
+
private defaultStatus;
|
|
41
|
+
constructor(config: PermissionHandlerConfig<TPermission>);
|
|
42
|
+
/**
|
|
43
|
+
* Handle permission request or status check
|
|
44
|
+
*
|
|
45
|
+
* @param method - 'request' or 'get'
|
|
46
|
+
* @param type - Permission type key (e.g., 'camera', 'mediaLibrary')
|
|
47
|
+
* @returns Permission status
|
|
48
|
+
*/
|
|
49
|
+
handle(method: PermissionMethod, type: string): Promise<TPermission>;
|
|
50
|
+
/**
|
|
51
|
+
* Check if permission status is granted
|
|
52
|
+
*
|
|
53
|
+
* @param status - Permission status to check
|
|
54
|
+
* @returns true if permission is granted or limited
|
|
55
|
+
*/
|
|
56
|
+
isGranted(status: TPermission): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Check if permission status is denied
|
|
59
|
+
*
|
|
60
|
+
* @param status - Permission status to check
|
|
61
|
+
* @returns true if permission is denied
|
|
62
|
+
*/
|
|
63
|
+
isDenied(status: TPermission): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Request permission by type
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const status = await handler.request('camera');
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
request(type: string): Promise<TPermission>;
|
|
73
|
+
/**
|
|
74
|
+
* Get permission status by type
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const status = await handler.getStatus('camera');
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
getStatus(type: string): Promise<TPermission>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Permissions Domain Types
|
|
3
|
+
*
|
|
4
|
+
* Generic types for permission handling
|
|
5
|
+
*/
|
|
6
|
+
export type PermissionMethod = 'request' | 'get';
|
|
7
|
+
/**
|
|
8
|
+
* Permission status types
|
|
9
|
+
* Apps can extend this for custom permission types
|
|
10
|
+
*/
|
|
11
|
+
export type PermissionStatus = 'granted' | 'denied' | 'limited' | 'undetermined';
|
|
12
|
+
/**
|
|
13
|
+
* Permission result with metadata
|
|
14
|
+
*/
|
|
15
|
+
export interface PermissionResult {
|
|
16
|
+
status: PermissionStatus;
|
|
17
|
+
canAskAgain?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Permission handler configuration
|
|
21
|
+
*/
|
|
22
|
+
export interface PermissionHandlerConfig<TPermission extends PermissionStatus = PermissionStatus> {
|
|
23
|
+
/**
|
|
24
|
+
* Map permission API methods
|
|
25
|
+
*/
|
|
26
|
+
methods: PermissionMethods;
|
|
27
|
+
/**
|
|
28
|
+
* Map API status to domain permission type
|
|
29
|
+
*/
|
|
30
|
+
statusMapper: (apiStatus: string) => TPermission;
|
|
31
|
+
/**
|
|
32
|
+
* Default status when permission fails
|
|
33
|
+
*/
|
|
34
|
+
defaultStatus?: TPermission;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Permission API methods mapping
|
|
38
|
+
*/
|
|
39
|
+
export interface PermissionMethods {
|
|
40
|
+
request: Record<string, () => Promise<PermissionResult>>;
|
|
41
|
+
get: Record<string, () => Promise<PermissionResult>>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Permissions Module
|
|
3
|
+
*
|
|
4
|
+
* Generic permission handling with configurable methods and status mapping.
|
|
5
|
+
*/
|
|
6
|
+
export { PermissionHandler } from './domain/PermissionHandler';
|
|
7
|
+
export type { PermissionMethod, PermissionStatus, PermissionResult, PermissionHandlerConfig, PermissionMethods, } from './domain/types';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repository Key Factory
|
|
3
|
+
*
|
|
4
|
+
* Generic query key factory for repositories.
|
|
5
|
+
* Provides consistent query key structure across all repositories.
|
|
6
|
+
*/
|
|
7
|
+
import type { QueryKeyFactory } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Create query key factory for a resource
|
|
10
|
+
*
|
|
11
|
+
* @param resource - Resource name (e.g., 'users', 'posts')
|
|
12
|
+
* @returns Query key factory
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const keys = createRepositoryKeyFactory('users');
|
|
17
|
+
*
|
|
18
|
+
* keys.all(); // ['users']
|
|
19
|
+
* keys.lists(); // ['users', 'list']
|
|
20
|
+
* keys.list({ page: 1 }); // ['users', 'list', { page: 1 }]
|
|
21
|
+
* keys.details(); // ['users', 'detail']
|
|
22
|
+
* keys.detail(123); // ['users', 'detail', 123]
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function createRepositoryKeyFactory(resource: string): QueryKeyFactory;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repository Utilities
|
|
3
|
+
*
|
|
4
|
+
* Common utilities for repository implementations.
|
|
5
|
+
* Provides caching options and helper functions.
|
|
6
|
+
*/
|
|
7
|
+
import type { RepositoryOptions, ListParams } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Merge repository options with defaults
|
|
10
|
+
*
|
|
11
|
+
* @param options - User provided options
|
|
12
|
+
* @returns Merged options
|
|
13
|
+
*/
|
|
14
|
+
export declare function mergeRepositoryOptions(options?: RepositoryOptions): Required<RepositoryOptions>;
|
|
15
|
+
/**
|
|
16
|
+
* Get cache options from repository options
|
|
17
|
+
*
|
|
18
|
+
* @param options - Repository options
|
|
19
|
+
* @returns Cache options with defaults
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCacheOptions(options: RepositoryOptions): {
|
|
22
|
+
staleTime: number;
|
|
23
|
+
gcTime: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Normalize list parameters
|
|
27
|
+
*
|
|
28
|
+
* @param params - List parameters
|
|
29
|
+
* @returns Normalized parameters
|
|
30
|
+
*/
|
|
31
|
+
export declare function normalizeListParams(params?: ListParams): ListParams;
|
|
32
|
+
/**
|
|
33
|
+
* Create debug logger for repository
|
|
34
|
+
*
|
|
35
|
+
* @param resource - Resource name
|
|
36
|
+
* @param enabled - Enable logging
|
|
37
|
+
* @returns Logger function
|
|
38
|
+
*/
|
|
39
|
+
export declare function createRepositoryLogger(resource: string, enabled?: boolean): (method: string, ...args: unknown[]) => void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Repository Domain Types
|
|
3
|
+
*
|
|
4
|
+
* Shared types for repository implementations
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Repository options
|
|
8
|
+
*/
|
|
9
|
+
export interface RepositoryOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Cache configuration
|
|
12
|
+
*/
|
|
13
|
+
cache?: {
|
|
14
|
+
staleTime?: number;
|
|
15
|
+
gcTime?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Enable debug logging
|
|
19
|
+
*/
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* List parameters for fetch operations
|
|
24
|
+
*/
|
|
25
|
+
export interface ListParams {
|
|
26
|
+
page?: number;
|
|
27
|
+
limit?: number;
|
|
28
|
+
sort?: string;
|
|
29
|
+
filter?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create parameters
|
|
33
|
+
*/
|
|
34
|
+
export interface CreateParams<TVariables> {
|
|
35
|
+
data: TVariables;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Update parameters
|
|
39
|
+
*/
|
|
40
|
+
export interface UpdateParams<TVariables> {
|
|
41
|
+
id: string | number;
|
|
42
|
+
data: TVariables;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Query key factory result
|
|
46
|
+
*/
|
|
47
|
+
export type QueryKeyFactory = {
|
|
48
|
+
all: () => readonly string[];
|
|
49
|
+
lists: () => readonly string[];
|
|
50
|
+
list: (params: ListParams) => readonly unknown[];
|
|
51
|
+
details: () => readonly string[];
|
|
52
|
+
detail: (id: string | number) => readonly unknown[];
|
|
53
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Repositories Module
|
|
3
|
+
*
|
|
4
|
+
* Common utilities and types for repository implementations.
|
|
5
|
+
* TanStack and Storage repositories remain separate but share these utilities.
|
|
6
|
+
*/
|
|
7
|
+
export { createRepositoryKeyFactory } from './domain/RepositoryKeyFactory';
|
|
8
|
+
export type { QueryKeyFactory } from './domain/types';
|
|
9
|
+
export { mergeRepositoryOptions, getCacheOptions, normalizeListParams, createRepositoryLogger, } from './domain/RepositoryUtils';
|
|
10
|
+
export type { RepositoryOptions, ListParams, CreateParams, UpdateParams, } from './domain/types';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @umituz/react-native-design-system/hooks - Centralized Hooks Export
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all commonly used hooks from the design system
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* import {
|
|
8
|
+
* useAppDesignTokens,
|
|
9
|
+
* useTheme,
|
|
10
|
+
* useInfiniteScroll,
|
|
11
|
+
* useOffline,
|
|
12
|
+
* useResponsive,
|
|
13
|
+
* useSafeArea
|
|
14
|
+
* } from '@umituz/react-native-design-system/hooks';
|
|
15
|
+
*/
|
|
16
|
+
export { useAppDesignTokens, } from '../theme/hooks/useAppDesignTokens';
|
|
17
|
+
export { useTheme as useThemeStore } from '../theme/infrastructure/stores/themeStore';
|
|
18
|
+
export { useResponsive, useScreenWidth, useScreenHeight, useScreenDimensions, type UseResponsiveReturn, } from '../responsive';
|
|
19
|
+
export { useSafeAreaInsets, } from '../safe-area';
|
|
20
|
+
export { useInfiniteScroll, type InfiniteScrollConfig, type UseInfiniteScrollReturn, } from '../infinite-scroll';
|
|
21
|
+
export { useOffline, type NetworkState, } from '../offline';
|
|
22
|
+
export { useDeviceInfo, useDeviceCapabilities, useDeviceId, type DeviceInfo, type AnonymousUser, } from '../device';
|
|
23
|
+
export { useStorage, useStorageState, useStore, usePersistentCache, useCache, useCachedValue, useCacheState, type PersistentCacheOptions, type PersistentCacheResult, } from '../storage';
|
|
24
|
+
export { useMedia, type MediaPickerResult, } from '../media';
|
|
25
|
+
export { useTimezone, type TimezoneInfo, } from '../timezone';
|
|
26
|
+
export { useHaptics, } from '../haptics';
|
|
27
|
+
export { useGlobalLoading, type LoadingState, } from '../loading';
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Camera Picker Strategy
|
|
3
|
+
*
|
|
4
|
+
* Strategy for capturing images/videos using device camera.
|
|
5
|
+
*/
|
|
6
|
+
import { PermissionManager } from '../../infrastructure/utils/PermissionManager';
|
|
7
|
+
import type { PickerStrategy, LaunchOptions } from './PickerStrategy';
|
|
8
|
+
import type { MediaLibraryPermission } from '../entities/Media';
|
|
9
|
+
/**
|
|
10
|
+
* Camera picker strategy configuration
|
|
11
|
+
*/
|
|
12
|
+
export interface CameraPickerConfig {
|
|
13
|
+
mediaType: 'images' | 'videos';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Camera picker strategy implementation
|
|
17
|
+
*/
|
|
18
|
+
export declare class CameraPickerStrategy implements PickerStrategy {
|
|
19
|
+
private config;
|
|
20
|
+
private permissionManager;
|
|
21
|
+
readonly name = "CameraPicker";
|
|
22
|
+
constructor(config: CameraPickerConfig, permissionManager?: typeof PermissionManager);
|
|
23
|
+
getPermission(): Promise<MediaLibraryPermission>;
|
|
24
|
+
launch(options: LaunchOptions): Promise<any>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library Picker Strategy
|
|
3
|
+
*
|
|
4
|
+
* Strategy for picking images/videos from device gallery.
|
|
5
|
+
*/
|
|
6
|
+
import { PermissionManager } from '../../infrastructure/utils/PermissionManager';
|
|
7
|
+
import type { PickerStrategy, LaunchOptions } from './PickerStrategy';
|
|
8
|
+
import type { MediaLibraryPermission } from '../entities/Media';
|
|
9
|
+
/**
|
|
10
|
+
* Library picker strategy implementation
|
|
11
|
+
*/
|
|
12
|
+
export declare class LibraryPickerStrategy implements PickerStrategy {
|
|
13
|
+
private permissionManager;
|
|
14
|
+
readonly name = "LibraryPicker";
|
|
15
|
+
constructor(permissionManager?: typeof PermissionManager);
|
|
16
|
+
getPermission(): Promise<MediaLibraryPermission>;
|
|
17
|
+
launch(options: LaunchOptions): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media Picker Strategy Interface
|
|
3
|
+
*
|
|
4
|
+
* Strategy pattern for different media picker types.
|
|
5
|
+
* Allows MediaPickerService to support camera, video, and library pickers polymorphically.
|
|
6
|
+
*/
|
|
7
|
+
import type { MediaLibraryPermission } from '../entities/Media';
|
|
8
|
+
/**
|
|
9
|
+
* Common picker options
|
|
10
|
+
*/
|
|
11
|
+
export interface LaunchOptions {
|
|
12
|
+
allowsEditing?: boolean;
|
|
13
|
+
quality?: number;
|
|
14
|
+
aspect?: [number, number];
|
|
15
|
+
videoMaxDuration?: number;
|
|
16
|
+
videoMaxBitrate?: number;
|
|
17
|
+
videoQuality?: 'low' | 'medium' | 'high';
|
|
18
|
+
base64?: boolean;
|
|
19
|
+
exif?: boolean;
|
|
20
|
+
allowsMultipleSelection?: boolean;
|
|
21
|
+
selectionLimit?: number;
|
|
22
|
+
mediaTypes?: string;
|
|
23
|
+
maxFileSizeMB?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Result from picker launch
|
|
27
|
+
*/
|
|
28
|
+
export interface PickerLaunchResult {
|
|
29
|
+
canceled: boolean;
|
|
30
|
+
assets?: Array<{
|
|
31
|
+
uri: string;
|
|
32
|
+
width?: number;
|
|
33
|
+
height?: number;
|
|
34
|
+
type?: 'image' | 'video';
|
|
35
|
+
duration?: number;
|
|
36
|
+
fileSize?: number;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Media picker strategy interface
|
|
41
|
+
*/
|
|
42
|
+
export interface PickerStrategy {
|
|
43
|
+
/**
|
|
44
|
+
* Get required permission for this picker type
|
|
45
|
+
*/
|
|
46
|
+
getPermission(): Promise<MediaLibraryPermission>;
|
|
47
|
+
/**
|
|
48
|
+
* Launch the picker with options
|
|
49
|
+
*/
|
|
50
|
+
launch(options: LaunchOptions): Promise<PickerLaunchResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Strategy name for debugging
|
|
53
|
+
*/
|
|
54
|
+
readonly name: string;
|
|
55
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media Picker Strategies
|
|
3
|
+
*
|
|
4
|
+
* Strategy pattern implementations for different picker types.
|
|
5
|
+
*/
|
|
6
|
+
export type { PickerStrategy } from './PickerStrategy';
|
|
7
|
+
export type { LaunchOptions, PickerLaunchResult } from './PickerStrategy';
|
|
8
|
+
export { CameraPickerStrategy } from './CameraPickerStrategy';
|
|
9
|
+
export type { CameraPickerConfig } from './CameraPickerStrategy';
|
|
10
|
+
export { LibraryPickerStrategy } from './LibraryPickerStrategy';
|