@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.2.10 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (483) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/components/ui/accessibility-demo.esm.js +80 -258
  3. package/dist/components/ui/accessibility-demo.js +80 -258
  4. package/dist/components/ui/advanced-component-architecture-demo.esm.js +256 -916
  5. package/dist/components/ui/advanced-component-architecture-demo.js +256 -916
  6. package/dist/components/ui/advanced-transition-system-demo.esm.js +59 -670
  7. package/dist/components/ui/advanced-transition-system-demo.js +59 -670
  8. package/dist/components/ui/advanced-transition-system.esm.js +194 -378
  9. package/dist/components/ui/advanced-transition-system.js +194 -378
  10. package/dist/components/ui/animation/animated-container.esm.js +98 -159
  11. package/dist/components/ui/animation/animated-container.js +98 -159
  12. package/dist/components/ui/animation/index.esm.js +3 -18
  13. package/dist/components/ui/animation/index.js +3 -18
  14. package/dist/components/ui/animation/staggered-container.esm.js +37 -68
  15. package/dist/components/ui/animation/staggered-container.js +37 -68
  16. package/dist/components/ui/animation-demo.esm.js +30 -250
  17. package/dist/components/ui/animation-demo.js +30 -250
  18. package/dist/components/ui/badge.esm.js +15 -28
  19. package/dist/components/ui/badge.js +15 -28
  20. package/dist/components/ui/battery-conscious-animation-demo.esm.js +136 -565
  21. package/dist/components/ui/battery-conscious-animation-demo.js +136 -565
  22. package/dist/components/ui/border-radius-shadow-demo.esm.js +3 -184
  23. package/dist/components/ui/border-radius-shadow-demo.js +3 -184
  24. package/dist/components/ui/button.esm.js +14 -33
  25. package/dist/components/ui/button.js +14 -33
  26. package/dist/components/ui/card.esm.js +74 -188
  27. package/dist/components/ui/card.js +74 -188
  28. package/dist/components/ui/checkbox.esm.js +11 -30
  29. package/dist/components/ui/checkbox.js +11 -30
  30. package/dist/components/ui/color-preview.esm.js +50 -405
  31. package/dist/components/ui/color-preview.js +50 -405
  32. package/dist/components/ui/data-display/chart.esm.js +210 -632
  33. package/dist/components/ui/data-display/chart.js +210 -632
  34. package/dist/components/ui/data-display/data-grid-simple.esm.js +16 -74
  35. package/dist/components/ui/data-display/data-grid-simple.js +16 -74
  36. package/dist/components/ui/data-display/data-grid.esm.js +173 -661
  37. package/dist/components/ui/data-display/data-grid.js +173 -661
  38. package/dist/components/ui/data-display/list.esm.js +88 -446
  39. package/dist/components/ui/data-display/list.js +88 -446
  40. package/dist/components/ui/data-display/table.esm.js +109 -468
  41. package/dist/components/ui/data-display/table.js +109 -468
  42. package/dist/components/ui/data-display/timeline.esm.js +92 -431
  43. package/dist/components/ui/data-display/timeline.js +92 -431
  44. package/dist/components/ui/data-display/tree.esm.js +211 -585
  45. package/dist/components/ui/data-display/tree.js +211 -585
  46. package/dist/components/ui/data-display/types.esm.js +1 -530
  47. package/dist/components/ui/data-display/types.js +1 -530
  48. package/dist/components/ui/enterprise-mobile-experience-demo.esm.js +76 -749
  49. package/dist/components/ui/enterprise-mobile-experience-demo.js +76 -749
  50. package/dist/components/ui/enterprise-mobile-experience.esm.js +152 -460
  51. package/dist/components/ui/enterprise-mobile-experience.js +152 -460
  52. package/dist/components/ui/feedback/alert.esm.js +40 -148
  53. package/dist/components/ui/feedback/alert.js +40 -148
  54. package/dist/components/ui/feedback/progress.esm.js +74 -278
  55. package/dist/components/ui/feedback/progress.js +74 -278
  56. package/dist/components/ui/feedback/skeleton.esm.js +64 -173
  57. package/dist/components/ui/feedback/skeleton.js +64 -173
  58. package/dist/components/ui/feedback/toast.esm.js +86 -225
  59. package/dist/components/ui/feedback/toast.js +86 -225
  60. package/dist/components/ui/feedback/types.esm.js +1 -125
  61. package/dist/components/ui/feedback/types.js +1 -125
  62. package/dist/components/ui/font-preview.esm.js +56 -283
  63. package/dist/components/ui/font-preview.js +56 -283
  64. package/dist/components/ui/form-demo.esm.js +191 -553
  65. package/dist/components/ui/form-demo.js +191 -553
  66. package/dist/components/ui/hardware-acceleration-demo.esm.js +103 -544
  67. package/dist/components/ui/hardware-acceleration-demo.js +103 -544
  68. package/dist/components/ui/input.esm.js +13 -32
  69. package/dist/components/ui/input.js +13 -32
  70. package/dist/components/ui/label.esm.js +6 -16
  71. package/dist/components/ui/label.js +6 -16
  72. package/dist/components/ui/layout-demo.esm.js +76 -367
  73. package/dist/components/ui/layout-demo.js +76 -367
  74. package/dist/components/ui/layouts/adaptive-layout.esm.js +60 -139
  75. package/dist/components/ui/layouts/adaptive-layout.js +60 -139
  76. package/dist/components/ui/layouts/desktop-layout.esm.js +39 -224
  77. package/dist/components/ui/layouts/desktop-layout.js +39 -224
  78. package/dist/components/ui/layouts/index.esm.js +4 -10
  79. package/dist/components/ui/layouts/index.js +4 -10
  80. package/dist/components/ui/layouts/mobile-layout.esm.js +49 -162
  81. package/dist/components/ui/layouts/mobile-layout.js +49 -162
  82. package/dist/components/ui/layouts/tablet-layout.esm.js +53 -197
  83. package/dist/components/ui/layouts/tablet-layout.js +53 -197
  84. package/dist/components/ui/mobile-form-validation.esm.js +185 -420
  85. package/dist/components/ui/mobile-form-validation.js +185 -420
  86. package/dist/components/ui/mobile-input-demo.esm.js +11 -198
  87. package/dist/components/ui/mobile-input-demo.js +11 -198
  88. package/dist/components/ui/mobile-input.esm.js +187 -270
  89. package/dist/components/ui/mobile-input.js +187 -270
  90. package/dist/components/ui/mobile-skeleton-loading-demo.esm.js +144 -638
  91. package/dist/components/ui/mobile-skeleton-loading-demo.js +144 -638
  92. package/dist/components/ui/navigation/breadcrumb.esm.js +51 -154
  93. package/dist/components/ui/navigation/breadcrumb.js +51 -154
  94. package/dist/components/ui/navigation/index.esm.js +0 -26
  95. package/dist/components/ui/navigation/index.js +0 -26
  96. package/dist/components/ui/navigation/menu.esm.js +178 -365
  97. package/dist/components/ui/navigation/menu.js +178 -365
  98. package/dist/components/ui/navigation/navigation-demo.esm.js +130 -315
  99. package/dist/components/ui/navigation/navigation-demo.js +130 -315
  100. package/dist/components/ui/navigation/pagination.esm.js +142 -264
  101. package/dist/components/ui/navigation/pagination.js +142 -264
  102. package/dist/components/ui/navigation/sidebar.esm.js +156 -368
  103. package/dist/components/ui/navigation/sidebar.js +156 -368
  104. package/dist/components/ui/navigation/stepper.esm.js +131 -295
  105. package/dist/components/ui/navigation/stepper.js +131 -295
  106. package/dist/components/ui/navigation/tabs.esm.js +89 -198
  107. package/dist/components/ui/navigation/tabs.js +89 -198
  108. package/dist/components/ui/navigation/types.esm.js +1 -295
  109. package/dist/components/ui/navigation/types.js +1 -295
  110. package/dist/components/ui/overlay/backdrop.esm.js +39 -78
  111. package/dist/components/ui/overlay/backdrop.js +39 -78
  112. package/dist/components/ui/overlay/focus-manager.esm.js +96 -140
  113. package/dist/components/ui/overlay/focus-manager.js +96 -140
  114. package/dist/components/ui/overlay/index.esm.js +0 -27
  115. package/dist/components/ui/overlay/index.js +0 -27
  116. package/dist/components/ui/overlay/modal.esm.js +94 -249
  117. package/dist/components/ui/overlay/modal.js +94 -249
  118. package/dist/components/ui/overlay/overlay-manager.esm.js +60 -100
  119. package/dist/components/ui/overlay/overlay-manager.js +60 -100
  120. package/dist/components/ui/overlay/popover.esm.js +258 -438
  121. package/dist/components/ui/overlay/popover.js +258 -438
  122. package/dist/components/ui/overlay/portal.esm.js +45 -74
  123. package/dist/components/ui/overlay/portal.js +45 -74
  124. package/dist/components/ui/overlay/tooltip.esm.js +202 -288
  125. package/dist/components/ui/overlay/tooltip.js +202 -288
  126. package/dist/components/ui/overlay/types.esm.js +1 -196
  127. package/dist/components/ui/overlay/types.js +1 -196
  128. package/dist/components/ui/performance-demo.esm.js +110 -596
  129. package/dist/components/ui/performance-demo.js +110 -596
  130. package/dist/components/ui/semantic-input-system-demo.esm.js +87 -501
  131. package/dist/components/ui/semantic-input-system-demo.js +87 -501
  132. package/dist/components/ui/theme-customizer.esm.js +123 -371
  133. package/dist/components/ui/theme-customizer.js +123 -371
  134. package/dist/components/ui/theme-preview.esm.js +44 -306
  135. package/dist/components/ui/theme-preview.js +44 -306
  136. package/dist/components/ui/theme-switcher.esm.js +79 -258
  137. package/dist/components/ui/theme-switcher.js +79 -258
  138. package/dist/components/ui/theme-toggle.esm.js +22 -35
  139. package/dist/components/ui/theme-toggle.js +22 -35
  140. package/dist/components/ui/token-demo.esm.js +42 -189
  141. package/dist/components/ui/token-demo.js +42 -189
  142. package/dist/components/ui/touch-demo.esm.js +96 -462
  143. package/dist/components/ui/touch-demo.js +96 -462
  144. package/dist/components/ui/touch-friendly-interface-demo.esm.js +63 -519
  145. package/dist/components/ui/touch-friendly-interface-demo.js +63 -519
  146. package/dist/components/ui/touch-friendly-interface.esm.js +103 -281
  147. package/dist/components/ui/touch-friendly-interface.js +103 -281
  148. package/dist/hooks/index.esm.js +23 -181
  149. package/dist/hooks/index.js +23 -181
  150. package/dist/hooks/use-accessibility-support.esm.js +377 -518
  151. package/dist/hooks/use-accessibility-support.js +377 -518
  152. package/dist/hooks/use-adaptive-layout.esm.js +212 -287
  153. package/dist/hooks/use-adaptive-layout.js +212 -287
  154. package/dist/hooks/use-advanced-patterns.esm.js +185 -293
  155. package/dist/hooks/use-advanced-patterns.js +185 -293
  156. package/dist/hooks/use-advanced-transition-system.esm.js +286 -392
  157. package/dist/hooks/use-advanced-transition-system.js +286 -392
  158. package/dist/hooks/use-animation-profile.esm.js +221 -283
  159. package/dist/hooks/use-animation-profile.js +221 -283
  160. package/dist/hooks/use-battery-animations.esm.js +310 -384
  161. package/dist/hooks/use-battery-animations.js +310 -384
  162. package/dist/hooks/use-battery-conscious-loading.esm.js +374 -468
  163. package/dist/hooks/use-battery-conscious-loading.js +374 -468
  164. package/dist/hooks/use-battery-optimization.esm.js +267 -329
  165. package/dist/hooks/use-battery-optimization.js +267 -329
  166. package/dist/hooks/use-battery-status.esm.js +213 -293
  167. package/dist/hooks/use-battery-status.js +213 -293
  168. package/dist/hooks/use-component-performance.esm.js +235 -341
  169. package/dist/hooks/use-component-performance.js +235 -341
  170. package/dist/hooks/use-device-loading-states.esm.js +356 -457
  171. package/dist/hooks/use-device-loading-states.js +356 -457
  172. package/dist/hooks/use-device.esm.js +77 -102
  173. package/dist/hooks/use-device.js +77 -102
  174. package/dist/hooks/use-enterprise-mobile-experience.esm.js +349 -487
  175. package/dist/hooks/use-enterprise-mobile-experience.js +349 -487
  176. package/dist/hooks/use-form-feedback.esm.js +313 -398
  177. package/dist/hooks/use-form-feedback.js +313 -398
  178. package/dist/hooks/use-form-performance.esm.js +407 -500
  179. package/dist/hooks/use-form-performance.js +407 -500
  180. package/dist/hooks/use-frame-rate.esm.js +178 -251
  181. package/dist/hooks/use-frame-rate.js +178 -251
  182. package/dist/hooks/use-gestures.esm.js +230 -332
  183. package/dist/hooks/use-gestures.js +230 -332
  184. package/dist/hooks/use-hardware-acceleration.esm.js +246 -339
  185. package/dist/hooks/use-hardware-acceleration.js +246 -339
  186. package/dist/hooks/use-input-accessibility.esm.js +350 -454
  187. package/dist/hooks/use-input-accessibility.js +350 -454
  188. package/dist/hooks/use-input-performance.esm.js +419 -502
  189. package/dist/hooks/use-input-performance.js +419 -502
  190. package/dist/hooks/use-layout-performance.esm.js +233 -319
  191. package/dist/hooks/use-layout-performance.js +233 -319
  192. package/dist/hooks/use-loading-accessibility.esm.js +421 -531
  193. package/dist/hooks/use-loading-accessibility.js +421 -531
  194. package/dist/hooks/use-loading-performance.esm.js +398 -469
  195. package/dist/hooks/use-loading-performance.js +398 -469
  196. package/dist/hooks/use-memory-usage.esm.js +211 -287
  197. package/dist/hooks/use-memory-usage.js +211 -287
  198. package/dist/hooks/use-mobile-form-layout.esm.js +365 -458
  199. package/dist/hooks/use-mobile-form-layout.js +365 -458
  200. package/dist/hooks/use-mobile-form-validation.esm.js +384 -497
  201. package/dist/hooks/use-mobile-form-validation.js +384 -497
  202. package/dist/hooks/use-mobile-keyboard-optimization.esm.js +354 -468
  203. package/dist/hooks/use-mobile-keyboard-optimization.js +354 -468
  204. package/dist/hooks/use-mobile-layout.esm.js +207 -294
  205. package/dist/hooks/use-mobile-layout.js +207 -294
  206. package/dist/hooks/use-mobile-optimization.esm.js +308 -404
  207. package/dist/hooks/use-mobile-optimization.js +308 -404
  208. package/dist/hooks/use-mobile-skeleton.esm.js +300 -402
  209. package/dist/hooks/use-mobile-skeleton.js +300 -402
  210. package/dist/hooks/use-mobile-touch.esm.js +314 -412
  211. package/dist/hooks/use-mobile-touch.js +314 -412
  212. package/dist/hooks/use-performance-throttling.esm.js +276 -344
  213. package/dist/hooks/use-performance-throttling.js +276 -344
  214. package/dist/hooks/use-performance.esm.js +216 -313
  215. package/dist/hooks/use-performance.js +216 -313
  216. package/dist/hooks/use-reusable-architecture.esm.js +255 -408
  217. package/dist/hooks/use-reusable-architecture.js +255 -408
  218. package/dist/hooks/use-semantic-input-types.esm.js +290 -356
  219. package/dist/hooks/use-semantic-input-types.js +290 -356
  220. package/dist/hooks/use-semantic-input.esm.js +446 -549
  221. package/dist/hooks/use-semantic-input.js +446 -549
  222. package/dist/hooks/use-tablet-layout.esm.js +279 -384
  223. package/dist/hooks/use-tablet-layout.js +279 -384
  224. package/dist/hooks/use-touch-friendly-input.esm.js +401 -519
  225. package/dist/hooks/use-touch-friendly-input.js +401 -519
  226. package/dist/hooks/use-touch-friendly-interface.esm.js +242 -331
  227. package/dist/hooks/use-touch-friendly-interface.js +242 -331
  228. package/dist/hooks/use-touch-optimization.esm.js +288 -370
  229. package/dist/hooks/use-touch-optimization.js +288 -370
  230. package/dist/index.esm.js +150 -294
  231. package/dist/index.js +150 -294
  232. package/dist/lib/utils.esm.js +4 -5
  233. package/dist/lib/utils.js +4 -5
  234. package/dist/plugins/theme-css-generator.esm.js +292 -346
  235. package/dist/plugins/theme-css-generator.js +292 -346
  236. package/dist/provider.esm.js +3 -19
  237. package/dist/provider.js +3 -19
  238. package/dist/styles/layers/validation.esm.js +275 -0
  239. package/dist/styles/layers/validation.js +275 -0
  240. package/dist/styles.css +1 -1
  241. package/dist/theme.esm.js +654 -658
  242. package/dist/theme.js +654 -658
  243. package/dist/themes/ThemeContext.esm.js +1 -27
  244. package/dist/themes/ThemeContext.js +1 -27
  245. package/dist/themes/ThemeProvider.esm.js +191 -223
  246. package/dist/themes/ThemeProvider.js +191 -223
  247. package/dist/themes/accessibility/index.esm.js +0 -4
  248. package/dist/themes/accessibility/index.js +0 -4
  249. package/dist/themes/accessibility.esm.js +175 -240
  250. package/dist/themes/accessibility.js +175 -240
  251. package/dist/themes/aria-patterns.esm.js +345 -401
  252. package/dist/themes/aria-patterns.js +345 -401
  253. package/dist/themes/base-themes.esm.js +15 -24
  254. package/dist/themes/base-themes.js +15 -24
  255. package/dist/themes/colorManager.esm.js +293 -357
  256. package/dist/themes/colorManager.js +293 -357
  257. package/dist/themes/examples/dark-theme.esm.js +129 -133
  258. package/dist/themes/examples/dark-theme.js +129 -133
  259. package/dist/themes/examples/minimal-theme.esm.js +80 -85
  260. package/dist/themes/examples/minimal-theme.js +80 -85
  261. package/dist/themes/focus-management.esm.js +541 -677
  262. package/dist/themes/focus-management.js +541 -677
  263. package/dist/themes/fontLoader.esm.js +151 -180
  264. package/dist/themes/fontLoader.js +151 -180
  265. package/dist/themes/high-contrast.esm.js +394 -558
  266. package/dist/themes/high-contrast.js +394 -558
  267. package/dist/themes/index.esm.js +1 -9
  268. package/dist/themes/index.js +1 -9
  269. package/dist/themes/inheritance.esm.js +145 -180
  270. package/dist/themes/inheritance.js +145 -180
  271. package/dist/themes/keyboard-navigation.esm.js +418 -510
  272. package/dist/themes/keyboard-navigation.js +418 -510
  273. package/dist/themes/motion-reduction.esm.js +434 -591
  274. package/dist/themes/motion-reduction.js +434 -591
  275. package/dist/themes/navigation.esm.js +1 -234
  276. package/dist/themes/navigation.js +1 -234
  277. package/dist/themes/screen-reader.esm.js +515 -616
  278. package/dist/themes/screen-reader.js +515 -616
  279. package/dist/themes/systemThemeDetector.esm.js +135 -164
  280. package/dist/themes/systemThemeDetector.js +135 -164
  281. package/dist/themes/themeCSSUpdater.esm.js +217 -252
  282. package/dist/themes/themeCSSUpdater.js +217 -252
  283. package/dist/themes/themePersistence.esm.js +181 -212
  284. package/dist/themes/themePersistence.js +181 -212
  285. package/dist/themes/themes/default.esm.js +584 -0
  286. package/dist/themes/themes/default.js +584 -0
  287. package/dist/themes/themes/harvey.esm.js +551 -0
  288. package/dist/themes/themes/harvey.js +551 -0
  289. package/dist/themes/themes/stan-design.esm.js +654 -658
  290. package/dist/themes/themes/stan-design.js +654 -658
  291. package/dist/themes/types.esm.js +1 -458
  292. package/dist/themes/types.js +1 -458
  293. package/dist/themes/useSystemTheme.esm.js +34 -42
  294. package/dist/themes/useSystemTheme.js +34 -42
  295. package/dist/themes/useTheme.esm.js +23 -28
  296. package/dist/themes/useTheme.js +23 -28
  297. package/dist/themes/validation.esm.js +380 -433
  298. package/dist/themes/validation.js +380 -433
  299. package/dist/tokens/index.esm.js +2 -25
  300. package/dist/tokens/index.js +2 -25
  301. package/dist/tokens/tokenExporter.esm.js +309 -373
  302. package/dist/tokens/tokenExporter.js +309 -373
  303. package/dist/tokens/tokenGenerator.esm.js +241 -273
  304. package/dist/tokens/tokenGenerator.js +241 -273
  305. package/dist/tokens/tokenManager.esm.js +187 -241
  306. package/dist/tokens/tokenManager.js +187 -241
  307. package/dist/tokens/tokenValidator.esm.js +402 -522
  308. package/dist/tokens/tokenValidator.js +402 -522
  309. package/dist/tokens/types.esm.js +1 -78
  310. package/dist/tokens/types.js +1 -78
  311. package/dist/types.esm.js +3 -0
  312. package/dist/types.js +3 -0
  313. package/dist/utils/bundle-analyzer.esm.js +188 -246
  314. package/dist/utils/bundle-analyzer.js +188 -246
  315. package/dist/utils/bundle-splitting.esm.js +330 -458
  316. package/dist/utils/bundle-splitting.js +330 -458
  317. package/dist/utils/lazy-loading.esm.js +311 -417
  318. package/dist/utils/lazy-loading.js +311 -417
  319. package/dist/utils/performance-monitor.esm.js +369 -490
  320. package/dist/utils/performance-monitor.js +369 -490
  321. package/dist/utils/tree-shaking.esm.js +194 -264
  322. package/dist/utils/tree-shaking.js +194 -264
  323. package/package.json +18 -2
  324. package/src/index.ts +150 -149
  325. package/src/provider.tsx +3 -3
  326. package/src/theme.ts +1 -1
  327. package/{dist/theme.d.ts → src/themes/themes/default.ts} +77 -169
  328. package/src/themes/themes/harvey.ts +554 -0
  329. package/{dist/themes/types.d.ts → src/types.ts} +7 -1
  330. package/dist/components/ui/accessibility-demo.d.ts +0 -259
  331. package/dist/components/ui/advanced-component-architecture-demo.d.ts +0 -718
  332. package/dist/components/ui/advanced-transition-system-demo.d.ts +0 -660
  333. package/dist/components/ui/advanced-transition-system.d.ts +0 -391
  334. package/dist/components/ui/animation/animated-container.d.ts +0 -162
  335. package/dist/components/ui/animation/index.d.ts +0 -9
  336. package/dist/components/ui/animation/staggered-container.d.ts +0 -64
  337. package/dist/components/ui/animation-demo.d.ts +0 -238
  338. package/dist/components/ui/badge.d.ts +0 -28
  339. package/dist/components/ui/battery-conscious-animation-demo.d.ts +0 -561
  340. package/dist/components/ui/border-radius-shadow-demo.d.ts +0 -183
  341. package/dist/components/ui/button.d.ts +0 -33
  342. package/dist/components/ui/card.d.ts +0 -205
  343. package/dist/components/ui/checkbox.d.ts +0 -26
  344. package/dist/components/ui/color-preview.d.ts +0 -402
  345. package/dist/components/ui/data-display/chart.d.ts +0 -646
  346. package/dist/components/ui/data-display/data-grid-simple.d.ts +0 -73
  347. package/dist/components/ui/data-display/data-grid.d.ts +0 -670
  348. package/dist/components/ui/data-display/list.d.ts +0 -448
  349. package/dist/components/ui/data-display/table.d.ts +0 -472
  350. package/dist/components/ui/data-display/timeline.d.ts +0 -433
  351. package/dist/components/ui/data-display/tree.d.ts +0 -594
  352. package/dist/components/ui/data-display/types.d.ts +0 -534
  353. package/dist/components/ui/enterprise-mobile-experience-demo.d.ts +0 -735
  354. package/dist/components/ui/enterprise-mobile-experience.d.ts +0 -461
  355. package/dist/components/ui/feedback/alert.d.ts +0 -154
  356. package/dist/components/ui/feedback/progress.d.ts +0 -288
  357. package/dist/components/ui/feedback/skeleton.d.ts +0 -182
  358. package/dist/components/ui/feedback/toast.d.ts +0 -277
  359. package/dist/components/ui/feedback/types.d.ts +0 -123
  360. package/dist/components/ui/font-preview.d.ts +0 -282
  361. package/dist/components/ui/form-demo.d.ts +0 -544
  362. package/dist/components/ui/hardware-acceleration-demo.d.ts +0 -540
  363. package/dist/components/ui/input.d.ts +0 -33
  364. package/dist/components/ui/label.d.ts +0 -13
  365. package/dist/components/ui/layout-demo.d.ts +0 -352
  366. package/dist/components/ui/layouts/adaptive-layout.d.ts +0 -132
  367. package/dist/components/ui/layouts/desktop-layout.d.ts +0 -219
  368. package/dist/components/ui/layouts/index.d.ts +0 -5
  369. package/dist/components/ui/layouts/mobile-layout.d.ts +0 -158
  370. package/dist/components/ui/layouts/tablet-layout.d.ts +0 -192
  371. package/dist/components/ui/mobile-form-validation.d.ts +0 -439
  372. package/dist/components/ui/mobile-input-demo.d.ts +0 -197
  373. package/dist/components/ui/mobile-input.d.ts +0 -273
  374. package/dist/components/ui/mobile-skeleton-loading-demo.d.ts +0 -628
  375. package/dist/components/ui/navigation/breadcrumb.d.ts +0 -149
  376. package/dist/components/ui/navigation/index.d.ts +0 -25
  377. package/dist/components/ui/navigation/menu.d.ts +0 -366
  378. package/dist/components/ui/navigation/navigation-demo.d.ts +0 -169
  379. package/dist/components/ui/navigation/pagination.d.ts +0 -261
  380. package/dist/components/ui/navigation/sidebar.d.ts +0 -375
  381. package/dist/components/ui/navigation/stepper.d.ts +0 -294
  382. package/dist/components/ui/navigation/tabs.d.ts +0 -196
  383. package/dist/components/ui/navigation/types.d.ts +0 -293
  384. package/dist/components/ui/overlay/backdrop.d.ts +0 -79
  385. package/dist/components/ui/overlay/focus-manager.d.ts +0 -141
  386. package/dist/components/ui/overlay/index.d.ts +0 -27
  387. package/dist/components/ui/overlay/modal.d.ts +0 -262
  388. package/dist/components/ui/overlay/overlay-manager.d.ts +0 -107
  389. package/dist/components/ui/overlay/popover.d.ts +0 -450
  390. package/dist/components/ui/overlay/portal.d.ts +0 -75
  391. package/dist/components/ui/overlay/tooltip.d.ts +0 -298
  392. package/dist/components/ui/overlay/types.d.ts +0 -194
  393. package/dist/components/ui/performance-demo.d.ts +0 -583
  394. package/dist/components/ui/semantic-input-system-demo.d.ts +0 -490
  395. package/dist/components/ui/theme-customizer.d.ts +0 -378
  396. package/dist/components/ui/theme-preview.d.ts +0 -305
  397. package/dist/components/ui/theme-switcher.d.ts +0 -259
  398. package/dist/components/ui/theme-toggle.d.ts +0 -34
  399. package/dist/components/ui/token-demo.d.ts +0 -188
  400. package/dist/components/ui/touch-demo.d.ts +0 -455
  401. package/dist/components/ui/touch-friendly-interface-demo.d.ts +0 -512
  402. package/dist/components/ui/touch-friendly-interface.d.ts +0 -292
  403. package/dist/hooks/index.d.ts +0 -161
  404. package/dist/hooks/use-accessibility-support.d.ts +0 -516
  405. package/dist/hooks/use-adaptive-layout.d.ts +0 -287
  406. package/dist/hooks/use-advanced-patterns.d.ts +0 -292
  407. package/dist/hooks/use-advanced-transition-system.d.ts +0 -390
  408. package/dist/hooks/use-animation-profile.d.ts +0 -285
  409. package/dist/hooks/use-battery-animations.d.ts +0 -382
  410. package/dist/hooks/use-battery-conscious-loading.d.ts +0 -473
  411. package/dist/hooks/use-battery-optimization.d.ts +0 -328
  412. package/dist/hooks/use-battery-status.d.ts +0 -297
  413. package/dist/hooks/use-component-performance.d.ts +0 -342
  414. package/dist/hooks/use-device-loading-states.d.ts +0 -456
  415. package/dist/hooks/use-device.d.ts +0 -104
  416. package/dist/hooks/use-enterprise-mobile-experience.d.ts +0 -486
  417. package/dist/hooks/use-form-feedback.d.ts +0 -401
  418. package/dist/hooks/use-form-performance.d.ts +0 -511
  419. package/dist/hooks/use-frame-rate.d.ts +0 -249
  420. package/dist/hooks/use-gestures.d.ts +0 -336
  421. package/dist/hooks/use-hardware-acceleration.d.ts +0 -339
  422. package/dist/hooks/use-input-accessibility.d.ts +0 -451
  423. package/dist/hooks/use-input-performance.d.ts +0 -503
  424. package/dist/hooks/use-layout-performance.d.ts +0 -317
  425. package/dist/hooks/use-loading-accessibility.d.ts +0 -532
  426. package/dist/hooks/use-loading-performance.d.ts +0 -471
  427. package/dist/hooks/use-memory-usage.d.ts +0 -285
  428. package/dist/hooks/use-mobile-form-layout.d.ts +0 -462
  429. package/dist/hooks/use-mobile-form-validation.d.ts +0 -516
  430. package/dist/hooks/use-mobile-keyboard-optimization.d.ts +0 -469
  431. package/dist/hooks/use-mobile-layout.d.ts +0 -300
  432. package/dist/hooks/use-mobile-optimization.d.ts +0 -404
  433. package/dist/hooks/use-mobile-skeleton.d.ts +0 -399
  434. package/dist/hooks/use-mobile-touch.d.ts +0 -412
  435. package/dist/hooks/use-performance-throttling.d.ts +0 -346
  436. package/dist/hooks/use-performance.d.ts +0 -314
  437. package/dist/hooks/use-reusable-architecture.d.ts +0 -412
  438. package/dist/hooks/use-semantic-input-types.d.ts +0 -354
  439. package/dist/hooks/use-semantic-input.d.ts +0 -563
  440. package/dist/hooks/use-tablet-layout.d.ts +0 -382
  441. package/dist/hooks/use-touch-friendly-input.d.ts +0 -520
  442. package/dist/hooks/use-touch-friendly-interface.d.ts +0 -329
  443. package/dist/hooks/use-touch-optimization.d.ts +0 -373
  444. package/dist/index.d.ts +0 -149
  445. package/dist/lib/utils.d.ts +0 -3
  446. package/dist/plugins/theme-css-generator.d.ts +0 -345
  447. package/dist/provider.d.ts +0 -17
  448. package/dist/themes/ThemeContext.d.ts +0 -27
  449. package/dist/themes/ThemeProvider.d.ts +0 -222
  450. package/dist/themes/accessibility/index.d.ts +0 -7
  451. package/dist/themes/accessibility.d.ts +0 -259
  452. package/dist/themes/aria-patterns.d.ts +0 -418
  453. package/dist/themes/base-themes.d.ts +0 -34
  454. package/dist/themes/colorManager.d.ts +0 -327
  455. package/dist/themes/examples/dark-theme.d.ts +0 -139
  456. package/dist/themes/examples/minimal-theme.d.ts +0 -93
  457. package/dist/themes/focus-management.d.ts +0 -699
  458. package/dist/themes/fontLoader.d.ts +0 -163
  459. package/dist/themes/high-contrast.d.ts +0 -619
  460. package/dist/themes/index.d.ts +0 -11
  461. package/dist/themes/inheritance.d.ts +0 -160
  462. package/dist/themes/keyboard-navigation.d.ts +0 -550
  463. package/dist/themes/motion-reduction.d.ts +0 -660
  464. package/dist/themes/navigation.d.ts +0 -232
  465. package/dist/themes/screen-reader.d.ts +0 -645
  466. package/dist/themes/systemThemeDetector.d.ts +0 -148
  467. package/dist/themes/themeCSSUpdater.d.ts +0 -229
  468. package/dist/themes/themePersistence.d.ts +0 -192
  469. package/dist/themes/themes/stan-design.d.ts +0 -678
  470. package/dist/themes/useSystemTheme.d.ts +0 -43
  471. package/dist/themes/useTheme.d.ts +0 -20
  472. package/dist/themes/validation.d.ts +0 -406
  473. package/dist/tokens/index.d.ts +0 -25
  474. package/dist/tokens/tokenExporter.d.ts +0 -336
  475. package/dist/tokens/tokenGenerator.d.ts +0 -250
  476. package/dist/tokens/tokenManager.d.ts +0 -194
  477. package/dist/tokens/tokenValidator.d.ts +0 -488
  478. package/dist/tokens/types.d.ts +0 -78
  479. package/dist/utils/bundle-analyzer.d.ts +0 -260
  480. package/dist/utils/bundle-splitting.d.ts +0 -483
  481. package/dist/utils/lazy-loading.d.ts +0 -437
  482. package/dist/utils/performance-monitor.d.ts +0 -513
  483. package/dist/utils/tree-shaking.d.ts +0 -274
@@ -1,346 +0,0 @@
1
- export interface PerformanceThrottlingConfig {
2
- enablePerformanceMonitoring?: boolean
3
- enableAutomaticThrottling?: boolean
4
- enableUserExperienceOptimization?: boolean
5
- enableBatteryPreservation?: boolean
6
- performanceThreshold?: number
7
- frameRateTarget?: number
8
- memoryThreshold?: number
9
- cpuThreshold?: number
10
- }
11
-
12
- export interface PerformanceMetrics {
13
- fps: number
14
- frameTime: number
15
- memoryUsage: number
16
- cpuUsage: number
17
- performanceScore: number
18
- isThrottling: boolean
19
- throttleReason: string
20
- }
21
-
22
- export interface PerformanceThrottlingCallbacks {
23
- onPerformanceWarning?: (metrics: PerformanceMetrics) => void
24
- onThrottlingApplied?: (level: string, reason: string) => void
25
- onPerformanceRecovery?: (metrics: PerformanceMetrics) => void
26
- onUserExperienceOptimized?: (optimization: string) => void
27
- }
28
-
29
- export declare const usePerformanceThrottling: (
30
- config: PerformanceThrottlingConfig = {},
31
- callbacks: PerformanceThrottlingCallbacks = {}
32
- ) => {
33
- const {
34
- enablePerformanceMonitoring = true,
35
- enableAutomaticThrottling = true,
36
- enableUserExperienceOptimization = true,
37
- enableBatteryPreservation = true,
38
- performanceThreshold = 70,
39
- frameRateTarget = 60,
40
- memoryThreshold = 80,
41
- cpuThreshold = 80
42
- } = config
43
-
44
- const [metrics, setMetrics] = useState<PerformanceMetrics>({
45
- fps: 60,
46
- frameTime: 16.67,
47
- memoryUsage: 0,
48
- cpuUsage: 0,
49
- performanceScore: 100,
50
- isThrottling: false,
51
- throttleReason: 'none'
52
- })
53
-
54
- const [isOptimizing, setIsOptimizing] = useState(false)
55
- const [optimizations, setOptimizations] = useState<string[]>([])
56
- const [throttleLevel, setThrottleLevel] = useState<'none' | 'light' | 'moderate' | 'aggressive'>('none')
57
-
58
- const frameCountRef = useRef(0)
59
- const lastFrameTimeRef = useRef(performance.now())
60
- const performanceTimerRef = useRef<number | null>(null)
61
- const throttlingTimerRef = useRef<number | null>(null)
62
-
63
- // Performance monitoring
64
- const measurePerformance = useCallback(() => {
65
- if (!enablePerformanceMonitoring) return
66
-
67
- try {
68
- const now = performance.now()
69
- frameCountRef.current++
70
-
71
- if (now - lastFrameTimeRef.current >= 1000) {
72
- const fps = Math.round((frameCountRef.current * 1000) / (now - lastFrameTimeRef.current))
73
- const frameTime = 1000 / fps
74
-
75
- // Simulate memory and CPU usage
76
- const memoryUsage = Math.random() * 100
77
- const cpuUsage = Math.random() * 100
78
-
79
- // Calculate performance score
80
- const fpsScore = Math.min((fps / frameRateTarget) * 100, 100)
81
- const timeScore = Math.max(100 - (frameTime - 16.67) * 10, 0)
82
- const memoryScore = Math.max(100 - memoryUsage, 0)
83
- const cpuScore = Math.max(100 - cpuUsage, 0)
84
-
85
- const performanceScore = Math.round((fpsScore + timeScore + memoryScore + cpuScore) / 4)
86
-
87
- // Determine if throttling is needed
88
- const isThrottling = performanceScore < performanceThreshold ||
89
- fps < frameRateTarget * 0.8 ||
90
- memoryUsage > memoryThreshold ||
91
- cpuUsage > cpuThreshold
92
-
93
- let throttleReason = 'none'
94
- if (performanceScore < performanceThreshold) throttleReason = 'low_performance'
95
- else if (fps < frameRateTarget * 0.8) throttleReason = 'low_fps'
96
- else if (memoryUsage > memoryThreshold) throttleReason = 'high_memory'
97
- else if (cpuUsage > cpuThreshold) throttleReason = 'high_cpu'
98
-
99
- const newMetrics: PerformanceMetrics = {
100
- fps,
101
- frameTime,
102
- memoryUsage,
103
- cpuUsage,
104
- performanceScore,
105
- isThrottling,
106
- throttleReason
107
- }
108
-
109
- setMetrics(newMetrics)
110
-
111
- // Trigger callbacks
112
- if (isThrottling) {
113
- callbacks.onPerformanceWarning?.(newMetrics)
114
- } else if (metrics.isThrottling) {
115
- callbacks.onPerformanceRecovery?.(newMetrics)
116
- }
117
-
118
- frameCountRef.current = 0
119
- lastFrameTimeRef.current = now
120
- }
121
- } catch (error) {
122
- console.warn('Performance measurement failed:', error)
123
- }
124
- }, [enablePerformanceMonitoring, performanceThreshold, frameRateTarget, memoryThreshold, cpuThreshold, callbacks, metrics.isThrottling])
125
-
126
- // Automatic throttling
127
- const applyPerformanceThrottling = useCallback(() => {
128
- if (!enableAutomaticThrottling) return
129
-
130
- setIsOptimizing(true)
131
-
132
- setTimeout(() => {
133
- let newThrottleLevel: 'none' | 'light' | 'moderate' | 'aggressive' = 'none'
134
- let optimizations: string[] = []
135
-
136
- // Determine throttle level based on performance metrics
137
- if (metrics.performanceScore < 50 || metrics.fps < 30) {
138
- newThrottleLevel = 'aggressive'
139
- optimizations.push('Critical performance: Maximum throttling applied')
140
- optimizations.push('All non-essential animations disabled')
141
- optimizations.push('Frame rate limited to 30fps')
142
- optimizations.push('Memory usage optimized')
143
- } else if (metrics.performanceScore < 70 || metrics.fps < 45) {
144
- newThrottleLevel = 'moderate'
145
- optimizations.push('Performance issue: Moderate throttling applied')
146
- optimizations.push('Animation complexity reduced by 50%')
147
- optimizations.push('Frame rate limited to 45fps')
148
- optimizations.push('Memory optimization enabled')
149
- } else if (metrics.performanceScore < 85 || metrics.fps < 55) {
150
- newThrottleLevel = 'light'
151
- optimizations.push('Performance warning: Light throttling applied')
152
- optimizations.push('Animation complexity reduced by 25%')
153
- optimizations.push('Frame rate limited to 55fps')
154
- optimizations.push('Performance monitoring enhanced')
155
- }
156
-
157
- // Battery preservation considerations
158
- if (enableBatteryPreservation && newThrottleLevel !== 'none') {
159
- optimizations.push('Battery preservation: Animation efficiency optimized')
160
- optimizations.push('GPU usage minimized for power efficiency')
161
- }
162
-
163
- // User experience optimization
164
- if (enableUserExperienceOptimization && newThrottleLevel !== 'none') {
165
- optimizations.push('User experience: Smooth performance prioritized')
166
- optimizations.push('Animation quality balanced with performance')
167
- optimizations.push('Responsive interactions maintained')
168
- }
169
-
170
- setThrottleLevel(newThrottleLevel)
171
- setOptimizations(prev => [...prev, ...optimizations])
172
- setIsOptimizing(false)
173
-
174
- callbacks.onThrottlingApplied?.(newThrottleLevel, metrics.throttleReason)
175
-
176
- optimizations.forEach(optimization => {
177
- callbacks.onUserExperienceOptimized?.(optimization)
178
- })
179
- }, 200)
180
- }, [enableAutomaticThrottling, enableBatteryPreservation, enableUserExperienceOptimization, metrics, callbacks])
181
-
182
- // Get throttling recommendations
183
- const getThrottlingRecommendations = useCallback(() => {
184
- const recommendations = []
185
-
186
- if (metrics.performanceScore < 50) {
187
- recommendations.push('Critical: Disable all animations and complex UI operations')
188
- recommendations.push('Use static UI elements and minimal interactions')
189
- recommendations.push('Implement aggressive memory cleanup')
190
- } else if (metrics.performanceScore < 70) {
191
- recommendations.push('High: Significantly reduce animation complexity')
192
- recommendations.push('Limit concurrent animations to 2-3 maximum')
193
- recommendations.push('Use CSS transforms instead of JavaScript animations')
194
- } else if (metrics.performanceScore < 85) {
195
- recommendations.push('Medium: Consider light performance optimization')
196
- recommendations.push('Monitor animation frame rates closely')
197
- recommendations.push('Implement animation debouncing')
198
- }
199
-
200
- if (metrics.fps < frameRateTarget * 0.8) {
201
- recommendations.push('Low FPS: Reduce animation frame rate')
202
- recommendations.push('Use requestAnimationFrame for smooth animations')
203
- recommendations.push('Implement frame skipping for complex animations')
204
- }
205
-
206
- if (metrics.memoryUsage > memoryThreshold) {
207
- recommendations.push('High Memory: Optimize memory usage')
208
- recommendations.push('Clean up animation references')
209
- recommendations.push('Use object pooling for repeated animations')
210
- }
211
-
212
- if (metrics.cpuUsage > cpuThreshold) {
213
- recommendations.push('High CPU: Reduce computational complexity')
214
- recommendations.push('Use CSS animations instead of JavaScript')
215
- recommendations.push('Implement animation pausing when not visible')
216
- }
217
-
218
- return recommendations
219
- }, [metrics, frameRateTarget, memoryThreshold, cpuThreshold])
220
-
221
- // Get optimal performance settings
222
- const getOptimalPerformanceSettings = useCallback(() => {
223
- const settings = {
224
- maxConcurrentAnimations: 5,
225
- frameRateLimit: 60,
226
- animationQuality: 'high',
227
- memoryOptimization: false,
228
- cpuOptimization: false
229
- }
230
-
231
- switch (throttleLevel) {
232
- case 'aggressive':
233
- settings.maxConcurrentAnimations = 1
234
- settings.frameRateLimit = 30
235
- settings.animationQuality = 'minimal'
236
- settings.memoryOptimization = true
237
- settings.cpuOptimization = true
238
- break
239
- case 'moderate':
240
- settings.maxConcurrentAnimations = 2
241
- settings.frameRateLimit = 45
242
- settings.animationQuality = 'medium'
243
- settings.memoryOptimization = true
244
- settings.cpuOptimization = true
245
- break
246
- case 'light':
247
- settings.maxConcurrentAnimations = 3
248
- settings.frameRateLimit = 55
249
- settings.animationQuality = 'high'
250
- settings.memoryOptimization = true
251
- settings.cpuOptimization = false
252
- break
253
- default:
254
- settings.maxConcurrentAnimations = 5
255
- settings.frameRateLimit = 60
256
- settings.animationQuality = 'high'
257
- settings.memoryOptimization = false
258
- settings.cpuOptimization = false
259
- }
260
-
261
- return settings
262
- }, [throttleLevel])
263
-
264
- // Reset throttling
265
- const resetThrottling = useCallback(() => {
266
- setThrottleLevel('none')
267
- setOptimizations([])
268
- setMetrics(prev => ({
269
- ...prev,
270
- isThrottling: false,
271
- throttleReason: 'none'
272
- }))
273
- }, [])
274
-
275
- // Initialize performance monitoring
276
- useEffect(() => {
277
- if (!enablePerformanceMonitoring) return
278
-
279
- try {
280
- performanceTimerRef.current = window.setInterval(measurePerformance, 1000)
281
-
282
- return () => {
283
- if (performanceTimerRef.current) {
284
- clearInterval(performanceTimerRef.current)
285
- }
286
- }
287
- } catch (error) {
288
- console.warn('Performance monitoring initialization failed:', error)
289
- }
290
- }, [enablePerformanceMonitoring, measurePerformance])
291
-
292
- // Apply throttling when performance degrades
293
- useEffect(() => {
294
- if (enableAutomaticThrottling && metrics.isThrottling) {
295
- throttlingTimerRef.current = window.setTimeout(applyPerformanceThrottling, 1000)
296
-
297
- return () => {
298
- if (throttlingTimerRef.current) {
299
- clearTimeout(throttlingTimerRef.current)
300
- }
301
- }
302
- }
303
- }, [enableAutomaticThrottling, metrics.isThrottling, applyPerformanceThrottling])
304
-
305
- // Cleanup on unmount
306
- useEffect(() => {
307
- return () => {
308
- if (throttlingTimerRef.current) {
309
- clearTimeout(throttlingTimerRef.current)
310
- }
311
- }
312
- }, [])
313
-
314
- return {
315
- // State
316
- metrics,
317
- isOptimizing,
318
- optimizations,
319
- throttleLevel,
320
-
321
- // Actions
322
- measurePerformance,
323
- applyPerformanceThrottling,
324
- resetThrottling,
325
-
326
- // Computed values
327
- isThrottling: throttleLevel !== 'none',
328
- performanceLevel: metrics.performanceScore >= 90 ? 'excellent' :
329
- metrics.performanceScore >= 80 ? 'good' :
330
- metrics.performanceScore >= 70 ? 'fair' : 'poor',
331
- needsOptimization: metrics.performanceScore < 70,
332
- recommendations: getThrottlingRecommendations(),
333
- performanceSettings: getOptimalPerformanceSettings(),
334
-
335
- // Utility functions
336
- getPerformanceHealth: () => {
337
- if (metrics.performanceScore >= 90) return 'excellent'
338
- if (metrics.performanceScore >= 80) return 'good'
339
- if (metrics.performanceScore >= 70) return 'fair'
340
- if (metrics.performanceScore >= 50) return 'poor'
341
- return 'critical'
342
- }
343
- }
344
- }
345
-
346
- export default usePerformanceThrottling
@@ -1,314 +0,0 @@
1
- export interface PerformanceMetrics {
2
- fps: number
3
- frameTime: number
4
- memoryUsage?: number
5
- memoryLimit?: number
6
- memoryPercentage?: number
7
- batteryLevel?: number
8
- isLowPowerMode?: boolean
9
- isCharging?: boolean
10
- performanceMode: 'high' | 'medium' | 'low'
11
- throttlingEnabled: boolean
12
- throttlingReason?: string
13
- }
14
-
15
- export interface PerformanceThresholds {
16
- fps: {
17
- warning: number
18
- critical: number
19
- }
20
- memory: {
21
- warning: number
22
- critical: number
23
- }
24
- battery: {
25
- low: number
26
- critical: number
27
- }
28
- }
29
-
30
- export interface PerformanceCallbacks {
31
- onFPSWarning?: (fps: number) => void
32
- onMemoryWarning?: (usage: number) => void
33
- onBatteryLow?: (level: number) => void
34
- onPerformanceModeChange?: (mode: PerformanceMetrics['performanceMode']) => void
35
- onThrottlingChange?: (enabled: boolean, reason?: string) => void
36
- }
37
-
38
- export interface PerformanceOptions {
39
- updateInterval?: number
40
- thresholds?: Partial<PerformanceThresholds>
41
- enableThrottling?: boolean
42
- enableBatteryOptimization?: boolean
43
- callbacks?: PerformanceCallbacks
44
- }
45
-
46
- const DEFAULT_THRESHOLDS: PerformanceThresholds = {
47
- fps: {
48
- warning: 45,
49
- critical: 30
50
- },
51
- memory: {
52
- warning: 0.7,
53
- critical: 0.85
54
- },
55
- battery: {
56
- low: 0.3,
57
- critical: 0.15
58
- }
59
- }
60
-
61
- export declare const usePerformance: (options: PerformanceOptions = {}) => {
62
- const {
63
- updateInterval = 1000,
64
- thresholds = {},
65
- enableThrottling = true,
66
- enableBatteryOptimization = true,
67
- callbacks = {}
68
- } = options
69
-
70
- const [metrics, setMetrics] = useState<PerformanceMetrics>({
71
- fps: 60,
72
- frameTime: 16.67,
73
- performanceMode: 'high',
74
- throttlingEnabled: false
75
- })
76
-
77
- const [isMonitoring, setIsMonitoring] = useState(false)
78
- const frameCountRef = useRef(0)
79
- const lastTimeRef = useRef(performance.now())
80
- const animationIdRef = useRef<number>()
81
- const intervalIdRef = useRef<NodeJS.Timeout>()
82
-
83
- // Merge default thresholds with custom ones
84
- const finalThresholds = useMemo(() => ({
85
- ...DEFAULT_THRESHOLDS,
86
- ...thresholds
87
- }), [thresholds])
88
-
89
- // Frame rate monitoring
90
- const measureFrameRate = useCallback(() => {
91
- frameCountRef.current++
92
- const currentTime = performance.now()
93
-
94
- if (currentTime - lastTimeRef.current >= updateInterval) {
95
- const fps = Math.round((frameCountRef.current * 1000) / (currentTime - lastTimeRef.current))
96
- const frameTime = 1000 / fps
97
-
98
- setMetrics(prev => ({
99
- ...prev,
100
- fps,
101
- frameTime
102
- }))
103
-
104
- // Check FPS thresholds
105
- if (fps <= finalThresholds.fps.critical && callbacks.onFPSWarning) {
106
- callbacks.onFPSWarning(fps)
107
- }
108
-
109
- frameCountRef.current = 0
110
- lastTimeRef.current = currentTime
111
- }
112
-
113
- animationIdRef.current = requestAnimationFrame(measureFrameRate)
114
- }, [updateInterval, finalThresholds.fps.critical, callbacks.onFPSWarning])
115
-
116
- // Memory usage monitoring
117
- const updateMemoryInfo = useCallback(() => {
118
- if ('memory' in performance) {
119
- const memory = (performance as any).memory
120
- const memoryUsage = memory.usedJSHeapSize / memory.jsHeapSizeLimit
121
-
122
- setMetrics(prev => ({
123
- ...prev,
124
- memoryUsage,
125
- memoryLimit: memory.jsHeapSizeLimit,
126
- memoryPercentage: memoryUsage * 100
127
- }))
128
-
129
- // Check memory thresholds
130
- if (memoryUsage >= finalThresholds.memory.critical && callbacks.onMemoryWarning) {
131
- callbacks.onMemoryWarning(memoryUsage)
132
- }
133
- }
134
- }, [finalThresholds.memory.critical, callbacks.onMemoryWarning])
135
-
136
- // Battery status monitoring
137
- const updateBatteryInfo = useCallback(async () => {
138
- if ('getBattery' in navigator) {
139
- try {
140
- const battery = await (navigator as any).getBattery()
141
-
142
- setMetrics(prev => ({
143
- ...prev,
144
- batteryLevel: battery.level,
145
- isLowPowerMode: battery.level < finalThresholds.battery.low,
146
- isCharging: battery.charging
147
- }))
148
-
149
- // Check battery thresholds
150
- if (battery.level <= finalThresholds.battery.critical && callbacks.onBatteryLow) {
151
- callbacks.onBatteryLow(battery.level)
152
- }
153
- } catch (error) {
154
- console.warn('Battery API not available:', error)
155
- }
156
- }
157
- }, [finalThresholds.battery.low, finalThresholds.battery.critical, callbacks.onBatteryLow])
158
-
159
- // Performance mode determination
160
- const determinePerformanceMode = useCallback((fps: number, memoryUsage?: number): PerformanceMetrics['performanceMode'] => {
161
- if (fps < finalThresholds.fps.critical || (memoryUsage && memoryUsage > finalThresholds.memory.critical)) {
162
- return 'low'
163
- }
164
- if (fps < finalThresholds.fps.warning || (memoryUsage && memoryUsage > finalThresholds.memory.warning)) {
165
- return 'medium'
166
- }
167
- return 'high'
168
- }, [finalThresholds])
169
-
170
- // Performance throttling logic
171
- const shouldThrottle = useCallback((): { should: boolean; reason?: string } => {
172
- const { fps, memoryPercentage, batteryLevel, isLowPowerMode } = metrics
173
-
174
- // FPS-based throttling
175
- if (fps < finalThresholds.fps.critical) {
176
- return { should: true, reason: 'Low FPS' }
177
- }
178
-
179
- // Memory-based throttling
180
- if (memoryPercentage && memoryPercentage > finalThresholds.memory.critical * 100) {
181
- return { should: true, reason: 'High memory usage' }
182
- }
183
-
184
- // Battery-based throttling
185
- if (enableBatteryOptimization && (isLowPowerMode || (batteryLevel && batteryLevel < finalThresholds.battery.low))) {
186
- return { should: true, reason: 'Low battery' }
187
- }
188
-
189
- return { should: false }
190
- }, [metrics, finalThresholds, enableBatteryOptimization])
191
-
192
- // Update performance mode and throttling
193
- useEffect(() => {
194
- const newMode = determinePerformanceMode(metrics.fps, metrics.memoryUsage)
195
- const { should: shouldThrottleNow, reason } = shouldThrottle()
196
-
197
- setMetrics(prev => ({
198
- ...prev,
199
- performanceMode: newMode,
200
- throttlingEnabled: enableThrottling && shouldThrottleNow,
201
- throttlingReason: reason
202
- }))
203
-
204
- // Notify callbacks
205
- if (newMode !== metrics.performanceMode && callbacks.onPerformanceModeChange) {
206
- callbacks.onPerformanceModeChange(newMode)
207
- }
208
-
209
- if (enableThrottling && shouldThrottleNow !== metrics.throttlingEnabled && callbacks.onThrottlingChange) {
210
- callbacks.onThrottlingChange(shouldThrottleNow, reason)
211
- }
212
- }, [metrics.fps, metrics.memoryUsage, metrics.batteryLevel, metrics.isLowPowerMode, enableThrottling, determinePerformanceMode, shouldThrottle, callbacks, metrics.performanceMode, metrics.throttlingEnabled])
213
-
214
- // Start monitoring
215
- const startMonitoring = useCallback(() => {
216
- if (isMonitoring) return
217
-
218
- setIsMonitoring(true)
219
- measureFrameRate()
220
-
221
- // Set up interval for memory and battery updates
222
- intervalIdRef.current = setInterval(() => {
223
- updateMemoryInfo()
224
- updateBatteryInfo()
225
- }, updateInterval)
226
- }, [isMonitoring, measureFrameRate, updateMemoryInfo, updateBatteryInfo, updateInterval])
227
-
228
- // Stop monitoring
229
- const stopMonitoring = useCallback(() => {
230
- setIsMonitoring(false)
231
-
232
- if (animationIdRef.current) {
233
- cancelAnimationFrame(animationIdRef.current)
234
- }
235
-
236
- if (intervalIdRef.current) {
237
- clearInterval(intervalIdRef.current)
238
- }
239
- }, [])
240
-
241
- // Auto-start monitoring on mount
242
- useEffect(() => {
243
- startMonitoring()
244
- return () => stopMonitoring()
245
- }, [startMonitoring, stopMonitoring])
246
-
247
- // Performance optimization recommendations
248
- const getOptimizationRecommendations = useCallback(() => {
249
- const recommendations: string[] = []
250
-
251
- if (metrics.fps < finalThresholds.fps.warning) {
252
- recommendations.push('Consider reducing animation complexity or enabling performance mode')
253
- }
254
-
255
- if (metrics.memoryPercentage && metrics.memoryPercentage > finalThresholds.memory.warning * 100) {
256
- recommendations.push('Memory usage is high - consider implementing lazy loading or cleanup')
257
- }
258
-
259
- if (metrics.isLowPowerMode) {
260
- recommendations.push('Low battery detected - performance optimizations are active')
261
- }
262
-
263
- return recommendations
264
- }, [metrics, finalThresholds])
265
-
266
- // Throttling controls
267
- const enableThrottlingMode = useCallback(() => {
268
- setMetrics(prev => ({
269
- ...prev,
270
- throttlingEnabled: true,
271
- throttlingReason: 'Manual override'
272
- }))
273
- }, [])
274
-
275
- const disableThrottlingMode = useCallback(() => {
276
- setMetrics(prev => ({
277
- ...prev,
278
- throttlingEnabled: false,
279
- throttlingReason: undefined
280
- }))
281
- }, [])
282
-
283
- return {
284
- // Metrics
285
- metrics,
286
-
287
- // Controls
288
- startMonitoring,
289
- stopMonitoring,
290
- isMonitoring,
291
-
292
- // Throttling
293
- throttlingEnabled: metrics.throttlingEnabled,
294
- throttlingReason: metrics.throttlingReason,
295
- enableThrottlingMode,
296
- disableThrottlingMode,
297
-
298
- // Performance mode
299
- performanceMode: metrics.performanceMode,
300
-
301
- // Recommendations
302
- getOptimizationRecommendations,
303
-
304
- // Thresholds
305
- thresholds: finalThresholds,
306
-
307
- // Raw values for advanced usage
308
- fps: metrics.fps,
309
- frameTime: metrics.frameTime,
310
- memoryUsage: metrics.memoryUsage,
311
- batteryLevel: metrics.batteryLevel,
312
- isLowPowerMode: metrics.isLowPowerMode
313
- }
314
- }