@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.2.9 → 0.2.10
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/CHANGELOG.md +1 -1
- package/dist/components/ui/accessibility-demo.esm.js +30 -24
- package/dist/components/ui/accessibility-demo.js +30 -24
- package/dist/components/ui/advanced-component-architecture-demo.esm.js +235 -179
- package/dist/components/ui/advanced-component-architecture-demo.js +235 -179
- package/dist/components/ui/advanced-transition-system-demo.esm.js +110 -64
- package/dist/components/ui/advanced-transition-system-demo.js +110 -64
- package/dist/components/ui/advanced-transition-system.esm.js +166 -122
- package/dist/components/ui/advanced-transition-system.js +166 -122
- package/dist/components/ui/animation/animated-container.esm.js +52 -29
- package/dist/components/ui/animation/animated-container.js +52 -29
- package/dist/components/ui/animation/staggered-container.esm.js +18 -9
- package/dist/components/ui/animation/staggered-container.js +18 -9
- package/dist/components/ui/animation-demo.esm.js +67 -35
- package/dist/components/ui/animation-demo.js +67 -35
- package/dist/components/ui/badge.esm.js +9 -6
- package/dist/components/ui/badge.js +9 -6
- package/dist/components/ui/battery-conscious-animation-demo.esm.js +122 -87
- package/dist/components/ui/battery-conscious-animation-demo.js +122 -87
- package/dist/components/ui/border-radius-shadow-demo.esm.js +23 -12
- package/dist/components/ui/border-radius-shadow-demo.js +23 -12
- package/dist/components/ui/button.esm.js +8 -2
- package/dist/components/ui/button.js +8 -2
- package/dist/components/ui/card.esm.js +33 -8
- package/dist/components/ui/card.js +33 -8
- package/dist/components/ui/checkbox.esm.js +3 -3
- package/dist/components/ui/checkbox.js +3 -3
- package/dist/components/ui/color-preview.esm.js +68 -45
- package/dist/components/ui/color-preview.js +68 -45
- package/dist/components/ui/data-display/chart.esm.js +112 -84
- package/dist/components/ui/data-display/chart.js +112 -84
- package/dist/components/ui/data-display/data-grid-simple.esm.js +1 -1
- package/dist/components/ui/data-display/data-grid-simple.js +1 -1
- package/dist/components/ui/data-display/data-grid.esm.js +80 -67
- package/dist/components/ui/data-display/data-grid.js +80 -67
- package/dist/components/ui/data-display/list.esm.js +53 -45
- package/dist/components/ui/data-display/list.js +53 -45
- package/dist/components/ui/data-display/table.esm.js +62 -54
- package/dist/components/ui/data-display/table.js +62 -54
- package/dist/components/ui/data-display/timeline.esm.js +39 -34
- package/dist/components/ui/data-display/timeline.js +39 -34
- package/dist/components/ui/data-display/tree.esm.js +116 -84
- package/dist/components/ui/data-display/tree.js +116 -84
- package/dist/components/ui/data-display/types.esm.js +389 -364
- package/dist/components/ui/data-display/types.js +389 -364
- package/dist/components/ui/enterprise-mobile-experience-demo.esm.js +120 -70
- package/dist/components/ui/enterprise-mobile-experience-demo.js +120 -70
- package/dist/components/ui/enterprise-mobile-experience.esm.js +124 -73
- package/dist/components/ui/enterprise-mobile-experience.js +124 -73
- package/dist/components/ui/feedback/alert.esm.js +22 -15
- package/dist/components/ui/feedback/alert.js +22 -15
- package/dist/components/ui/feedback/progress.esm.js +47 -24
- package/dist/components/ui/feedback/progress.js +47 -24
- package/dist/components/ui/feedback/skeleton.esm.js +39 -29
- package/dist/components/ui/feedback/skeleton.js +39 -29
- package/dist/components/ui/feedback/toast.esm.js +62 -38
- package/dist/components/ui/feedback/toast.js +62 -38
- package/dist/components/ui/feedback/types.esm.js +83 -83
- package/dist/components/ui/feedback/types.js +83 -83
- package/dist/components/ui/font-preview.esm.js +41 -39
- package/dist/components/ui/font-preview.js +41 -39
- package/dist/components/ui/form-demo.esm.js +150 -113
- package/dist/components/ui/form-demo.js +150 -113
- package/dist/components/ui/hardware-acceleration-demo.esm.js +137 -87
- package/dist/components/ui/hardware-acceleration-demo.js +137 -87
- package/dist/components/ui/input.esm.js +4 -1
- package/dist/components/ui/input.js +4 -1
- package/dist/components/ui/layout-demo.esm.js +81 -56
- package/dist/components/ui/layout-demo.js +81 -56
- package/dist/components/ui/layouts/adaptive-layout.esm.js +27 -8
- package/dist/components/ui/layouts/adaptive-layout.js +27 -8
- package/dist/components/ui/layouts/desktop-layout.esm.js +39 -19
- package/dist/components/ui/layouts/desktop-layout.js +39 -19
- package/dist/components/ui/layouts/mobile-layout.esm.js +19 -9
- package/dist/components/ui/layouts/mobile-layout.js +19 -9
- package/dist/components/ui/layouts/tablet-layout.esm.js +28 -14
- package/dist/components/ui/layouts/tablet-layout.js +28 -14
- package/dist/components/ui/mobile-form-validation.esm.js +120 -87
- package/dist/components/ui/mobile-form-validation.js +120 -87
- package/dist/components/ui/mobile-input-demo.esm.js +19 -13
- package/dist/components/ui/mobile-input-demo.js +19 -13
- package/dist/components/ui/mobile-input.esm.js +185 -120
- package/dist/components/ui/mobile-input.js +185 -120
- package/dist/components/ui/mobile-skeleton-loading-demo.esm.js +128 -111
- package/dist/components/ui/mobile-skeleton-loading-demo.js +128 -111
- package/dist/components/ui/navigation/breadcrumb.esm.js +17 -14
- package/dist/components/ui/navigation/breadcrumb.js +17 -14
- package/dist/components/ui/navigation/index.esm.js +23 -1
- package/dist/components/ui/navigation/index.js +23 -1
- package/dist/components/ui/navigation/menu.esm.js +49 -35
- package/dist/components/ui/navigation/menu.js +49 -35
- package/dist/components/ui/navigation/navigation-demo.esm.js +81 -74
- package/dist/components/ui/navigation/navigation-demo.js +81 -74
- package/dist/components/ui/navigation/pagination.esm.js +62 -50
- package/dist/components/ui/navigation/pagination.js +62 -50
- package/dist/components/ui/navigation/sidebar.esm.js +56 -42
- package/dist/components/ui/navigation/sidebar.js +56 -42
- package/dist/components/ui/navigation/stepper.esm.js +34 -23
- package/dist/components/ui/navigation/stepper.js +34 -23
- package/dist/components/ui/navigation/tabs.esm.js +32 -21
- package/dist/components/ui/navigation/tabs.js +32 -21
- package/dist/components/ui/navigation/types.esm.js +196 -195
- package/dist/components/ui/navigation/types.js +196 -195
- package/dist/components/ui/overlay/backdrop.esm.js +17 -16
- package/dist/components/ui/overlay/backdrop.js +17 -16
- package/dist/components/ui/overlay/focus-manager.esm.js +21 -19
- package/dist/components/ui/overlay/focus-manager.js +21 -19
- package/dist/components/ui/overlay/index.esm.js +22 -2
- package/dist/components/ui/overlay/index.js +22 -2
- package/dist/components/ui/overlay/modal.esm.js +38 -34
- package/dist/components/ui/overlay/modal.js +38 -34
- package/dist/components/ui/overlay/overlay-manager.esm.js +25 -20
- package/dist/components/ui/overlay/overlay-manager.js +25 -20
- package/dist/components/ui/overlay/popover.esm.js +74 -58
- package/dist/components/ui/overlay/popover.js +74 -58
- package/dist/components/ui/overlay/portal.esm.js +7 -7
- package/dist/components/ui/overlay/portal.js +7 -7
- package/dist/components/ui/overlay/tooltip.esm.js +54 -39
- package/dist/components/ui/overlay/tooltip.js +54 -39
- package/dist/components/ui/overlay/types.esm.js +132 -131
- package/dist/components/ui/overlay/types.js +132 -131
- package/dist/components/ui/performance-demo.esm.js +135 -88
- package/dist/components/ui/performance-demo.js +135 -88
- package/dist/components/ui/semantic-input-system-demo.esm.js +117 -80
- package/dist/components/ui/semantic-input-system-demo.js +117 -80
- package/dist/components/ui/theme-customizer.esm.js +84 -52
- package/dist/components/ui/theme-customizer.js +84 -52
- package/dist/components/ui/theme-preview.esm.js +95 -43
- package/dist/components/ui/theme-preview.js +95 -43
- package/dist/components/ui/theme-switcher.esm.js +70 -44
- package/dist/components/ui/theme-switcher.js +70 -44
- package/dist/components/ui/theme-toggle.esm.js +3 -3
- package/dist/components/ui/theme-toggle.js +3 -3
- package/dist/components/ui/token-demo.esm.js +33 -21
- package/dist/components/ui/token-demo.js +33 -21
- package/dist/components/ui/touch-demo.esm.js +102 -73
- package/dist/components/ui/touch-demo.js +102 -73
- package/dist/components/ui/touch-friendly-interface-demo.esm.js +102 -64
- package/dist/components/ui/touch-friendly-interface-demo.js +102 -64
- package/dist/components/ui/touch-friendly-interface.esm.js +85 -61
- package/dist/components/ui/touch-friendly-interface.js +85 -61
- package/dist/hooks/use-accessibility-support.esm.js +115 -85
- package/dist/hooks/use-accessibility-support.js +115 -85
- package/dist/hooks/use-adaptive-layout.esm.js +56 -33
- package/dist/hooks/use-adaptive-layout.js +56 -33
- package/dist/hooks/use-advanced-patterns.esm.js +57 -42
- package/dist/hooks/use-advanced-patterns.js +57 -42
- package/dist/hooks/use-advanced-transition-system.esm.js +112 -71
- package/dist/hooks/use-advanced-transition-system.js +112 -71
- package/dist/hooks/use-animation-profile.esm.js +63 -34
- package/dist/hooks/use-animation-profile.js +63 -34
- package/dist/hooks/use-battery-animations.esm.js +80 -55
- package/dist/hooks/use-battery-animations.js +80 -55
- package/dist/hooks/use-battery-conscious-loading.esm.js +166 -123
- package/dist/hooks/use-battery-conscious-loading.js +166 -123
- package/dist/hooks/use-battery-optimization.esm.js +78 -55
- package/dist/hooks/use-battery-optimization.js +78 -55
- package/dist/hooks/use-battery-status.esm.js +73 -51
- package/dist/hooks/use-battery-status.js +73 -51
- package/dist/hooks/use-component-performance.esm.js +62 -47
- package/dist/hooks/use-component-performance.js +62 -47
- package/dist/hooks/use-device-loading-states.esm.js +152 -109
- package/dist/hooks/use-device-loading-states.js +152 -109
- package/dist/hooks/use-device.esm.js +25 -14
- package/dist/hooks/use-device.js +25 -14
- package/dist/hooks/use-enterprise-mobile-experience.esm.js +137 -88
- package/dist/hooks/use-enterprise-mobile-experience.js +137 -88
- package/dist/hooks/use-form-feedback.esm.js +124 -81
- package/dist/hooks/use-form-feedback.js +124 -81
- package/dist/hooks/use-form-performance.esm.js +127 -92
- package/dist/hooks/use-form-performance.js +127 -92
- package/dist/hooks/use-frame-rate.esm.js +56 -37
- package/dist/hooks/use-frame-rate.js +56 -37
- package/dist/hooks/use-gestures.esm.js +96 -72
- package/dist/hooks/use-gestures.js +96 -72
- package/dist/hooks/use-hardware-acceleration.esm.js +65 -37
- package/dist/hooks/use-hardware-acceleration.js +65 -37
- package/dist/hooks/use-input-accessibility.esm.js +157 -119
- package/dist/hooks/use-input-accessibility.js +157 -119
- package/dist/hooks/use-input-performance.esm.js +139 -104
- package/dist/hooks/use-input-performance.js +139 -104
- package/dist/hooks/use-layout-performance.esm.js +50 -29
- package/dist/hooks/use-layout-performance.js +50 -29
- package/dist/hooks/use-loading-accessibility.esm.js +209 -169
- package/dist/hooks/use-loading-accessibility.js +209 -169
- package/dist/hooks/use-loading-performance.esm.js +117 -93
- package/dist/hooks/use-loading-performance.js +117 -93
- package/dist/hooks/use-memory-usage.esm.js +57 -38
- package/dist/hooks/use-memory-usage.js +57 -38
- package/dist/hooks/use-mobile-form-layout.esm.js +111 -74
- package/dist/hooks/use-mobile-form-layout.js +111 -74
- package/dist/hooks/use-mobile-form-validation.esm.js +211 -144
- package/dist/hooks/use-mobile-form-validation.js +211 -144
- package/dist/hooks/use-mobile-keyboard-optimization.esm.js +154 -113
- package/dist/hooks/use-mobile-keyboard-optimization.js +154 -113
- package/dist/hooks/use-mobile-layout.esm.js +73 -51
- package/dist/hooks/use-mobile-layout.js +73 -51
- package/dist/hooks/use-mobile-optimization.esm.js +72 -44
- package/dist/hooks/use-mobile-optimization.js +72 -44
- package/dist/hooks/use-mobile-skeleton.esm.js +97 -64
- package/dist/hooks/use-mobile-skeleton.js +97 -64
- package/dist/hooks/use-mobile-touch.esm.js +128 -93
- package/dist/hooks/use-mobile-touch.js +128 -93
- package/dist/hooks/use-performance-throttling.esm.js +72 -48
- package/dist/hooks/use-performance-throttling.js +72 -48
- package/dist/hooks/use-performance.esm.js +90 -52
- package/dist/hooks/use-performance.js +90 -52
- package/dist/hooks/use-reusable-architecture.esm.js +94 -65
- package/dist/hooks/use-reusable-architecture.js +94 -65
- package/dist/hooks/use-semantic-input-types.esm.js +166 -124
- package/dist/hooks/use-semantic-input-types.js +166 -124
- package/dist/hooks/use-semantic-input.esm.js +178 -126
- package/dist/hooks/use-semantic-input.js +178 -126
- package/dist/hooks/use-tablet-layout.esm.js +67 -38
- package/dist/hooks/use-tablet-layout.js +67 -38
- package/dist/hooks/use-touch-friendly-input.esm.js +193 -149
- package/dist/hooks/use-touch-friendly-input.js +193 -149
- package/dist/hooks/use-touch-friendly-interface.esm.js +99 -67
- package/dist/hooks/use-touch-friendly-interface.js +99 -67
- package/dist/hooks/use-touch-optimization.esm.js +99 -72
- package/dist/hooks/use-touch-optimization.js +99 -72
- package/dist/index.esm.js +289 -280
- package/dist/index.js +289 -280
- package/dist/lib/utils.esm.js +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/plugins/theme-css-generator.esm.js +104 -55
- package/dist/plugins/theme-css-generator.js +104 -55
- package/dist/provider.esm.js +4 -4
- package/dist/provider.js +4 -4
- package/dist/styles.css +1 -1
- package/dist/theme.esm.js +633 -468
- package/dist/theme.js +633 -468
- package/dist/themes/ThemeContext.esm.js +15 -15
- package/dist/themes/ThemeContext.js +15 -15
- package/dist/themes/ThemeProvider.esm.js +25 -22
- package/dist/themes/ThemeProvider.js +25 -22
- package/dist/themes/accessibility.esm.js +147 -108
- package/dist/themes/accessibility.js +147 -108
- package/dist/themes/aria-patterns.esm.js +198 -162
- package/dist/themes/aria-patterns.js +198 -162
- package/dist/themes/base-themes.esm.js +14 -11
- package/dist/themes/base-themes.js +14 -11
- package/dist/themes/colorManager.esm.js +101 -83
- package/dist/themes/colorManager.js +101 -83
- package/dist/themes/examples/dark-theme.esm.js +133 -103
- package/dist/themes/examples/dark-theme.js +133 -103
- package/dist/themes/examples/minimal-theme.esm.js +83 -61
- package/dist/themes/examples/minimal-theme.js +83 -61
- package/dist/themes/focus-management.esm.js +202 -143
- package/dist/themes/focus-management.js +202 -143
- package/dist/themes/fontLoader.esm.js +28 -19
- package/dist/themes/fontLoader.js +28 -19
- package/dist/themes/high-contrast.esm.js +152 -104
- package/dist/themes/high-contrast.js +152 -104
- package/dist/themes/inheritance.esm.js +35 -27
- package/dist/themes/inheritance.js +35 -27
- package/dist/themes/keyboard-navigation.esm.js +152 -123
- package/dist/themes/keyboard-navigation.js +152 -123
- package/dist/themes/motion-reduction.esm.js +193 -133
- package/dist/themes/motion-reduction.js +193 -133
- package/dist/themes/navigation.esm.js +146 -146
- package/dist/themes/navigation.js +146 -146
- package/dist/themes/screen-reader.esm.js +159 -94
- package/dist/themes/screen-reader.js +159 -94
- package/dist/themes/systemThemeDetector.esm.js +42 -34
- package/dist/themes/systemThemeDetector.js +42 -34
- package/dist/themes/themeCSSUpdater.esm.js +21 -9
- package/dist/themes/themeCSSUpdater.js +21 -9
- package/dist/themes/themePersistence.esm.js +68 -47
- package/dist/themes/themePersistence.js +68 -47
- package/dist/themes/themes/stan-design.esm.js +633 -468
- package/dist/themes/themes/stan-design.js +633 -468
- package/dist/themes/types.esm.js +301 -287
- package/dist/themes/types.js +301 -287
- package/dist/themes/useSystemTheme.esm.js +4 -4
- package/dist/themes/useSystemTheme.js +4 -4
- package/dist/themes/useTheme.esm.js +4 -4
- package/dist/themes/useTheme.js +4 -4
- package/dist/themes/validation.esm.js +128 -77
- package/dist/themes/validation.js +128 -77
- package/dist/tokens/index.esm.js +15 -4
- package/dist/tokens/index.js +15 -4
- package/dist/tokens/tokenExporter.esm.js +87 -61
- package/dist/tokens/tokenExporter.js +87 -61
- package/dist/tokens/tokenGenerator.esm.js +86 -77
- package/dist/tokens/tokenGenerator.js +86 -77
- package/dist/tokens/tokenManager.esm.js +64 -51
- package/dist/tokens/tokenManager.js +64 -51
- package/dist/tokens/tokenValidator.esm.js +193 -147
- package/dist/tokens/tokenValidator.js +193 -147
- package/dist/tokens/types.esm.js +49 -35
- package/dist/tokens/types.js +49 -35
- package/dist/utils/bundle-analyzer.esm.js +83 -65
- package/dist/utils/bundle-analyzer.js +83 -65
- package/dist/utils/bundle-splitting.esm.js +142 -117
- package/dist/utils/bundle-splitting.js +142 -117
- package/dist/utils/lazy-loading.esm.js +132 -106
- package/dist/utils/lazy-loading.js +132 -106
- package/dist/utils/performance-monitor.esm.js +170 -129
- package/dist/utils/performance-monitor.js +170 -129
- package/dist/utils/tree-shaking.esm.js +69 -61
- package/dist/utils/tree-shaking.js +69 -61
- package/package.json +1 -1
- package/src/index.ts +146 -146
|
@@ -1,25 +1,51 @@
|
|
|
1
1
|
import { useState, useCallback, useRef, useEffect } from 'react'
|
|
2
2
|
|
|
3
3
|
export interface KeyboardOptimizationConfig {
|
|
4
|
-
enableKeyboardDetection
|
|
4
|
+
enableKeyboardDetection?: boolean
|
|
5
|
+
enableAutoOptimization?: boolean
|
|
6
|
+
enablePerformanceMonitoring?: boolean
|
|
7
|
+
enableBatteryOptimization?: boolean
|
|
8
|
+
enableAccessibilitySupport?: boolean
|
|
9
|
+
keyboardDetectionInterval?: number
|
|
10
|
+
performanceThreshold?: number
|
|
11
|
+
}
|
|
5
12
|
|
|
6
13
|
export interface KeyboardState {
|
|
7
|
-
isVisible
|
|
14
|
+
isVisible: boolean
|
|
15
|
+
height: number
|
|
16
|
+
type: 'default' | 'numeric' | 'email' | 'tel' | 'url' | 'search' | 'decimal'
|
|
17
|
+
orientation: 'portrait' | 'landscape'
|
|
18
|
+
platform: 'ios' | 'android' | 'unknown'
|
|
19
|
+
language: string
|
|
20
|
+
inputMode: string
|
|
21
|
+
autoCapitalize: string
|
|
22
|
+
autoComplete: string
|
|
23
|
+
autoCorrect: string
|
|
24
|
+
spellCheck: boolean
|
|
25
|
+
}
|
|
8
26
|
|
|
9
27
|
export interface KeyboardOptimization {
|
|
10
|
-
id
|
|
28
|
+
id: string
|
|
29
|
+
name: string
|
|
30
|
+
type: 'keyboard' | 'input' | 'performance' | 'accessibility'
|
|
31
|
+
applied: boolean
|
|
32
|
+
impact: 'low' | 'medium' | 'high'
|
|
33
|
+
description: string
|
|
34
|
+
keyboardType?: string
|
|
35
|
+
inputMode?: string
|
|
36
|
+
}
|
|
11
37
|
|
|
12
38
|
export interface MobileKeyboardOptimizationCallbacks {
|
|
13
|
-
onKeyboardStateChanged
|
|
14
|
-
onOptimizationApplied
|
|
15
|
-
onPerformanceOptimized
|
|
16
|
-
onBatteryOptimized
|
|
17
|
-
onAccessibilityEnhanced
|
|
39
|
+
onKeyboardStateChanged?: (state: KeyboardState) => void
|
|
40
|
+
onOptimizationApplied?: (optimization: KeyboardOptimization) => void
|
|
41
|
+
onPerformanceOptimized?: (optimization: string) => void
|
|
42
|
+
onBatteryOptimized?: (strategy: string) => void
|
|
43
|
+
onAccessibilityEnhanced?: (feature: string) => void
|
|
18
44
|
}
|
|
19
45
|
|
|
20
46
|
export const useMobileKeyboardOptimization = (
|
|
21
|
-
config= {},
|
|
22
|
-
callbacks= {}
|
|
47
|
+
config: KeyboardOptimizationConfig = {},
|
|
48
|
+
callbacks: MobileKeyboardOptimizationCallbacks = {}
|
|
23
49
|
) => {
|
|
24
50
|
const {
|
|
25
51
|
enableKeyboardDetection = true,
|
|
@@ -32,25 +58,27 @@ export const useMobileKeyboardOptimization = (
|
|
|
32
58
|
} = config
|
|
33
59
|
|
|
34
60
|
const [keyboardState, setKeyboardState] = useState<KeyboardState>({
|
|
35
|
-
isVisible,
|
|
36
|
-
height,
|
|
37
|
-
type,
|
|
38
|
-
orientation,
|
|
39
|
-
platform,
|
|
40
|
-
language,
|
|
41
|
-
inputMode,
|
|
42
|
-
autoCapitalize,
|
|
43
|
-
autoComplete,
|
|
44
|
-
autoCorrect,
|
|
45
|
-
spellCheck
|
|
61
|
+
isVisible: false,
|
|
62
|
+
height: 0,
|
|
63
|
+
type: 'default',
|
|
64
|
+
orientation: 'portrait',
|
|
65
|
+
platform: 'unknown',
|
|
66
|
+
language: 'en-US',
|
|
67
|
+
inputMode: 'text',
|
|
68
|
+
autoCapitalize: 'sentences',
|
|
69
|
+
autoComplete: 'on',
|
|
70
|
+
autoCorrect: 'on',
|
|
71
|
+
spellCheck: true
|
|
72
|
+
})
|
|
46
73
|
|
|
47
74
|
const [optimizations, setOptimizations] = useState<KeyboardOptimization[]>([])
|
|
48
75
|
const [isOptimizing, setIsOptimizing] = useState(false)
|
|
49
76
|
const [performanceMetrics, setPerformanceMetrics] = useState({
|
|
50
|
-
frameRate,
|
|
51
|
-
inputLatency,
|
|
52
|
-
keyboardResponseTime,
|
|
53
|
-
memoryUsage
|
|
77
|
+
frameRate: 60,
|
|
78
|
+
inputLatency: 0,
|
|
79
|
+
keyboardResponseTime: 0,
|
|
80
|
+
memoryUsage: 0
|
|
81
|
+
})
|
|
54
82
|
|
|
55
83
|
const keyboardDetectionRef = useRef<number | null>(null)
|
|
56
84
|
const performanceTimerRef = useRef<number | null>(null)
|
|
@@ -68,7 +96,8 @@ export const useMobileKeyboardOptimization = (
|
|
|
68
96
|
|
|
69
97
|
// Detect device orientation
|
|
70
98
|
const detectOrientation = useCallback(() => {
|
|
71
|
-
return window.innerHeight > window.innerWidth ? 'portrait'
|
|
99
|
+
return window.innerHeight > window.innerWidth ? 'portrait' : 'landscape'
|
|
100
|
+
}, [])
|
|
72
101
|
|
|
73
102
|
// Detect keyboard visibility
|
|
74
103
|
const detectKeyboardVisibility = useCallback(() => {
|
|
@@ -82,12 +111,14 @@ export const useMobileKeyboardOptimization = (
|
|
|
82
111
|
setKeyboardState(prev => ({
|
|
83
112
|
...prev,
|
|
84
113
|
isVisible,
|
|
85
|
-
height
|
|
114
|
+
height: isVisible ? heightDifference : 0
|
|
115
|
+
}))
|
|
86
116
|
|
|
87
117
|
callbacks.onKeyboardStateChanged?.({
|
|
88
118
|
...keyboardState,
|
|
89
119
|
isVisible,
|
|
90
|
-
height
|
|
120
|
+
height: isVisible ? heightDifference : 0
|
|
121
|
+
})
|
|
91
122
|
}
|
|
92
123
|
|
|
93
124
|
lastKeyboardHeightRef.current = currentHeight
|
|
@@ -128,7 +159,7 @@ export const useMobileKeyboardOptimization = (
|
|
|
128
159
|
|
|
129
160
|
setPerformanceMetrics(prev => ({
|
|
130
161
|
...prev,
|
|
131
|
-
frameRate,
|
|
162
|
+
frameRate: fps,
|
|
132
163
|
inputLatency
|
|
133
164
|
}))
|
|
134
165
|
|
|
@@ -149,28 +180,30 @@ export const useMobileKeyboardOptimization = (
|
|
|
149
180
|
}, [enablePerformanceMonitoring])
|
|
150
181
|
|
|
151
182
|
// Keyboard type optimization
|
|
152
|
-
const optimizeKeyboardType = useCallback((inputType) => {
|
|
183
|
+
const optimizeKeyboardType = useCallback((inputType: string) => {
|
|
153
184
|
setIsOptimizing(true)
|
|
154
185
|
|
|
155
186
|
setTimeout(() => {
|
|
156
|
-
const keyboardOptimizations] = [
|
|
187
|
+
const keyboardOptimizations: KeyboardOptimization[] = [
|
|
157
188
|
{
|
|
158
|
-
id,
|
|
159
|
-
name,
|
|
160
|
-
type,
|
|
161
|
-
applied,
|
|
162
|
-
impact,
|
|
163
|
-
description} input`,
|
|
164
|
-
keyboardType,
|
|
165
|
-
inputMode
|
|
189
|
+
id: 'keyboard-type-1',
|
|
190
|
+
name: 'Keyboard Type Optimization',
|
|
191
|
+
type: 'keyboard',
|
|
192
|
+
applied: true,
|
|
193
|
+
impact: 'high',
|
|
194
|
+
description: `Optimized keyboard type for ${inputType} input`,
|
|
195
|
+
keyboardType: inputType,
|
|
196
|
+
inputMode: inputType
|
|
197
|
+
},
|
|
166
198
|
{
|
|
167
|
-
id,
|
|
168
|
-
name,
|
|
169
|
-
type,
|
|
170
|
-
applied,
|
|
171
|
-
impact,
|
|
172
|
-
description,
|
|
173
|
-
inputMode
|
|
199
|
+
id: 'keyboard-type-2',
|
|
200
|
+
name: 'Input Mode Enhancement',
|
|
201
|
+
type: 'input',
|
|
202
|
+
applied: true,
|
|
203
|
+
impact: 'medium',
|
|
204
|
+
description: 'Enhanced input mode for better mobile experience',
|
|
205
|
+
inputMode: inputType
|
|
206
|
+
}
|
|
174
207
|
]
|
|
175
208
|
|
|
176
209
|
setOptimizations(prev => [...prev, ...keyboardOptimizations])
|
|
@@ -183,27 +216,29 @@ export const useMobileKeyboardOptimization = (
|
|
|
183
216
|
}, [callbacks])
|
|
184
217
|
|
|
185
218
|
// Input behavior optimization
|
|
186
|
-
const optimizeInputBehavior = useCallback((inputType) => {
|
|
219
|
+
const optimizeInputBehavior = useCallback((inputType: string) => {
|
|
187
220
|
setIsOptimizing(true)
|
|
188
221
|
|
|
189
222
|
setTimeout(() => {
|
|
190
|
-
const inputOptimizations] = [
|
|
223
|
+
const inputOptimizations: KeyboardOptimization[] = [
|
|
191
224
|
{
|
|
192
|
-
id,
|
|
193
|
-
name,
|
|
194
|
-
type,
|
|
195
|
-
applied,
|
|
196
|
-
impact,
|
|
197
|
-
description,
|
|
198
|
-
inputMode
|
|
225
|
+
id: 'input-behavior-1',
|
|
226
|
+
name: 'Auto-capitalization Optimization',
|
|
227
|
+
type: 'input',
|
|
228
|
+
applied: true,
|
|
229
|
+
impact: 'medium',
|
|
230
|
+
description: 'Optimized auto-capitalization for mobile input',
|
|
231
|
+
inputMode: inputType
|
|
232
|
+
},
|
|
199
233
|
{
|
|
200
|
-
id,
|
|
201
|
-
name,
|
|
202
|
-
type,
|
|
203
|
-
applied,
|
|
204
|
-
impact,
|
|
205
|
-
description,
|
|
206
|
-
inputMode
|
|
234
|
+
id: 'input-behavior-2',
|
|
235
|
+
name: 'Autocomplete Enhancement',
|
|
236
|
+
type: 'input',
|
|
237
|
+
applied: true,
|
|
238
|
+
impact: 'medium',
|
|
239
|
+
description: 'Enhanced autocomplete for better user experience',
|
|
240
|
+
inputMode: inputType
|
|
241
|
+
}
|
|
207
242
|
]
|
|
208
243
|
|
|
209
244
|
setOptimizations(prev => [...prev, ...inputOptimizations])
|
|
@@ -222,21 +257,23 @@ export const useMobileKeyboardOptimization = (
|
|
|
222
257
|
setIsOptimizing(true)
|
|
223
258
|
|
|
224
259
|
setTimeout(() => {
|
|
225
|
-
const performanceOptimizations] = [
|
|
260
|
+
const performanceOptimizations: KeyboardOptimization[] = [
|
|
226
261
|
{
|
|
227
|
-
id,
|
|
228
|
-
name,
|
|
229
|
-
type,
|
|
230
|
-
applied,
|
|
231
|
-
impact,
|
|
232
|
-
description
|
|
262
|
+
id: 'performance-1',
|
|
263
|
+
name: 'Input Latency Optimization',
|
|
264
|
+
type: 'performance',
|
|
265
|
+
applied: true,
|
|
266
|
+
impact: 'high',
|
|
267
|
+
description: 'Reduced input latency for smoother typing experience'
|
|
268
|
+
},
|
|
233
269
|
{
|
|
234
|
-
id,
|
|
235
|
-
name,
|
|
236
|
-
type,
|
|
237
|
-
applied,
|
|
238
|
-
impact,
|
|
239
|
-
description
|
|
270
|
+
id: 'performance-2',
|
|
271
|
+
name: 'Frame Rate Optimization',
|
|
272
|
+
type: 'performance',
|
|
273
|
+
applied: true,
|
|
274
|
+
impact: 'medium',
|
|
275
|
+
description: 'Optimized frame rate for keyboard interactions'
|
|
276
|
+
}
|
|
240
277
|
]
|
|
241
278
|
|
|
242
279
|
setOptimizations(prev => [...prev, ...performanceOptimizations])
|
|
@@ -255,21 +292,23 @@ export const useMobileKeyboardOptimization = (
|
|
|
255
292
|
setIsOptimizing(true)
|
|
256
293
|
|
|
257
294
|
setTimeout(() => {
|
|
258
|
-
const batteryOptimizations] = [
|
|
295
|
+
const batteryOptimizations: KeyboardOptimization[] = [
|
|
259
296
|
{
|
|
260
|
-
id,
|
|
261
|
-
name,
|
|
262
|
-
type,
|
|
263
|
-
applied,
|
|
264
|
-
impact,
|
|
265
|
-
description
|
|
297
|
+
id: 'battery-1',
|
|
298
|
+
name: 'Battery-Conscious Keyboard',
|
|
299
|
+
type: 'performance',
|
|
300
|
+
applied: true,
|
|
301
|
+
impact: 'medium',
|
|
302
|
+
description: 'Battery-optimized keyboard behavior'
|
|
303
|
+
},
|
|
266
304
|
{
|
|
267
|
-
id,
|
|
268
|
-
name,
|
|
269
|
-
type,
|
|
270
|
-
applied,
|
|
271
|
-
impact,
|
|
272
|
-
description
|
|
305
|
+
id: 'battery-2',
|
|
306
|
+
name: 'Efficient Input Processing',
|
|
307
|
+
type: 'performance',
|
|
308
|
+
applied: true,
|
|
309
|
+
impact: 'low',
|
|
310
|
+
description: 'Efficient input processing for battery optimization'
|
|
311
|
+
}
|
|
273
312
|
]
|
|
274
313
|
|
|
275
314
|
setOptimizations(prev => [...prev, ...batteryOptimizations])
|
|
@@ -288,21 +327,23 @@ export const useMobileKeyboardOptimization = (
|
|
|
288
327
|
setIsOptimizing(true)
|
|
289
328
|
|
|
290
329
|
setTimeout(() => {
|
|
291
|
-
const accessibilityFeatures] = [
|
|
330
|
+
const accessibilityFeatures: KeyboardOptimization[] = [
|
|
292
331
|
{
|
|
293
|
-
id,
|
|
294
|
-
name,
|
|
295
|
-
type,
|
|
296
|
-
applied,
|
|
297
|
-
impact,
|
|
298
|
-
description
|
|
332
|
+
id: 'accessibility-1',
|
|
333
|
+
name: 'Keyboard Navigation',
|
|
334
|
+
type: 'accessibility',
|
|
335
|
+
applied: true,
|
|
336
|
+
impact: 'high',
|
|
337
|
+
description: 'Enhanced keyboard navigation support'
|
|
338
|
+
},
|
|
299
339
|
{
|
|
300
|
-
id,
|
|
301
|
-
name,
|
|
302
|
-
type,
|
|
303
|
-
applied,
|
|
304
|
-
impact,
|
|
305
|
-
description
|
|
340
|
+
id: 'accessibility-2',
|
|
341
|
+
name: 'Screen Reader Support',
|
|
342
|
+
type: 'accessibility',
|
|
343
|
+
applied: true,
|
|
344
|
+
impact: 'medium',
|
|
345
|
+
description: 'Improved screen reader compatibility'
|
|
346
|
+
}
|
|
306
347
|
]
|
|
307
348
|
|
|
308
349
|
setOptimizations(prev => [...prev, ...accessibilityFeatures])
|
|
@@ -315,7 +356,7 @@ export const useMobileKeyboardOptimization = (
|
|
|
315
356
|
}, [enableAccessibilitySupport, callbacks])
|
|
316
357
|
|
|
317
358
|
// Auto-optimize based on input type
|
|
318
|
-
const autoOptimizeForInputType = useCallback((inputType) => {
|
|
359
|
+
const autoOptimizeForInputType = useCallback((inputType: string) => {
|
|
319
360
|
optimizeKeyboardType(inputType)
|
|
320
361
|
optimizeInputBehavior(inputType)
|
|
321
362
|
optimizePerformance()
|
|
@@ -325,7 +366,7 @@ export const useMobileKeyboardOptimization = (
|
|
|
325
366
|
|
|
326
367
|
// Get keyboard optimization recommendations
|
|
327
368
|
const getOptimizationRecommendations = useCallback(() => {
|
|
328
|
-
const recommendations] = []
|
|
369
|
+
const recommendations: string[] = []
|
|
329
370
|
|
|
330
371
|
if (performanceMetrics.frameRate < performanceThreshold) {
|
|
331
372
|
recommendations.push('Consider reducing keyboard animation complexity to improve frame rate')
|
|
@@ -412,18 +453,18 @@ export const useMobileKeyboardOptimization = (
|
|
|
412
453
|
autoOptimizeForInputType,
|
|
413
454
|
|
|
414
455
|
// Utility functions
|
|
415
|
-
isKeyboardVisible) => keyboardState.isVisible,
|
|
416
|
-
getKeyboardHeight) => keyboardState.height,
|
|
417
|
-
getPlatform) => keyboardState.platform,
|
|
418
|
-
getOrientation) => keyboardState.orientation,
|
|
419
|
-
getOptimizationStatus) => ({
|
|
420
|
-
keyboard=> o.type === 'keyboard'),
|
|
421
|
-
input=> o.type === 'input'),
|
|
422
|
-
performance=> o.type === 'performance'),
|
|
423
|
-
accessibility=> o.type === 'accessibility')
|
|
456
|
+
isKeyboardVisible: () => keyboardState.isVisible,
|
|
457
|
+
getKeyboardHeight: () => keyboardState.height,
|
|
458
|
+
getPlatform: () => keyboardState.platform,
|
|
459
|
+
getOrientation: () => keyboardState.orientation,
|
|
460
|
+
getOptimizationStatus: () => ({
|
|
461
|
+
keyboard: optimizations.some(o => o.type === 'keyboard'),
|
|
462
|
+
input: optimizations.some(o => o.type === 'input'),
|
|
463
|
+
performance: optimizations.some(o => o.type === 'performance'),
|
|
464
|
+
accessibility: optimizations.some(o => o.type === 'accessibility')
|
|
424
465
|
}),
|
|
425
466
|
getOptimizationRecommendations,
|
|
426
|
-
clearOptimizations) => setOptimizations([])
|
|
467
|
+
clearOptimizations: () => setOptimizations([])
|
|
427
468
|
}
|
|
428
469
|
}
|
|
429
470
|
|