@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.2.11 → 0.2.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/CHANGELOG.md +1 -1
- package/dist/components/ui/accessibility-demo.d.ts +5 -257
- package/dist/components/ui/accessibility-demo.d.ts.map +1 -0
- package/dist/components/ui/accessibility-demo.esm.js +80 -258
- package/dist/components/ui/accessibility-demo.js +80 -258
- package/dist/components/ui/advanced-component-architecture-demo.d.ts +4 -718
- package/dist/components/ui/advanced-component-architecture-demo.d.ts.map +1 -0
- package/dist/components/ui/advanced-component-architecture-demo.esm.js +256 -916
- package/dist/components/ui/advanced-component-architecture-demo.js +256 -916
- package/dist/components/ui/advanced-transition-system-demo.d.ts +3 -660
- package/dist/components/ui/advanced-transition-system-demo.d.ts.map +1 -0
- package/dist/components/ui/advanced-transition-system-demo.esm.js +59 -670
- package/dist/components/ui/advanced-transition-system-demo.js +59 -670
- package/dist/components/ui/advanced-transition-system.d.ts +35 -381
- package/dist/components/ui/advanced-transition-system.d.ts.map +1 -0
- package/dist/components/ui/advanced-transition-system.esm.js +194 -378
- package/dist/components/ui/advanced-transition-system.js +194 -378
- package/dist/components/ui/animation/animated-container.d.ts +11 -160
- package/dist/components/ui/animation/animated-container.d.ts.map +1 -0
- package/dist/components/ui/animation/animated-container.esm.js +98 -159
- package/dist/components/ui/animation/animated-container.js +98 -159
- package/dist/components/ui/animation/index.d.ts +7 -9
- package/dist/components/ui/animation/index.d.ts.map +1 -0
- package/dist/components/ui/animation/index.esm.js +3 -18
- package/dist/components/ui/animation/index.js +3 -18
- package/dist/components/ui/animation/staggered-container.d.ts +8 -62
- package/dist/components/ui/animation/staggered-container.d.ts.map +1 -0
- package/dist/components/ui/animation/staggered-container.esm.js +37 -68
- package/dist/components/ui/animation/staggered-container.js +37 -68
- package/dist/components/ui/animation-demo.d.ts +3 -238
- package/dist/components/ui/animation-demo.d.ts.map +1 -0
- package/dist/components/ui/animation-demo.esm.js +30 -250
- package/dist/components/ui/animation-demo.js +30 -250
- package/dist/components/ui/badge.d.ts +9 -27
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.esm.js +15 -28
- package/dist/components/ui/badge.js +15 -28
- package/dist/components/ui/battery-conscious-animation-demo.d.ts +4 -561
- package/dist/components/ui/battery-conscious-animation-demo.d.ts.map +1 -0
- package/dist/components/ui/battery-conscious-animation-demo.esm.js +136 -565
- package/dist/components/ui/battery-conscious-animation-demo.js +136 -565
- package/dist/components/ui/border-radius-shadow-demo.d.ts +3 -183
- package/dist/components/ui/border-radius-shadow-demo.d.ts.map +1 -0
- package/dist/components/ui/border-radius-shadow-demo.esm.js +3 -184
- package/dist/components/ui/border-radius-shadow-demo.js +3 -184
- package/dist/components/ui/button.d.ts +8 -32
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.esm.js +14 -33
- package/dist/components/ui/button.js +14 -33
- package/dist/components/ui/card.d.ts +25 -193
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.esm.js +74 -188
- package/dist/components/ui/card.js +74 -188
- package/dist/components/ui/checkbox.d.ts +6 -24
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.esm.js +11 -30
- package/dist/components/ui/checkbox.js +11 -30
- package/dist/components/ui/color-preview.d.ts +12 -398
- package/dist/components/ui/color-preview.d.ts.map +1 -0
- package/dist/components/ui/color-preview.esm.js +50 -405
- package/dist/components/ui/color-preview.js +50 -405
- package/dist/components/ui/data-display/chart.d.ts +4 -645
- package/dist/components/ui/data-display/chart.d.ts.map +1 -0
- package/dist/components/ui/data-display/chart.esm.js +210 -632
- package/dist/components/ui/data-display/chart.js +210 -632
- package/dist/components/ui/data-display/data-grid-simple.d.ts +5 -73
- package/dist/components/ui/data-display/data-grid-simple.d.ts.map +1 -0
- package/dist/components/ui/data-display/data-grid-simple.esm.js +16 -74
- package/dist/components/ui/data-display/data-grid-simple.js +16 -74
- package/dist/components/ui/data-display/data-grid.d.ts +4 -669
- package/dist/components/ui/data-display/data-grid.d.ts.map +1 -0
- package/dist/components/ui/data-display/data-grid.esm.js +173 -661
- package/dist/components/ui/data-display/data-grid.js +173 -661
- package/dist/components/ui/data-display/list.d.ts +4 -447
- package/dist/components/ui/data-display/list.d.ts.map +1 -0
- package/dist/components/ui/data-display/list.esm.js +88 -446
- package/dist/components/ui/data-display/list.js +88 -446
- package/dist/components/ui/data-display/table.d.ts +4 -471
- package/dist/components/ui/data-display/table.d.ts.map +1 -0
- package/dist/components/ui/data-display/table.esm.js +109 -468
- package/dist/components/ui/data-display/table.js +109 -468
- package/dist/components/ui/data-display/timeline.d.ts +4 -432
- package/dist/components/ui/data-display/timeline.d.ts.map +1 -0
- package/dist/components/ui/data-display/timeline.esm.js +92 -431
- package/dist/components/ui/data-display/timeline.js +92 -431
- package/dist/components/ui/data-display/tree.d.ts +4 -593
- package/dist/components/ui/data-display/tree.d.ts.map +1 -0
- package/dist/components/ui/data-display/tree.esm.js +211 -585
- package/dist/components/ui/data-display/tree.js +211 -585
- package/dist/components/ui/data-display/types.d.ts +418 -471
- package/dist/components/ui/data-display/types.d.ts.map +1 -0
- package/dist/components/ui/data-display/types.esm.js +1 -530
- package/dist/components/ui/data-display/types.js +1 -530
- package/dist/components/ui/enterprise-mobile-experience-demo.d.ts +3 -735
- package/dist/components/ui/enterprise-mobile-experience-demo.d.ts.map +1 -0
- package/dist/components/ui/enterprise-mobile-experience-demo.esm.js +76 -749
- package/dist/components/ui/enterprise-mobile-experience-demo.js +76 -749
- package/dist/components/ui/enterprise-mobile-experience.d.ts +52 -441
- package/dist/components/ui/enterprise-mobile-experience.d.ts.map +1 -0
- package/dist/components/ui/enterprise-mobile-experience.esm.js +152 -460
- package/dist/components/ui/enterprise-mobile-experience.js +152 -460
- package/dist/components/ui/feedback/alert.d.ts +4 -153
- package/dist/components/ui/feedback/alert.d.ts.map +1 -0
- package/dist/components/ui/feedback/alert.esm.js +40 -148
- package/dist/components/ui/feedback/alert.js +40 -148
- package/dist/components/ui/feedback/progress.d.ts +4 -287
- package/dist/components/ui/feedback/progress.d.ts.map +1 -0
- package/dist/components/ui/feedback/progress.esm.js +74 -278
- package/dist/components/ui/feedback/progress.js +74 -278
- package/dist/components/ui/feedback/skeleton.d.ts +7 -181
- package/dist/components/ui/feedback/skeleton.d.ts.map +1 -0
- package/dist/components/ui/feedback/skeleton.esm.js +64 -173
- package/dist/components/ui/feedback/skeleton.js +64 -173
- package/dist/components/ui/feedback/toast.d.ts +7 -276
- package/dist/components/ui/feedback/toast.d.ts.map +1 -0
- package/dist/components/ui/feedback/toast.esm.js +86 -225
- package/dist/components/ui/feedback/toast.js +86 -225
- package/dist/components/ui/feedback/types.d.ts +85 -99
- package/dist/components/ui/feedback/types.d.ts.map +1 -0
- package/dist/components/ui/feedback/types.esm.js +1 -125
- package/dist/components/ui/feedback/types.js +1 -125
- package/dist/components/ui/font-preview.d.ts +11 -278
- package/dist/components/ui/font-preview.d.ts.map +1 -0
- package/dist/components/ui/font-preview.esm.js +56 -283
- package/dist/components/ui/font-preview.js +56 -283
- package/dist/components/ui/form-demo.d.ts +4 -544
- package/dist/components/ui/form-demo.d.ts.map +1 -0
- package/dist/components/ui/form-demo.esm.js +191 -553
- package/dist/components/ui/form-demo.js +191 -553
- package/dist/components/ui/hardware-acceleration-demo.d.ts +4 -540
- package/dist/components/ui/hardware-acceleration-demo.d.ts.map +1 -0
- package/dist/components/ui/hardware-acceleration-demo.esm.js +103 -544
- package/dist/components/ui/hardware-acceleration-demo.js +103 -544
- package/dist/components/ui/input.d.ts +8 -32
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.esm.js +13 -32
- package/dist/components/ui/input.js +13 -32
- package/dist/components/ui/label.d.ts +5 -13
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.esm.js +6 -16
- package/dist/components/ui/label.js +6 -16
- package/dist/components/ui/layout-demo.d.ts +4 -352
- package/dist/components/ui/layout-demo.d.ts.map +1 -0
- package/dist/components/ui/layout-demo.esm.js +76 -367
- package/dist/components/ui/layout-demo.js +76 -367
- package/dist/components/ui/layouts/adaptive-layout.d.ts +14 -130
- package/dist/components/ui/layouts/adaptive-layout.d.ts.map +1 -0
- package/dist/components/ui/layouts/adaptive-layout.esm.js +60 -139
- package/dist/components/ui/layouts/adaptive-layout.js +60 -139
- package/dist/components/ui/layouts/desktop-layout.d.ts +13 -217
- package/dist/components/ui/layouts/desktop-layout.d.ts.map +1 -0
- package/dist/components/ui/layouts/desktop-layout.esm.js +39 -224
- package/dist/components/ui/layouts/desktop-layout.js +39 -224
- package/dist/components/ui/layouts/index.d.ts +9 -5
- package/dist/components/ui/layouts/index.d.ts.map +1 -0
- package/dist/components/ui/layouts/index.esm.js +4 -10
- package/dist/components/ui/layouts/index.js +4 -10
- package/dist/components/ui/layouts/mobile-layout.d.ts +12 -156
- package/dist/components/ui/layouts/mobile-layout.d.ts.map +1 -0
- package/dist/components/ui/layouts/mobile-layout.esm.js +49 -162
- package/dist/components/ui/layouts/mobile-layout.js +49 -162
- package/dist/components/ui/layouts/tablet-layout.d.ts +12 -190
- package/dist/components/ui/layouts/tablet-layout.d.ts.map +1 -0
- package/dist/components/ui/layouts/tablet-layout.esm.js +53 -197
- package/dist/components/ui/layouts/tablet-layout.js +53 -197
- package/dist/components/ui/mobile-form-validation.d.ts +28 -435
- package/dist/components/ui/mobile-form-validation.d.ts.map +1 -0
- package/dist/components/ui/mobile-form-validation.esm.js +185 -420
- package/dist/components/ui/mobile-form-validation.js +185 -420
- package/dist/components/ui/mobile-input-demo.d.ts +3 -197
- package/dist/components/ui/mobile-input-demo.d.ts.map +1 -0
- package/dist/components/ui/mobile-input-demo.esm.js +11 -198
- package/dist/components/ui/mobile-input-demo.js +11 -198
- package/dist/components/ui/mobile-input.d.ts +61 -268
- package/dist/components/ui/mobile-input.d.ts.map +1 -0
- package/dist/components/ui/mobile-input.esm.js +187 -270
- package/dist/components/ui/mobile-input.js +187 -270
- package/dist/components/ui/mobile-skeleton-loading-demo.d.ts +4 -628
- package/dist/components/ui/mobile-skeleton-loading-demo.d.ts.map +1 -0
- package/dist/components/ui/mobile-skeleton-loading-demo.esm.js +144 -638
- package/dist/components/ui/mobile-skeleton-loading-demo.js +144 -638
- package/dist/components/ui/navigation/breadcrumb.d.ts +8 -148
- package/dist/components/ui/navigation/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/navigation/breadcrumb.esm.js +51 -154
- package/dist/components/ui/navigation/breadcrumb.js +51 -154
- package/dist/components/ui/navigation/index.d.ts +12 -25
- package/dist/components/ui/navigation/index.d.ts.map +1 -0
- package/dist/components/ui/navigation/index.esm.js +0 -3
- package/dist/components/ui/navigation/index.js +0 -3
- package/dist/components/ui/navigation/menu.d.ts +8 -365
- package/dist/components/ui/navigation/menu.d.ts.map +1 -0
- package/dist/components/ui/navigation/menu.esm.js +178 -365
- package/dist/components/ui/navigation/menu.js +178 -365
- package/dist/components/ui/navigation/navigation-demo.d.ts +7 -168
- package/dist/components/ui/navigation/navigation-demo.d.ts.map +1 -0
- package/dist/components/ui/navigation/navigation-demo.esm.js +130 -315
- package/dist/components/ui/navigation/navigation-demo.js +130 -315
- package/dist/components/ui/navigation/pagination.d.ts +8 -260
- package/dist/components/ui/navigation/pagination.d.ts.map +1 -0
- package/dist/components/ui/navigation/pagination.esm.js +142 -264
- package/dist/components/ui/navigation/pagination.js +142 -264
- package/dist/components/ui/navigation/sidebar.d.ts +8 -374
- package/dist/components/ui/navigation/sidebar.d.ts.map +1 -0
- package/dist/components/ui/navigation/sidebar.esm.js +156 -368
- package/dist/components/ui/navigation/sidebar.js +156 -368
- package/dist/components/ui/navigation/stepper.d.ts +8 -293
- package/dist/components/ui/navigation/stepper.d.ts.map +1 -0
- package/dist/components/ui/navigation/stepper.esm.js +131 -295
- package/dist/components/ui/navigation/stepper.js +131 -295
- package/dist/components/ui/navigation/tabs.d.ts +8 -195
- package/dist/components/ui/navigation/tabs.d.ts.map +1 -0
- package/dist/components/ui/navigation/tabs.esm.js +89 -198
- package/dist/components/ui/navigation/tabs.js +89 -198
- package/dist/components/ui/navigation/types.d.ts +216 -254
- package/dist/components/ui/navigation/types.d.ts.map +1 -0
- package/dist/components/ui/navigation/types.esm.js +1 -295
- package/dist/components/ui/navigation/types.js +1 -295
- package/dist/components/ui/overlay/backdrop.d.ts +12 -76
- package/dist/components/ui/overlay/backdrop.d.ts.map +1 -0
- package/dist/components/ui/overlay/backdrop.esm.js +39 -78
- package/dist/components/ui/overlay/backdrop.js +39 -78
- package/dist/components/ui/overlay/focus-manager.d.ts +10 -138
- package/dist/components/ui/overlay/focus-manager.d.ts.map +1 -0
- package/dist/components/ui/overlay/focus-manager.esm.js +96 -140
- package/dist/components/ui/overlay/focus-manager.js +96 -140
- package/dist/components/ui/overlay/index.d.ts +10 -27
- package/dist/components/ui/overlay/index.d.ts.map +1 -0
- package/dist/components/ui/overlay/index.esm.js +0 -5
- package/dist/components/ui/overlay/index.js +0 -5
- package/dist/components/ui/overlay/modal.d.ts +7 -261
- package/dist/components/ui/overlay/modal.d.ts.map +1 -0
- package/dist/components/ui/overlay/modal.esm.js +94 -249
- package/dist/components/ui/overlay/modal.js +94 -249
- package/dist/components/ui/overlay/overlay-manager.d.ts +13 -104
- package/dist/components/ui/overlay/overlay-manager.d.ts.map +1 -0
- package/dist/components/ui/overlay/overlay-manager.esm.js +60 -100
- package/dist/components/ui/overlay/overlay-manager.js +60 -100
- package/dist/components/ui/overlay/popover.d.ts +8 -449
- package/dist/components/ui/overlay/popover.d.ts.map +1 -0
- package/dist/components/ui/overlay/popover.esm.js +258 -438
- package/dist/components/ui/overlay/popover.js +258 -438
- package/dist/components/ui/overlay/portal.d.ts +4 -74
- package/dist/components/ui/overlay/portal.d.ts.map +1 -0
- package/dist/components/ui/overlay/portal.esm.js +45 -74
- package/dist/components/ui/overlay/portal.js +45 -74
- package/dist/components/ui/overlay/tooltip.d.ts +5 -297
- package/dist/components/ui/overlay/tooltip.d.ts.map +1 -0
- package/dist/components/ui/overlay/tooltip.esm.js +202 -288
- package/dist/components/ui/overlay/tooltip.js +202 -288
- package/dist/components/ui/overlay/types.d.ts +144 -167
- package/dist/components/ui/overlay/types.d.ts.map +1 -0
- package/dist/components/ui/overlay/types.esm.js +1 -196
- package/dist/components/ui/overlay/types.js +1 -196
- package/dist/components/ui/performance-demo.d.ts +3 -583
- package/dist/components/ui/performance-demo.d.ts.map +1 -0
- package/dist/components/ui/performance-demo.esm.js +110 -596
- package/dist/components/ui/performance-demo.js +110 -596
- package/dist/components/ui/semantic-input-system-demo.d.ts +3 -490
- package/dist/components/ui/semantic-input-system-demo.d.ts.map +1 -0
- package/dist/components/ui/semantic-input-system-demo.esm.js +87 -501
- package/dist/components/ui/semantic-input-system-demo.js +87 -501
- package/dist/components/ui/theme-customizer.d.ts +19 -370
- package/dist/components/ui/theme-customizer.d.ts.map +1 -0
- package/dist/components/ui/theme-customizer.esm.js +123 -371
- package/dist/components/ui/theme-customizer.js +123 -371
- package/dist/components/ui/theme-preview.d.ts +9 -303
- package/dist/components/ui/theme-preview.d.ts.map +1 -0
- package/dist/components/ui/theme-preview.esm.js +44 -306
- package/dist/components/ui/theme-preview.js +44 -306
- package/dist/components/ui/theme-switcher.d.ts +9 -257
- package/dist/components/ui/theme-switcher.d.ts.map +1 -0
- package/dist/components/ui/theme-switcher.esm.js +79 -258
- package/dist/components/ui/theme-switcher.js +79 -258
- package/dist/components/ui/theme-toggle.d.ts +3 -34
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.esm.js +22 -35
- package/dist/components/ui/theme-toggle.js +22 -35
- package/dist/components/ui/token-demo.d.ts +3 -188
- package/dist/components/ui/token-demo.d.ts.map +1 -0
- package/dist/components/ui/token-demo.esm.js +42 -189
- package/dist/components/ui/token-demo.js +42 -189
- package/dist/components/ui/touch-demo.d.ts +3 -455
- package/dist/components/ui/touch-demo.d.ts.map +1 -0
- package/dist/components/ui/touch-demo.esm.js +96 -462
- package/dist/components/ui/touch-demo.js +96 -462
- package/dist/components/ui/touch-friendly-interface-demo.d.ts +3 -512
- package/dist/components/ui/touch-friendly-interface-demo.d.ts.map +1 -0
- package/dist/components/ui/touch-friendly-interface-demo.esm.js +63 -519
- package/dist/components/ui/touch-friendly-interface-demo.js +63 -519
- package/dist/components/ui/touch-friendly-interface.d.ts +21 -282
- package/dist/components/ui/touch-friendly-interface.d.ts.map +1 -0
- package/dist/components/ui/touch-friendly-interface.esm.js +103 -281
- package/dist/components/ui/touch-friendly-interface.js +103 -281
- package/dist/hooks/index.d.ts +47 -161
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.esm.js +23 -181
- package/dist/hooks/index.js +23 -181
- package/dist/hooks/use-accessibility-support.d.ts +66 -508
- package/dist/hooks/use-accessibility-support.d.ts.map +1 -0
- package/dist/hooks/use-accessibility-support.esm.js +377 -518
- package/dist/hooks/use-accessibility-support.js +377 -518
- package/dist/hooks/use-adaptive-layout.d.ts +51 -281
- package/dist/hooks/use-adaptive-layout.d.ts.map +1 -0
- package/dist/hooks/use-adaptive-layout.esm.js +212 -287
- package/dist/hooks/use-adaptive-layout.js +212 -287
- package/dist/hooks/use-advanced-patterns.d.ts +78 -282
- package/dist/hooks/use-advanced-patterns.d.ts.map +1 -0
- package/dist/hooks/use-advanced-patterns.esm.js +185 -293
- package/dist/hooks/use-advanced-patterns.js +185 -293
- package/dist/hooks/use-advanced-transition-system.d.ts +51 -382
- package/dist/hooks/use-advanced-transition-system.d.ts.map +1 -0
- package/dist/hooks/use-advanced-transition-system.esm.js +286 -392
- package/dist/hooks/use-advanced-transition-system.js +286 -392
- package/dist/hooks/use-animation-profile.d.ts +39 -279
- package/dist/hooks/use-animation-profile.d.ts.map +1 -0
- package/dist/hooks/use-animation-profile.esm.js +221 -283
- package/dist/hooks/use-animation-profile.js +221 -283
- package/dist/hooks/use-battery-animations.d.ts +47 -376
- package/dist/hooks/use-battery-animations.d.ts.map +1 -0
- package/dist/hooks/use-battery-animations.esm.js +310 -384
- package/dist/hooks/use-battery-animations.js +310 -384
- package/dist/hooks/use-battery-conscious-loading.d.ts +50 -465
- package/dist/hooks/use-battery-conscious-loading.d.ts.map +1 -0
- package/dist/hooks/use-battery-conscious-loading.esm.js +374 -468
- package/dist/hooks/use-battery-conscious-loading.js +374 -468
- package/dist/hooks/use-battery-optimization.d.ts +39 -322
- package/dist/hooks/use-battery-optimization.d.ts.map +1 -0
- package/dist/hooks/use-battery-optimization.esm.js +267 -329
- package/dist/hooks/use-battery-optimization.js +267 -329
- package/dist/hooks/use-battery-status.d.ts +49 -289
- package/dist/hooks/use-battery-status.d.ts.map +1 -0
- package/dist/hooks/use-battery-status.esm.js +213 -293
- package/dist/hooks/use-battery-status.js +213 -293
- package/dist/hooks/use-component-performance.d.ts +60 -336
- package/dist/hooks/use-component-performance.d.ts.map +1 -0
- package/dist/hooks/use-component-performance.esm.js +235 -341
- package/dist/hooks/use-component-performance.js +235 -341
- package/dist/hooks/use-device-loading-states.d.ts +53 -448
- package/dist/hooks/use-device-loading-states.d.ts.map +1 -0
- package/dist/hooks/use-device-loading-states.esm.js +356 -457
- package/dist/hooks/use-device-loading-states.js +356 -457
- package/dist/hooks/use-device.d.ts +18 -102
- package/dist/hooks/use-device.d.ts.map +1 -0
- package/dist/hooks/use-device.esm.js +77 -102
- package/dist/hooks/use-device.js +77 -102
- package/dist/hooks/use-enterprise-mobile-experience.d.ts +72 -474
- package/dist/hooks/use-enterprise-mobile-experience.d.ts.map +1 -0
- package/dist/hooks/use-enterprise-mobile-experience.esm.js +349 -487
- package/dist/hooks/use-enterprise-mobile-experience.js +349 -487
- package/dist/hooks/use-form-feedback.d.ts +81 -391
- package/dist/hooks/use-form-feedback.d.ts.map +1 -0
- package/dist/hooks/use-form-feedback.esm.js +313 -398
- package/dist/hooks/use-form-feedback.js +313 -398
- package/dist/hooks/use-form-performance.d.ts +78 -501
- package/dist/hooks/use-form-performance.d.ts.map +1 -0
- package/dist/hooks/use-form-performance.esm.js +407 -500
- package/dist/hooks/use-form-performance.js +407 -500
- package/dist/hooks/use-frame-rate.d.ts +39 -241
- package/dist/hooks/use-frame-rate.d.ts.map +1 -0
- package/dist/hooks/use-frame-rate.esm.js +178 -251
- package/dist/hooks/use-frame-rate.js +178 -251
- package/dist/hooks/use-gestures.d.ts +84 -326
- package/dist/hooks/use-gestures.d.ts.map +1 -0
- package/dist/hooks/use-gestures.esm.js +230 -332
- package/dist/hooks/use-gestures.js +230 -332
- package/dist/hooks/use-hardware-acceleration.d.ts +45 -331
- package/dist/hooks/use-hardware-acceleration.d.ts.map +1 -0
- package/dist/hooks/use-hardware-acceleration.esm.js +246 -339
- package/dist/hooks/use-hardware-acceleration.js +246 -339
- package/dist/hooks/use-input-accessibility.d.ts +50 -443
- package/dist/hooks/use-input-accessibility.d.ts.map +1 -0
- package/dist/hooks/use-input-accessibility.esm.js +350 -454
- package/dist/hooks/use-input-accessibility.js +350 -454
- package/dist/hooks/use-input-performance.d.ts +47 -495
- package/dist/hooks/use-input-performance.d.ts.map +1 -0
- package/dist/hooks/use-input-performance.esm.js +419 -502
- package/dist/hooks/use-input-performance.js +419 -502
- package/dist/hooks/use-layout-performance.d.ts +33 -311
- package/dist/hooks/use-layout-performance.d.ts.map +1 -0
- package/dist/hooks/use-layout-performance.esm.js +233 -319
- package/dist/hooks/use-layout-performance.js +233 -319
- package/dist/hooks/use-loading-accessibility.d.ts +54 -524
- package/dist/hooks/use-loading-accessibility.d.ts.map +1 -0
- package/dist/hooks/use-loading-accessibility.esm.js +421 -531
- package/dist/hooks/use-loading-accessibility.js +421 -531
- package/dist/hooks/use-loading-performance.d.ts +43 -463
- package/dist/hooks/use-loading-performance.d.ts.map +1 -0
- package/dist/hooks/use-loading-performance.esm.js +398 -469
- package/dist/hooks/use-loading-performance.js +398 -469
- package/dist/hooks/use-memory-usage.d.ts +43 -277
- package/dist/hooks/use-memory-usage.d.ts.map +1 -0
- package/dist/hooks/use-memory-usage.esm.js +211 -287
- package/dist/hooks/use-memory-usage.js +211 -287
- package/dist/hooks/use-mobile-form-layout.d.ts +116 -451
- package/dist/hooks/use-mobile-form-layout.d.ts.map +1 -0
- package/dist/hooks/use-mobile-form-layout.esm.js +365 -458
- package/dist/hooks/use-mobile-form-layout.js +365 -458
- package/dist/hooks/use-mobile-form-validation.d.ts +87 -503
- package/dist/hooks/use-mobile-form-validation.d.ts.map +1 -0
- package/dist/hooks/use-mobile-form-validation.esm.js +384 -497
- package/dist/hooks/use-mobile-form-validation.js +384 -497
- package/dist/hooks/use-mobile-keyboard-optimization.d.ts +62 -461
- package/dist/hooks/use-mobile-keyboard-optimization.d.ts.map +1 -0
- package/dist/hooks/use-mobile-keyboard-optimization.esm.js +354 -468
- package/dist/hooks/use-mobile-keyboard-optimization.js +354 -468
- package/dist/hooks/use-mobile-layout.d.ts +48 -292
- package/dist/hooks/use-mobile-layout.d.ts.map +1 -0
- package/dist/hooks/use-mobile-layout.esm.js +207 -294
- package/dist/hooks/use-mobile-layout.js +207 -294
- package/dist/hooks/use-mobile-optimization.d.ts +49 -398
- package/dist/hooks/use-mobile-optimization.d.ts.map +1 -0
- package/dist/hooks/use-mobile-optimization.esm.js +308 -404
- package/dist/hooks/use-mobile-optimization.js +308 -404
- package/dist/hooks/use-mobile-skeleton.d.ts +51 -391
- package/dist/hooks/use-mobile-skeleton.d.ts.map +1 -0
- package/dist/hooks/use-mobile-skeleton.esm.js +300 -402
- package/dist/hooks/use-mobile-skeleton.js +300 -402
- package/dist/hooks/use-mobile-touch.d.ts +73 -399
- package/dist/hooks/use-mobile-touch.d.ts.map +1 -0
- package/dist/hooks/use-mobile-touch.esm.js +314 -412
- package/dist/hooks/use-mobile-touch.js +314 -412
- package/dist/hooks/use-performance-throttling.d.ts +42 -340
- package/dist/hooks/use-performance-throttling.d.ts.map +1 -0
- package/dist/hooks/use-performance-throttling.esm.js +276 -344
- package/dist/hooks/use-performance-throttling.js +276 -344
- package/dist/hooks/use-performance.d.ts +65 -306
- package/dist/hooks/use-performance.d.ts.map +1 -0
- package/dist/hooks/use-performance.esm.js +216 -313
- package/dist/hooks/use-performance.js +216 -313
- package/dist/hooks/use-reusable-architecture.d.ts +82 -400
- package/dist/hooks/use-reusable-architecture.d.ts.map +1 -0
- package/dist/hooks/use-reusable-architecture.esm.js +255 -408
- package/dist/hooks/use-reusable-architecture.js +255 -408
- package/dist/hooks/use-semantic-input-types.d.ts +51 -348
- package/dist/hooks/use-semantic-input-types.d.ts.map +1 -0
- package/dist/hooks/use-semantic-input-types.esm.js +290 -356
- package/dist/hooks/use-semantic-input-types.js +290 -356
- package/dist/hooks/use-semantic-input.d.ts +62 -552
- package/dist/hooks/use-semantic-input.d.ts.map +1 -0
- package/dist/hooks/use-semantic-input.esm.js +446 -549
- package/dist/hooks/use-semantic-input.js +446 -549
- package/dist/hooks/use-tablet-layout.d.ts +67 -375
- package/dist/hooks/use-tablet-layout.d.ts.map +1 -0
- package/dist/hooks/use-tablet-layout.esm.js +279 -384
- package/dist/hooks/use-tablet-layout.js +279 -384
- package/dist/hooks/use-touch-friendly-input.d.ts +67 -512
- package/dist/hooks/use-touch-friendly-input.d.ts.map +1 -0
- package/dist/hooks/use-touch-friendly-input.esm.js +401 -519
- package/dist/hooks/use-touch-friendly-input.js +401 -519
- package/dist/hooks/use-touch-friendly-interface.d.ts +48 -321
- package/dist/hooks/use-touch-friendly-interface.d.ts.map +1 -0
- package/dist/hooks/use-touch-friendly-interface.esm.js +242 -331
- package/dist/hooks/use-touch-friendly-interface.js +242 -331
- package/dist/hooks/use-touch-optimization.d.ts +56 -363
- package/dist/hooks/use-touch-optimization.d.ts.map +1 -0
- package/dist/hooks/use-touch-optimization.esm.js +288 -370
- package/dist/hooks/use-touch-optimization.js +288 -370
- package/dist/index.d.ts +168 -17
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +150 -161
- package/dist/index.js +150 -161
- package/dist/lib/utils.d.ts +3 -3
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.esm.js +4 -5
- package/dist/lib/utils.js +4 -5
- package/dist/plugins/theme-css-generator.d.ts +3 -345
- package/dist/plugins/theme-css-generator.d.ts.map +1 -0
- package/dist/plugins/theme-css-generator.esm.js +292 -346
- package/dist/plugins/theme-css-generator.js +292 -346
- package/dist/provider.d.ts +6 -14
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.esm.js +3 -19
- package/dist/provider.js +3 -19
- package/dist/styles/layers/validation.d.ts +20 -0
- package/dist/styles/layers/validation.d.ts.map +1 -0
- package/dist/styles/layers/validation.esm.js +275 -0
- package/dist/styles/layers/validation.js +275 -0
- package/dist/styles.css +1 -1
- package/dist/theme.d.ts +7 -678
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.esm.js +654 -658
- package/dist/theme.js +654 -658
- package/dist/themes/ThemeContext.d.ts +18 -22
- package/dist/themes/ThemeContext.d.ts.map +1 -0
- package/dist/themes/ThemeContext.esm.js +1 -27
- package/dist/themes/ThemeContext.js +1 -27
- package/dist/themes/ThemeProvider.d.ts +3 -222
- package/dist/themes/ThemeProvider.d.ts.map +1 -0
- package/dist/themes/ThemeProvider.esm.js +191 -223
- package/dist/themes/ThemeProvider.js +191 -223
- package/dist/themes/accessibility/index.d.ts +18 -6
- package/dist/themes/accessibility/index.d.ts.map +1 -0
- package/dist/themes/accessibility/index.esm.js +0 -4
- package/dist/themes/accessibility/index.js +0 -4
- package/dist/themes/accessibility.d.ts +53 -253
- package/dist/themes/accessibility.d.ts.map +1 -0
- package/dist/themes/accessibility.esm.js +175 -240
- package/dist/themes/accessibility.js +175 -240
- package/dist/themes/aria-patterns.d.ts +145 -410
- package/dist/themes/aria-patterns.d.ts.map +1 -0
- package/dist/themes/aria-patterns.esm.js +345 -401
- package/dist/themes/aria-patterns.js +345 -401
- package/dist/themes/base-themes.d.ts +29 -32
- package/dist/themes/base-themes.d.ts.map +1 -0
- package/dist/themes/base-themes.esm.js +15 -24
- package/dist/themes/base-themes.js +15 -24
- package/dist/themes/colorManager.d.ts +63 -326
- package/dist/themes/colorManager.d.ts.map +1 -0
- package/dist/themes/colorManager.esm.js +293 -357
- package/dist/themes/colorManager.js +293 -357
- package/dist/themes/examples/dark-theme.d.ts +13 -139
- package/dist/themes/examples/dark-theme.d.ts.map +1 -0
- package/dist/themes/examples/dark-theme.esm.js +129 -133
- package/dist/themes/examples/dark-theme.js +129 -133
- package/dist/themes/examples/minimal-theme.d.ts +6 -93
- package/dist/themes/examples/minimal-theme.d.ts.map +1 -0
- package/dist/themes/examples/minimal-theme.esm.js +80 -85
- package/dist/themes/examples/minimal-theme.js +80 -85
- package/dist/themes/focus-management.d.ts +100 -689
- package/dist/themes/focus-management.d.ts.map +1 -0
- package/dist/themes/focus-management.esm.js +541 -677
- package/dist/themes/focus-management.js +541 -677
- package/dist/themes/fontLoader.d.ts +48 -162
- package/dist/themes/fontLoader.d.ts.map +1 -0
- package/dist/themes/fontLoader.esm.js +151 -180
- package/dist/themes/fontLoader.js +151 -180
- package/dist/themes/high-contrast.d.ts +64 -613
- package/dist/themes/high-contrast.d.ts.map +1 -0
- package/dist/themes/high-contrast.esm.js +394 -558
- package/dist/themes/high-contrast.js +394 -558
- package/dist/themes/index.d.ts +3 -6
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.esm.js +1 -9
- package/dist/themes/index.js +1 -9
- package/dist/themes/inheritance.d.ts +86 -156
- package/dist/themes/inheritance.d.ts.map +1 -0
- package/dist/themes/inheritance.esm.js +145 -180
- package/dist/themes/inheritance.js +145 -180
- package/dist/themes/keyboard-navigation.d.ts +205 -542
- package/dist/themes/keyboard-navigation.d.ts.map +1 -0
- package/dist/themes/keyboard-navigation.esm.js +418 -510
- package/dist/themes/keyboard-navigation.js +418 -510
- package/dist/themes/motion-reduction.d.ts +107 -646
- package/dist/themes/motion-reduction.d.ts.map +1 -0
- package/dist/themes/motion-reduction.esm.js +434 -591
- package/dist/themes/motion-reduction.js +434 -591
- package/dist/themes/navigation.d.ts +163 -194
- package/dist/themes/navigation.d.ts.map +1 -0
- package/dist/themes/navigation.esm.js +1 -234
- package/dist/themes/navigation.js +1 -234
- package/dist/themes/screen-reader.d.ts +82 -641
- package/dist/themes/screen-reader.d.ts.map +1 -0
- package/dist/themes/screen-reader.esm.js +515 -616
- package/dist/themes/screen-reader.js +515 -616
- package/dist/themes/systemThemeDetector.d.ts +54 -144
- package/dist/themes/systemThemeDetector.d.ts.map +1 -0
- package/dist/themes/systemThemeDetector.esm.js +135 -164
- package/dist/themes/systemThemeDetector.js +135 -164
- package/dist/themes/themeCSSUpdater.d.ts +45 -228
- package/dist/themes/themeCSSUpdater.d.ts.map +1 -0
- package/dist/themes/themeCSSUpdater.esm.js +217 -252
- package/dist/themes/themeCSSUpdater.js +217 -252
- package/dist/themes/themePersistence.d.ts +80 -188
- package/dist/themes/themePersistence.d.ts.map +1 -0
- package/dist/themes/themePersistence.esm.js +181 -212
- package/dist/themes/themePersistence.js +181 -212
- package/dist/themes/themes/default.d.ts +9 -0
- package/dist/themes/themes/default.d.ts.map +1 -0
- package/dist/themes/themes/default.esm.js +584 -0
- package/dist/themes/themes/default.js +584 -0
- package/dist/themes/themes/harvey.d.ts +7 -0
- package/dist/themes/themes/harvey.d.ts.map +1 -0
- package/dist/themes/themes/harvey.esm.js +551 -0
- package/dist/themes/themes/harvey.js +551 -0
- package/dist/themes/themes/stan-design.d.ts +7 -678
- package/dist/themes/themes/stan-design.d.ts.map +1 -0
- package/dist/themes/themes/stan-design.esm.js +654 -658
- package/dist/themes/themes/stan-design.js +654 -658
- package/dist/themes/types.d.ts +330 -385
- package/dist/themes/types.d.ts.map +1 -0
- package/dist/themes/types.esm.js +1 -458
- package/dist/themes/types.js +1 -458
- package/dist/themes/useSystemTheme.d.ts +10 -42
- package/dist/themes/useSystemTheme.d.ts.map +1 -0
- package/dist/themes/useSystemTheme.esm.js +34 -42
- package/dist/themes/useSystemTheme.js +34 -42
- package/dist/themes/useTheme.d.ts +70 -20
- package/dist/themes/useTheme.d.ts.map +1 -0
- package/dist/themes/useTheme.esm.js +23 -28
- package/dist/themes/useTheme.js +23 -28
- package/dist/themes/validation.d.ts +70 -405
- package/dist/themes/validation.d.ts.map +1 -0
- package/dist/themes/validation.esm.js +380 -433
- package/dist/themes/validation.js +380 -433
- package/dist/tokens/index.d.ts +9 -23
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.esm.js +2 -13
- package/dist/tokens/index.js +2 -13
- package/dist/tokens/tokenExporter.d.ts +83 -335
- package/dist/tokens/tokenExporter.d.ts.map +1 -0
- package/dist/tokens/tokenExporter.esm.js +309 -373
- package/dist/tokens/tokenExporter.js +309 -373
- package/dist/tokens/tokenGenerator.d.ts +36 -249
- package/dist/tokens/tokenGenerator.d.ts.map +1 -0
- package/dist/tokens/tokenGenerator.esm.js +241 -273
- package/dist/tokens/tokenGenerator.js +241 -273
- package/dist/tokens/tokenManager.d.ts +87 -189
- package/dist/tokens/tokenManager.d.ts.map +1 -0
- package/dist/tokens/tokenManager.esm.js +187 -241
- package/dist/tokens/tokenManager.js +187 -241
- package/dist/tokens/tokenValidator.d.ts +84 -481
- package/dist/tokens/tokenValidator.d.ts.map +1 -0
- package/dist/tokens/tokenValidator.esm.js +402 -522
- package/dist/tokens/tokenValidator.js +402 -522
- package/dist/tokens/types.d.ts +40 -60
- package/dist/tokens/types.d.ts.map +1 -0
- package/dist/tokens/types.esm.js +1 -78
- package/dist/tokens/types.js +1 -78
- package/dist/types.d.ts +399 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.esm.js +3 -0
- package/dist/types.js +3 -0
- package/dist/utils/bundle-analyzer.d.ts +37 -254
- package/dist/utils/bundle-analyzer.d.ts.map +1 -0
- package/dist/utils/bundle-analyzer.esm.js +188 -246
- package/dist/utils/bundle-analyzer.js +188 -246
- package/dist/utils/bundle-splitting.d.ts +59 -471
- package/dist/utils/bundle-splitting.d.ts.map +1 -0
- package/dist/utils/bundle-splitting.esm.js +330 -458
- package/dist/utils/bundle-splitting.js +330 -458
- package/dist/utils/lazy-loading.d.ts +64 -429
- package/dist/utils/lazy-loading.d.ts.map +1 -0
- package/dist/utils/lazy-loading.esm.js +311 -417
- package/dist/utils/lazy-loading.js +311 -417
- package/dist/utils/performance-monitor.d.ts +72 -504
- package/dist/utils/performance-monitor.d.ts.map +1 -0
- package/dist/utils/performance-monitor.esm.js +369 -490
- package/dist/utils/performance-monitor.js +369 -490
- package/dist/utils/tree-shaking.d.ts +40 -267
- package/dist/utils/tree-shaking.d.ts.map +1 -0
- package/dist/utils/tree-shaking.esm.js +194 -264
- package/dist/utils/tree-shaking.js +194 -264
- package/package.json +18 -2
- package/src/index.ts +150 -149
- package/src/provider.tsx +3 -3
- package/src/theme.ts +1 -1
- package/src/themes/themes/default.ts +586 -0
- package/src/themes/themes/harvey.ts +554 -0
- package/src/types.ts +460 -0
|
@@ -1,513 +1,420 @@
|
|
|
1
|
-
import { useState, useEffect, useCallback, useRef } from 'react'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onBatteryWarning?: (level: number, isLow: boolean) => void
|
|
18
|
-
onOptimizationApplied?: (type: string, success: boolean) => void
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface PerformanceMetrics {
|
|
22
|
-
validationCount: number
|
|
23
|
-
touchEventCount: number
|
|
24
|
-
memoryUsage: number
|
|
25
|
-
batteryLevel: number
|
|
26
|
-
isLowPowerMode: boolean
|
|
27
|
-
averageResponseTime: number
|
|
28
|
-
lastOptimization: number
|
|
29
|
-
optimizationScore: number
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface FormPerformanceState {
|
|
33
|
-
isOptimized: boolean
|
|
34
|
-
currentOptimizations: string[]
|
|
35
|
-
performanceMetrics: PerformanceMetrics
|
|
36
|
-
warnings: string[]
|
|
37
|
-
lastUpdate: number
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const useFormPerformance = (
|
|
41
|
-
callbacks: PerformanceCallbacks = {},
|
|
42
|
-
config: Partial<PerformanceConfig> = {}
|
|
43
|
-
) => {
|
|
44
|
-
const defaultConfig: PerformanceConfig = {
|
|
45
|
-
enableValidationThrottling: true,
|
|
46
|
-
enableTouchEventOptimization: true,
|
|
47
|
-
enableMemoryManagement: true,
|
|
48
|
-
enableBatteryOptimization: true,
|
|
49
|
-
validationThrottleDelay: 300,
|
|
50
|
-
touchEventThrottleDelay: 16, // ~60fps
|
|
51
|
-
memoryCleanupInterval: 30000, // 30 seconds
|
|
52
|
-
performanceMonitoringInterval: 5000, // 5 seconds
|
|
53
|
-
...config
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const [performanceState, setPerformanceState] = useState<FormPerformanceState>({
|
|
57
|
-
isOptimized: false,
|
|
58
|
-
currentOptimizations: [],
|
|
59
|
-
performanceMetrics: {
|
|
60
|
-
validationCount: 0,
|
|
61
|
-
touchEventCount: 0,
|
|
62
|
-
memoryUsage: 0,
|
|
63
|
-
batteryLevel: 1,
|
|
64
|
-
isLowPowerMode: false,
|
|
65
|
-
averageResponseTime: 0,
|
|
66
|
-
lastOptimization: 0,
|
|
67
|
-
optimizationScore: 0
|
|
68
|
-
},
|
|
69
|
-
warnings: [],
|
|
70
|
-
lastUpdate: Date.now()
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
const validationThrottleTimerRef = useRef<NodeJS.Timeout | null>(null)
|
|
74
|
-
const touchEventThrottleTimerRef = useRef<NodeJS.Timeout | null>(null)
|
|
75
|
-
const memoryCleanupTimerRef = useRef<NodeJS.Timeout | null>(null)
|
|
76
|
-
const performanceMonitorTimerRef = useRef<NodeJS.Timeout | null>(null)
|
|
77
|
-
const batteryLevelRef = useRef<number>(1)
|
|
78
|
-
const isLowPowerModeRef = useRef<boolean>(false)
|
|
79
|
-
|
|
80
|
-
// Check battery status
|
|
81
|
-
const checkBatteryStatus = useCallback(async () => {
|
|
82
|
-
if (!defaultConfig.enableBatteryOptimization || !('getBattery' in navigator)) return
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
const battery = await (navigator as any).getBattery()
|
|
86
|
-
batteryLevelRef.current = battery.level
|
|
87
|
-
isLowPowerModeRef.current = battery.level < 0.2
|
|
88
|
-
|
|
89
|
-
setPerformanceState(prev => ({
|
|
90
|
-
...prev,
|
|
1
|
+
import { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
+
export const useFormPerformance = (callbacks = {}, config = {}) => {
|
|
3
|
+
const defaultConfig = {
|
|
4
|
+
enableValidationThrottling: true,
|
|
5
|
+
enableTouchEventOptimization: true,
|
|
6
|
+
enableMemoryManagement: true,
|
|
7
|
+
enableBatteryOptimization: true,
|
|
8
|
+
validationThrottleDelay: 300,
|
|
9
|
+
touchEventThrottleDelay: 16, // ~60fps
|
|
10
|
+
memoryCleanupInterval: 30000, // 30 seconds
|
|
11
|
+
performanceMonitoringInterval: 5000, // 5 seconds
|
|
12
|
+
...config
|
|
13
|
+
};
|
|
14
|
+
const [performanceState, setPerformanceState] = useState({
|
|
15
|
+
isOptimized: false,
|
|
16
|
+
currentOptimizations: [],
|
|
91
17
|
performanceMetrics: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
18
|
+
validationCount: 0,
|
|
19
|
+
touchEventCount: 0,
|
|
20
|
+
memoryUsage: 0,
|
|
21
|
+
batteryLevel: 1,
|
|
22
|
+
isLowPowerMode: false,
|
|
23
|
+
averageResponseTime: 0,
|
|
24
|
+
lastOptimization: 0,
|
|
25
|
+
optimizationScore: 0
|
|
26
|
+
},
|
|
27
|
+
warnings: [],
|
|
28
|
+
lastUpdate: Date.now()
|
|
29
|
+
});
|
|
30
|
+
const validationThrottleTimerRef = useRef(null);
|
|
31
|
+
const touchEventThrottleTimerRef = useRef(null);
|
|
32
|
+
const memoryCleanupTimerRef = useRef(null);
|
|
33
|
+
const performanceMonitorTimerRef = useRef(null);
|
|
34
|
+
const batteryLevelRef = useRef(1);
|
|
35
|
+
const isLowPowerModeRef = useRef(false);
|
|
36
|
+
// Check battery status
|
|
37
|
+
const checkBatteryStatus = useCallback(async () => {
|
|
38
|
+
if (!defaultConfig.enableBatteryOptimization || !('getBattery' in navigator))
|
|
39
|
+
return;
|
|
40
|
+
try {
|
|
41
|
+
const battery = await navigator.getBattery();
|
|
42
|
+
batteryLevelRef.current = battery.level;
|
|
43
|
+
isLowPowerModeRef.current = battery.level < 0.2;
|
|
44
|
+
setPerformanceState(prev => ({
|
|
45
|
+
...prev,
|
|
46
|
+
performanceMetrics: {
|
|
47
|
+
...prev.performanceMetrics,
|
|
48
|
+
batteryLevel: battery.level,
|
|
49
|
+
isLowPowerMode: battery.level < 0.2
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
if (battery.level < 0.2) {
|
|
53
|
+
callbacks.onBatteryWarning?.(battery.level, true);
|
|
54
|
+
}
|
|
95
55
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (battery.level < 0.2) {
|
|
99
|
-
callbacks.onBatteryWarning?.(battery.level, true)
|
|
100
|
-
}
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.warn('Battery API not supported:', error)
|
|
103
|
-
}
|
|
104
|
-
}, [defaultConfig.enableBatteryOptimization, callbacks])
|
|
105
|
-
|
|
106
|
-
// Check memory usage
|
|
107
|
-
const checkMemoryUsage = useCallback(() => {
|
|
108
|
-
if (!defaultConfig.enableMemoryManagement || !('memory' in performance)) return
|
|
109
|
-
|
|
110
|
-
try {
|
|
111
|
-
const memory = (performance as any).memory
|
|
112
|
-
const usage = memory.usedJSHeapSize / memory.jsHeapSizeLimit
|
|
113
|
-
|
|
114
|
-
setPerformanceState(prev => ({
|
|
115
|
-
...prev,
|
|
116
|
-
performanceMetrics: {
|
|
117
|
-
...prev.performanceMetrics,
|
|
118
|
-
memoryUsage: usage
|
|
56
|
+
catch (error) {
|
|
57
|
+
console.warn('Battery API not supported:', error);
|
|
119
58
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
(window as any).gc()
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Clear any cached data
|
|
142
|
-
if ('caches' in window) {
|
|
143
|
-
caches.keys().then(names => {
|
|
144
|
-
names.forEach(name => {
|
|
145
|
-
if (name.includes('form-cache')) {
|
|
146
|
-
caches.delete(name)
|
|
59
|
+
}, [defaultConfig.enableBatteryOptimization, callbacks]);
|
|
60
|
+
// Check memory usage
|
|
61
|
+
const checkMemoryUsage = useCallback(() => {
|
|
62
|
+
if (!defaultConfig.enableMemoryManagement || !('memory' in performance))
|
|
63
|
+
return;
|
|
64
|
+
try {
|
|
65
|
+
const memory = performance.memory;
|
|
66
|
+
const usage = memory.usedJSHeapSize / memory.jsHeapSizeLimit;
|
|
67
|
+
setPerformanceState(prev => ({
|
|
68
|
+
...prev,
|
|
69
|
+
performanceMetrics: {
|
|
70
|
+
...prev.performanceMetrics,
|
|
71
|
+
memoryUsage: usage
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
if (usage > 0.8) {
|
|
75
|
+
callbacks.onMemoryWarning?.(usage, 0.8);
|
|
76
|
+
triggerMemoryCleanup();
|
|
147
77
|
}
|
|
148
|
-
})
|
|
149
|
-
})
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
setPerformanceState(prev => ({
|
|
153
|
-
...prev,
|
|
154
|
-
currentOptimizations: [...prev.currentOptimizations, 'memory-cleanup'],
|
|
155
|
-
lastUpdate: Date.now()
|
|
156
|
-
}))
|
|
157
|
-
|
|
158
|
-
callbacks.onOptimizationApplied?.('memory-cleanup', true)
|
|
159
|
-
} catch (error) {
|
|
160
|
-
console.warn('Memory cleanup failed:', error)
|
|
161
|
-
callbacks.onOptimizationApplied?.('memory-cleanup', false)
|
|
162
|
-
}
|
|
163
|
-
}, [defaultConfig.enableMemoryManagement, callbacks])
|
|
164
|
-
|
|
165
|
-
// Validation throttling
|
|
166
|
-
const throttledValidation = useCallback((
|
|
167
|
-
validationFunction: () => void,
|
|
168
|
-
delay?: number
|
|
169
|
-
) => {
|
|
170
|
-
if (!defaultConfig.enableValidationThrottling) {
|
|
171
|
-
validationFunction()
|
|
172
|
-
return
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const throttleDelay = delay || defaultConfig.validationThrottleDelay
|
|
176
|
-
|
|
177
|
-
if (validationThrottleTimerRef.current) {
|
|
178
|
-
clearTimeout(validationThrottleTimerRef.current)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
validationThrottleTimerRef.current = setTimeout(() => {
|
|
182
|
-
const startTime = performance.now()
|
|
183
|
-
validationFunction()
|
|
184
|
-
const endTime = performance.now()
|
|
185
|
-
const responseTime = endTime - startTime
|
|
186
|
-
|
|
187
|
-
setPerformanceState(prev => ({
|
|
188
|
-
...prev,
|
|
189
|
-
performanceMetrics: {
|
|
190
|
-
...prev.performanceMetrics,
|
|
191
|
-
validationCount: prev.performanceMetrics.validationCount + 1,
|
|
192
|
-
averageResponseTime: (prev.performanceMetrics.averageResponseTime * prev.performanceMetrics.validationCount + responseTime) / (prev.performanceMetrics.validationCount + 1)
|
|
193
78
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.warn('Memory API not supported:', error);
|
|
81
|
+
}
|
|
82
|
+
}, [defaultConfig.enableMemoryManagement, callbacks]);
|
|
83
|
+
// Trigger memory cleanup
|
|
84
|
+
const triggerMemoryCleanup = useCallback(() => {
|
|
85
|
+
if (!defaultConfig.enableMemoryManagement)
|
|
86
|
+
return;
|
|
87
|
+
try {
|
|
88
|
+
// Force garbage collection if available
|
|
89
|
+
if ('gc' in window) {
|
|
90
|
+
window.gc();
|
|
91
|
+
}
|
|
92
|
+
// Clear any cached data
|
|
93
|
+
if ('caches' in window) {
|
|
94
|
+
caches.keys().then(names => {
|
|
95
|
+
names.forEach(name => {
|
|
96
|
+
if (name.includes('form-cache')) {
|
|
97
|
+
caches.delete(name);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
setPerformanceState(prev => ({
|
|
103
|
+
...prev,
|
|
104
|
+
currentOptimizations: [...prev.currentOptimizations, 'memory-cleanup'],
|
|
105
|
+
lastUpdate: Date.now()
|
|
106
|
+
}));
|
|
107
|
+
callbacks.onOptimizationApplied?.('memory-cleanup', true);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
console.warn('Memory cleanup failed:', error);
|
|
111
|
+
callbacks.onOptimizationApplied?.('memory-cleanup', false);
|
|
112
|
+
}
|
|
113
|
+
}, [defaultConfig.enableMemoryManagement, callbacks]);
|
|
114
|
+
// Validation throttling
|
|
115
|
+
const throttledValidation = useCallback((validationFunction, delay) => {
|
|
116
|
+
if (!defaultConfig.enableValidationThrottling) {
|
|
117
|
+
validationFunction();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const throttleDelay = delay || defaultConfig.validationThrottleDelay;
|
|
121
|
+
if (validationThrottleTimerRef.current) {
|
|
122
|
+
clearTimeout(validationThrottleTimerRef.current);
|
|
123
|
+
}
|
|
124
|
+
validationThrottleTimerRef.current = setTimeout(() => {
|
|
125
|
+
const startTime = performance.now();
|
|
126
|
+
validationFunction();
|
|
127
|
+
const endTime = performance.now();
|
|
128
|
+
const responseTime = endTime - startTime;
|
|
129
|
+
setPerformanceState(prev => ({
|
|
130
|
+
...prev,
|
|
131
|
+
performanceMetrics: {
|
|
132
|
+
...prev.performanceMetrics,
|
|
133
|
+
validationCount: prev.performanceMetrics.validationCount + 1,
|
|
134
|
+
averageResponseTime: (prev.performanceMetrics.averageResponseTime * prev.performanceMetrics.validationCount + responseTime) / (prev.performanceMetrics.validationCount + 1)
|
|
135
|
+
}
|
|
136
|
+
}));
|
|
137
|
+
}, throttleDelay);
|
|
138
|
+
}, [defaultConfig.enableValidationThrottling, defaultConfig.validationThrottleDelay]);
|
|
139
|
+
// Touch event optimization
|
|
140
|
+
const optimizedTouchEvent = useCallback((touchFunction, delay) => {
|
|
141
|
+
if (!defaultConfig.enableTouchEventOptimization) {
|
|
142
|
+
touchFunction();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const throttleDelay = delay || defaultConfig.touchEventThrottleDelay;
|
|
146
|
+
if (touchEventThrottleTimerRef.current) {
|
|
147
|
+
clearTimeout(touchEventThrottleTimerRef.current);
|
|
148
|
+
}
|
|
149
|
+
touchEventThrottleTimerRef.current = setTimeout(() => {
|
|
150
|
+
touchFunction();
|
|
151
|
+
setPerformanceState(prev => ({
|
|
152
|
+
...prev,
|
|
153
|
+
performanceMetrics: {
|
|
154
|
+
...prev.performanceMetrics,
|
|
155
|
+
touchEventCount: prev.performanceMetrics.touchEventCount + 1
|
|
156
|
+
}
|
|
157
|
+
}));
|
|
158
|
+
}, throttleDelay);
|
|
159
|
+
}, [defaultConfig.enableTouchEventOptimization, defaultConfig.touchEventThrottleDelay]);
|
|
160
|
+
// Calculate performance score
|
|
161
|
+
const calculatePerformanceScore = useCallback(() => {
|
|
162
|
+
const { performanceMetrics } = performanceState;
|
|
163
|
+
let score = 0;
|
|
164
|
+
// Response time score (40% weight)
|
|
165
|
+
if (performanceMetrics.averageResponseTime < 50) {
|
|
166
|
+
score += 0.4;
|
|
167
|
+
}
|
|
168
|
+
else if (performanceMetrics.averageResponseTime < 100) {
|
|
169
|
+
score += 0.3;
|
|
170
|
+
}
|
|
171
|
+
else if (performanceMetrics.averageResponseTime < 200) {
|
|
172
|
+
score += 0.2;
|
|
173
|
+
}
|
|
174
|
+
else if (performanceMetrics.averageResponseTime < 500) {
|
|
175
|
+
score += 0.1;
|
|
176
|
+
}
|
|
177
|
+
// Memory usage score (30% weight)
|
|
178
|
+
if (performanceMetrics.memoryUsage < 0.5) {
|
|
179
|
+
score += 0.3;
|
|
180
|
+
}
|
|
181
|
+
else if (performanceMetrics.memoryUsage < 0.7) {
|
|
182
|
+
score += 0.2;
|
|
183
|
+
}
|
|
184
|
+
else if (performanceMetrics.memoryUsage < 0.9) {
|
|
185
|
+
score += 0.1;
|
|
186
|
+
}
|
|
187
|
+
// Battery optimization score (20% weight)
|
|
188
|
+
if (!performanceMetrics.isLowPowerMode) {
|
|
189
|
+
score += 0.2;
|
|
190
|
+
}
|
|
191
|
+
else if (performanceMetrics.batteryLevel > 0.5) {
|
|
192
|
+
score += 0.1;
|
|
222
193
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
//
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Apply battery optimization
|
|
292
|
-
if (defaultConfig.enableBatteryOptimization && isLowPowerModeRef.current) {
|
|
293
|
-
// Reduce update frequency in low power mode
|
|
194
|
+
// Event count score (10% weight)
|
|
195
|
+
if (performanceMetrics.touchEventCount < 100) {
|
|
196
|
+
score += 0.1;
|
|
197
|
+
}
|
|
198
|
+
else if (performanceMetrics.touchEventCount < 500) {
|
|
199
|
+
score += 0.05;
|
|
200
|
+
}
|
|
201
|
+
return Math.min(score, 1);
|
|
202
|
+
}, [performanceState.performanceMetrics]);
|
|
203
|
+
// Apply performance optimizations
|
|
204
|
+
const applyOptimizations = useCallback(() => {
|
|
205
|
+
const optimizations = [];
|
|
206
|
+
let success = true;
|
|
207
|
+
try {
|
|
208
|
+
// Apply validation throttling
|
|
209
|
+
if (defaultConfig.enableValidationThrottling) {
|
|
210
|
+
optimizations.push('validation-throttling');
|
|
211
|
+
}
|
|
212
|
+
// Apply touch event optimization
|
|
213
|
+
if (defaultConfig.enableTouchEventOptimization) {
|
|
214
|
+
optimizations.push('touch-event-optimization');
|
|
215
|
+
}
|
|
216
|
+
// Apply memory management
|
|
217
|
+
if (defaultConfig.enableMemoryManagement) {
|
|
218
|
+
triggerMemoryCleanup();
|
|
219
|
+
optimizations.push('memory-management');
|
|
220
|
+
}
|
|
221
|
+
// Apply battery optimization
|
|
222
|
+
if (defaultConfig.enableBatteryOptimization && isLowPowerModeRef.current) {
|
|
223
|
+
// Reduce update frequency in low power mode
|
|
224
|
+
if (performanceMonitorTimerRef.current) {
|
|
225
|
+
clearInterval(performanceMonitorTimerRef.current);
|
|
226
|
+
performanceMonitorTimerRef.current = setInterval(() => {
|
|
227
|
+
checkMemoryUsage();
|
|
228
|
+
}, defaultConfig.performanceMonitoringInterval * 2);
|
|
229
|
+
}
|
|
230
|
+
optimizations.push('battery-optimization');
|
|
231
|
+
}
|
|
232
|
+
const optimizationScore = calculatePerformanceScore();
|
|
233
|
+
const isOptimized = optimizationScore >= 0.7;
|
|
234
|
+
setPerformanceState(prev => ({
|
|
235
|
+
...prev,
|
|
236
|
+
isOptimized,
|
|
237
|
+
currentOptimizations: optimizations,
|
|
238
|
+
performanceMetrics: {
|
|
239
|
+
...prev.performanceMetrics,
|
|
240
|
+
optimizationScore,
|
|
241
|
+
lastOptimization: Date.now()
|
|
242
|
+
},
|
|
243
|
+
lastUpdate: Date.now()
|
|
244
|
+
}));
|
|
245
|
+
callbacks.onOptimizationApplied?.('performance', success);
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
console.error('Performance optimization failed:', error);
|
|
249
|
+
success = false;
|
|
250
|
+
callbacks.onOptimizationApplied?.('performance', false);
|
|
251
|
+
}
|
|
252
|
+
}, [
|
|
253
|
+
defaultConfig,
|
|
254
|
+
triggerMemoryCleanup,
|
|
255
|
+
calculatePerformanceScore,
|
|
256
|
+
callbacks
|
|
257
|
+
]);
|
|
258
|
+
// Monitor performance
|
|
259
|
+
const startPerformanceMonitoring = useCallback(() => {
|
|
294
260
|
if (performanceMonitorTimerRef.current) {
|
|
295
|
-
|
|
296
|
-
performanceMonitorTimerRef.current = setInterval(() => {
|
|
297
|
-
checkMemoryUsage()
|
|
298
|
-
}, defaultConfig.performanceMonitoringInterval * 2)
|
|
261
|
+
clearInterval(performanceMonitorTimerRef.current);
|
|
299
262
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
performanceState
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
263
|
+
performanceMonitorTimerRef.current = setInterval(() => {
|
|
264
|
+
checkMemoryUsage();
|
|
265
|
+
checkBatteryStatus();
|
|
266
|
+
const score = calculatePerformanceScore();
|
|
267
|
+
if (score < 0.5) {
|
|
268
|
+
const warning = `Performance score is low: ${(score * 100).toFixed(1)}%`;
|
|
269
|
+
setPerformanceState(prev => ({
|
|
270
|
+
...prev,
|
|
271
|
+
warnings: [...prev.warnings, warning]
|
|
272
|
+
}));
|
|
273
|
+
callbacks.onPerformanceWarning?.(warning, performanceState.performanceMetrics);
|
|
274
|
+
}
|
|
275
|
+
}, defaultConfig.performanceMonitoringInterval);
|
|
276
|
+
}, [
|
|
277
|
+
defaultConfig.performanceMonitoringInterval,
|
|
278
|
+
checkMemoryUsage,
|
|
279
|
+
checkBatteryStatus,
|
|
280
|
+
calculatePerformanceScore,
|
|
281
|
+
performanceState.performanceMetrics,
|
|
282
|
+
callbacks
|
|
283
|
+
]);
|
|
284
|
+
// Stop performance monitoring
|
|
285
|
+
const stopPerformanceMonitoring = useCallback(() => {
|
|
286
|
+
if (performanceMonitorTimerRef.current) {
|
|
287
|
+
clearInterval(performanceMonitorTimerRef.current);
|
|
288
|
+
performanceMonitorTimerRef.current = null;
|
|
289
|
+
}
|
|
290
|
+
}, []);
|
|
291
|
+
// Reset performance state
|
|
292
|
+
const resetPerformance = useCallback(() => {
|
|
293
|
+
setPerformanceState({
|
|
294
|
+
isOptimized: false,
|
|
295
|
+
currentOptimizations: [],
|
|
296
|
+
performanceMetrics: {
|
|
297
|
+
validationCount: 0,
|
|
298
|
+
touchEventCount: 0,
|
|
299
|
+
memoryUsage: 0,
|
|
300
|
+
batteryLevel: 1,
|
|
301
|
+
isLowPowerMode: false,
|
|
302
|
+
averageResponseTime: 0,
|
|
303
|
+
lastOptimization: 0,
|
|
304
|
+
optimizationScore: 0
|
|
305
|
+
},
|
|
306
|
+
warnings: [],
|
|
307
|
+
lastUpdate: Date.now()
|
|
308
|
+
});
|
|
309
|
+
}, []);
|
|
310
|
+
// Get performance report
|
|
311
|
+
const getPerformanceReport = useCallback(() => {
|
|
312
|
+
const { performanceMetrics, currentOptimizations, warnings } = performanceState;
|
|
313
|
+
return {
|
|
314
|
+
metrics: performanceMetrics,
|
|
315
|
+
optimizations: currentOptimizations,
|
|
316
|
+
warnings,
|
|
317
|
+
recommendations: getPerformanceRecommendations()
|
|
318
|
+
};
|
|
319
|
+
}, [performanceState]);
|
|
320
|
+
// Get performance recommendations
|
|
321
|
+
const getPerformanceRecommendations = useCallback(() => {
|
|
322
|
+
const { performanceMetrics } = performanceState;
|
|
323
|
+
const recommendations = [];
|
|
324
|
+
if (performanceMetrics.averageResponseTime > 200) {
|
|
325
|
+
recommendations.push('Consider increasing validation throttle delay');
|
|
326
|
+
recommendations.push('Optimize validation logic for better performance');
|
|
327
|
+
}
|
|
328
|
+
if (performanceMetrics.memoryUsage > 0.7) {
|
|
329
|
+
recommendations.push('Enable memory cleanup more frequently');
|
|
330
|
+
recommendations.push('Reduce cached data size');
|
|
331
|
+
}
|
|
332
|
+
if (performanceMetrics.isLowPowerMode) {
|
|
333
|
+
recommendations.push('Reduce update frequency in low power mode');
|
|
334
|
+
recommendations.push('Disable non-essential optimizations');
|
|
335
|
+
}
|
|
336
|
+
if (performanceMetrics.touchEventCount > 500) {
|
|
337
|
+
recommendations.push('Increase touch event throttle delay');
|
|
338
|
+
recommendations.push('Consider debouncing touch events');
|
|
339
|
+
}
|
|
340
|
+
return recommendations;
|
|
341
|
+
}, [performanceState.performanceMetrics]);
|
|
342
|
+
// Set up initial monitoring
|
|
343
|
+
useEffect(() => {
|
|
344
|
+
checkBatteryStatus();
|
|
345
|
+
checkMemoryUsage();
|
|
346
|
+
startPerformanceMonitoring();
|
|
347
|
+
return () => {
|
|
348
|
+
stopPerformanceMonitoring();
|
|
349
|
+
};
|
|
350
|
+
}, [checkBatteryStatus, checkMemoryUsage, startPerformanceMonitoring, stopPerformanceMonitoring]);
|
|
351
|
+
// Set up memory cleanup interval
|
|
352
|
+
useEffect(() => {
|
|
353
|
+
if (defaultConfig.enableMemoryManagement) {
|
|
354
|
+
memoryCleanupTimerRef.current = setInterval(() => {
|
|
355
|
+
checkMemoryUsage();
|
|
356
|
+
}, defaultConfig.memoryCleanupInterval);
|
|
357
|
+
}
|
|
358
|
+
return () => {
|
|
359
|
+
if (memoryCleanupTimerRef.current) {
|
|
360
|
+
clearInterval(memoryCleanupTimerRef.current);
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}, [defaultConfig.enableMemoryManagement, defaultConfig.memoryCleanupInterval, checkMemoryUsage]);
|
|
364
|
+
// Clean up timers on unmount
|
|
365
|
+
useEffect(() => {
|
|
366
|
+
return () => {
|
|
367
|
+
if (validationThrottleTimerRef.current) {
|
|
368
|
+
clearTimeout(validationThrottleTimerRef.current);
|
|
369
|
+
}
|
|
370
|
+
if (touchEventThrottleTimerRef.current) {
|
|
371
|
+
clearTimeout(touchEventThrottleTimerRef.current);
|
|
372
|
+
}
|
|
373
|
+
if (memoryCleanupTimerRef.current) {
|
|
374
|
+
clearInterval(memoryCleanupTimerRef.current);
|
|
375
|
+
}
|
|
376
|
+
if (performanceMonitorTimerRef.current) {
|
|
377
|
+
clearInterval(performanceMonitorTimerRef.current);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
}, []);
|
|
392
381
|
return {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
recommendations.push('Consider increasing validation throttle delay')
|
|
407
|
-
recommendations.push('Optimize validation logic for better performance')
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
if (performanceMetrics.memoryUsage > 0.7) {
|
|
411
|
-
recommendations.push('Enable memory cleanup more frequently')
|
|
412
|
-
recommendations.push('Reduce cached data size')
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
if (performanceMetrics.isLowPowerMode) {
|
|
416
|
-
recommendations.push('Reduce update frequency in low power mode')
|
|
417
|
-
recommendations.push('Disable non-essential optimizations')
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
if (performanceMetrics.touchEventCount > 500) {
|
|
421
|
-
recommendations.push('Increase touch event throttle delay')
|
|
422
|
-
recommendations.push('Consider debouncing touch events')
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
return recommendations
|
|
426
|
-
}, [performanceState.performanceMetrics])
|
|
427
|
-
|
|
428
|
-
// Set up initial monitoring
|
|
429
|
-
useEffect(() => {
|
|
430
|
-
checkBatteryStatus()
|
|
431
|
-
checkMemoryUsage()
|
|
432
|
-
startPerformanceMonitoring()
|
|
433
|
-
|
|
434
|
-
return () => {
|
|
435
|
-
stopPerformanceMonitoring()
|
|
436
|
-
}
|
|
437
|
-
}, [checkBatteryStatus, checkMemoryUsage, startPerformanceMonitoring, stopPerformanceMonitoring])
|
|
438
|
-
|
|
439
|
-
// Set up memory cleanup interval
|
|
440
|
-
useEffect(() => {
|
|
441
|
-
if (defaultConfig.enableMemoryManagement) {
|
|
442
|
-
memoryCleanupTimerRef.current = setInterval(() => {
|
|
443
|
-
checkMemoryUsage()
|
|
444
|
-
}, defaultConfig.memoryCleanupInterval)
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
return () => {
|
|
448
|
-
if (memoryCleanupTimerRef.current) {
|
|
449
|
-
clearInterval(memoryCleanupTimerRef.current)
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
}, [defaultConfig.enableMemoryManagement, defaultConfig.memoryCleanupInterval, checkMemoryUsage])
|
|
453
|
-
|
|
454
|
-
// Clean up timers on unmount
|
|
455
|
-
useEffect(() => {
|
|
456
|
-
return () => {
|
|
457
|
-
if (validationThrottleTimerRef.current) {
|
|
458
|
-
clearTimeout(validationThrottleTimerRef.current)
|
|
459
|
-
}
|
|
460
|
-
if (touchEventThrottleTimerRef.current) {
|
|
461
|
-
clearTimeout(touchEventThrottleTimerRef.current)
|
|
462
|
-
}
|
|
463
|
-
if (memoryCleanupTimerRef.current) {
|
|
464
|
-
clearInterval(memoryCleanupTimerRef.current)
|
|
465
|
-
}
|
|
466
|
-
if (performanceMonitorTimerRef.current) {
|
|
467
|
-
clearInterval(performanceMonitorTimerRef.current)
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}, [])
|
|
471
|
-
|
|
472
|
-
return {
|
|
473
|
-
performanceState,
|
|
474
|
-
throttledValidation,
|
|
475
|
-
optimizedTouchEvent,
|
|
476
|
-
applyOptimizations,
|
|
477
|
-
startPerformanceMonitoring,
|
|
478
|
-
stopPerformanceMonitoring,
|
|
479
|
-
resetPerformance,
|
|
480
|
-
getPerformanceReport,
|
|
481
|
-
getPerformanceRecommendations,
|
|
482
|
-
checkMemoryUsage,
|
|
483
|
-
checkBatteryStatus
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
382
|
+
performanceState,
|
|
383
|
+
throttledValidation,
|
|
384
|
+
optimizedTouchEvent,
|
|
385
|
+
applyOptimizations,
|
|
386
|
+
startPerformanceMonitoring,
|
|
387
|
+
stopPerformanceMonitoring,
|
|
388
|
+
resetPerformance,
|
|
389
|
+
getPerformanceReport,
|
|
390
|
+
getPerformanceRecommendations,
|
|
391
|
+
checkMemoryUsage,
|
|
392
|
+
checkBatteryStatus
|
|
393
|
+
};
|
|
394
|
+
};
|
|
487
395
|
// Convenience hook for basic performance optimization
|
|
488
396
|
export const useBasicFormPerformance = () => {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
500
|
-
|
|
397
|
+
return useFormPerformance({}, {
|
|
398
|
+
enableValidationThrottling: true,
|
|
399
|
+
enableTouchEventOptimization: false,
|
|
400
|
+
enableMemoryManagement: false,
|
|
401
|
+
enableBatteryOptimization: false,
|
|
402
|
+
validationThrottleDelay: 500,
|
|
403
|
+
touchEventThrottleDelay: 32,
|
|
404
|
+
memoryCleanupInterval: 60000,
|
|
405
|
+
performanceMonitoringInterval: 10000
|
|
406
|
+
});
|
|
407
|
+
};
|
|
501
408
|
// Convenience hook for enhanced performance optimization
|
|
502
409
|
export const useEnhancedFormPerformance = () => {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
}
|
|
410
|
+
return useFormPerformance({}, {
|
|
411
|
+
enableValidationThrottling: true,
|
|
412
|
+
enableTouchEventOptimization: true,
|
|
413
|
+
enableMemoryManagement: true,
|
|
414
|
+
enableBatteryOptimization: true,
|
|
415
|
+
validationThrottleDelay: 300,
|
|
416
|
+
touchEventThrottleDelay: 16,
|
|
417
|
+
memoryCleanupInterval: 30000,
|
|
418
|
+
performanceMonitoringInterval: 5000
|
|
419
|
+
});
|
|
420
|
+
};
|