@btst/stack 1.3.1 → 1.4.1

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 (238) hide show
  1. package/README.md +85 -37
  2. package/dist/node_modules/.pnpm/@radix-ui_react-accordion@1.2.12_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_947719a27ff11ec6f09710dd9e85efc5/node_modules/@radix-ui/react-accordion/dist/index.cjs +321 -0
  3. package/dist/node_modules/.pnpm/@radix-ui_react-accordion@1.2.12_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_947719a27ff11ec6f09710dd9e85efc5/node_modules/@radix-ui/react-accordion/dist/index.mjs +306 -0
  4. package/dist/node_modules/.pnpm/{@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384 → @radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.3_@types_react@19.2.6__@types_4f58c757aa677e233cf96d60fda2f1da}/node_modules/@radix-ui/react-alert-dialog/dist/index.cjs +2 -2
  5. package/dist/node_modules/.pnpm/{@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384 → @radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.3_@types_react@19.2.6__@types_4f58c757aa677e233cf96d60fda2f1da}/node_modules/@radix-ui/react-alert-dialog/dist/index.mjs +2 -2
  6. package/dist/node_modules/.pnpm/{@radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@1_9e04309f365863673e44407648bb0cb6 → @radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_35df44f6d87656c1401686c91d770dbb}/node_modules/@radix-ui/react-arrow/dist/index.cjs +1 -1
  7. package/dist/node_modules/.pnpm/{@radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@1_9e04309f365863673e44407648bb0cb6 → @radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_35df44f6d87656c1401686c91d770dbb}/node_modules/@radix-ui/react-arrow/dist/index.mjs +1 -1
  8. package/dist/node_modules/.pnpm/@radix-ui_react-collapsible@1.1.12_@types_react-dom@19.2.3_@types_react@19.2.6__@types__d025a77f62ee83ca6bd8b0ea1f9de738/node_modules/@radix-ui/react-collapsible/dist/index.cjs +168 -0
  9. package/dist/node_modules/.pnpm/@radix-ui_react-collapsible@1.1.12_@types_react-dom@19.2.3_@types_react@19.2.6__@types__d025a77f62ee83ca6bd8b0ea1f9de738/node_modules/@radix-ui/react-collapsible/dist/index.mjs +146 -0
  10. package/dist/node_modules/.pnpm/{@radix-ui_react-collection@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_re_6d7c277722b3619c9ee7e64e9a822c45 → @radix-ui_react-collection@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_59aa5e150e70a3e7bfb1567148b021b5}/node_modules/@radix-ui/react-collection/dist/index.cjs +2 -2
  11. package/dist/node_modules/.pnpm/{@radix-ui_react-collection@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_re_6d7c277722b3619c9ee7e64e9a822c45 → @radix-ui_react-collection@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_59aa5e150e70a3e7bfb1567148b021b5}/node_modules/@radix-ui/react-collection/dist/index.mjs +2 -2
  12. package/dist/node_modules/.pnpm/{@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.2_@types_react@19.2.2__@_ca5522e5d45d4722cb9eb5ce53defa61 → @radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@_9ee1db7daf927866cf505b31d40047ad}/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +4 -4
  13. package/dist/node_modules/.pnpm/{@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.2_@types_react@19.2.2__@_ca5522e5d45d4722cb9eb5ce53defa61 → @radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@_9ee1db7daf927866cf505b31d40047ad}/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs +4 -4
  14. package/dist/node_modules/.pnpm/@radix-ui_react-dropdown-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@type_a50051c7210b6fbd5be09388bda08578/node_modules/@radix-ui/react-dropdown-menu/dist/index.cjs +282 -0
  15. package/dist/node_modules/.pnpm/@radix-ui_react-dropdown-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@type_a50051c7210b6fbd5be09388bda08578/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs +247 -0
  16. package/dist/node_modules/.pnpm/{@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_r_93de389b3f622f9f764acc8e59ec80c0 → @radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_0a31b7f987af9482d13505312e1a1be9}/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +3 -3
  17. package/dist/node_modules/.pnpm/{@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_r_93de389b3f622f9f764acc8e59ec80c0 → @radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_0a31b7f987af9482d13505312e1a1be9}/node_modules/@radix-ui/react-focus-scope/dist/index.mjs +3 -3
  18. package/dist/node_modules/.pnpm/{@radix-ui_react-id@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-id/dist/index.cjs +1 -1
  19. package/dist/node_modules/.pnpm/{@radix-ui_react-id@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-id/dist/index.mjs +1 -1
  20. package/dist/node_modules/.pnpm/@radix-ui_react-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_82ed1fcd848b6984d9291a784d477cf4/node_modules/@radix-ui/react-menu/dist/index.cjs +845 -0
  21. package/dist/node_modules/.pnpm/@radix-ui_react-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_82ed1fcd848b6984d9291a784d477cf4/node_modules/@radix-ui/react-menu/dist/index.mjs +799 -0
  22. package/dist/node_modules/.pnpm/{@radix-ui_react-popper@1.2.8_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_d6285b8269ea5d6b59b300f5be279a0c → @radix-ui_react-popper@1.2.8_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_7ac2caae1e39f9ba93d5015614525161}/node_modules/@radix-ui/react-popper/dist/index.cjs +7 -7
  23. package/dist/node_modules/.pnpm/{@radix-ui_react-popper@1.2.8_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_d6285b8269ea5d6b59b300f5be279a0c → @radix-ui_react-popper@1.2.8_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_7ac2caae1e39f9ba93d5015614525161}/node_modules/@radix-ui/react-popper/dist/index.mjs +7 -7
  24. package/dist/node_modules/.pnpm/{@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_478b3d5dd4afab1a3dcce7ed1748cb95 → @radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_1bb4e0f97f86496802d28a2e74e2a8b9}/node_modules/@radix-ui/react-portal/dist/index.cjs +2 -2
  25. package/dist/node_modules/.pnpm/{@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_478b3d5dd4afab1a3dcce7ed1748cb95 → @radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_1bb4e0f97f86496802d28a2e74e2a8b9}/node_modules/@radix-ui/react-portal/dist/index.mjs +2 -2
  26. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.cjs +147 -0
  27. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.mjs +131 -0
  28. package/dist/node_modules/.pnpm/@radix-ui_react-roving-focus@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_fe1151d1f393bbc1072b24a86dff3a23/node_modules/@radix-ui/react-roving-focus/dist/index.cjs +244 -0
  29. package/dist/node_modules/.pnpm/@radix-ui_react-roving-focus@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_fe1151d1f393bbc1072b24a86dff3a23/node_modules/@radix-ui/react-roving-focus/dist/index.mjs +224 -0
  30. package/dist/node_modules/.pnpm/@radix-ui_react-scroll-area@1.2.10_@types_react-dom@19.2.3_@types_react@19.2.6__@types__e3f7735e9b444a10b3bbfd9fe97d44d0/node_modules/@radix-ui/react-scroll-area/dist/index.cjs +742 -0
  31. package/dist/node_modules/.pnpm/@radix-ui_react-scroll-area@1.2.10_@types_react-dom@19.2.3_@types_react@19.2.6__@types__e3f7735e9b444a10b3bbfd9fe97d44d0/node_modules/@radix-ui/react-scroll-area/dist/index.mjs +719 -0
  32. package/dist/node_modules/.pnpm/{@radix-ui_react-select@2.2.6_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_802c3d414c85063bee785fcc98a39c07 → @radix-ui_react-select@2.2.6_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_38dc681bb1f2bcfeb5249d8ca2bc01f5}/node_modules/@radix-ui/react-select/dist/index.cjs +17 -17
  33. package/dist/node_modules/.pnpm/{@radix-ui_react-select@2.2.6_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_802c3d414c85063bee785fcc98a39c07 → @radix-ui_react-select@2.2.6_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_38dc681bb1f2bcfeb5249d8ca2bc01f5}/node_modules/@radix-ui/react-select/dist/index.mjs +17 -17
  34. package/dist/node_modules/.pnpm/{@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +1 -1
  35. package/dist/node_modules/.pnpm/{@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs +1 -1
  36. package/dist/node_modules/.pnpm/{@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-escape-keydown/dist/index.cjs +1 -1
  37. package/dist/node_modules/.pnpm/{@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs +1 -1
  38. package/dist/node_modules/.pnpm/{@radix-ui_react-use-size@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-size@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-size/dist/index.cjs +1 -1
  39. package/dist/node_modules/.pnpm/{@radix-ui_react-use-size@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-size@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-size/dist/index.mjs +1 -1
  40. package/dist/node_modules/.pnpm/{@radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.2_@types_react@19.2.2__@typ_a84e98a44624c31e835a98d4b8b0c30d → @radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.3_@types_react@19.2.6__@typ_f453379bbd5a4932ec515167f81be42a}/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +1 -1
  41. package/dist/node_modules/.pnpm/{@radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.2_@types_react@19.2.2__@typ_a84e98a44624c31e835a98d4b8b0c30d → @radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.3_@types_react@19.2.6__@typ_f453379bbd5a4932ec515167f81be42a}/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs +1 -1
  42. package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/component.cjs +1 -1
  43. package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/component.mjs +1 -1
  44. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +2 -2
  45. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/SideEffect.mjs +2 -2
  46. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/UI.cjs +2 -2
  47. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/UI.mjs +2 -2
  48. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/medium.cjs +1 -1
  49. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/medium.mjs +1 -1
  50. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs +9 -0
  51. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/sidecar.mjs +1 -1
  52. package/dist/packages/better-stack/src/plugins/ai-chat/api/plugin.cjs +610 -0
  53. package/dist/packages/better-stack/src/plugins/ai-chat/api/plugin.mjs +608 -0
  54. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-input.cjs +221 -0
  55. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-input.mjs +219 -0
  56. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-interface.cjs +341 -0
  57. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-interface.mjs +339 -0
  58. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.cjs +135 -0
  59. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.mjs +133 -0
  60. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-message.cjs +429 -0
  61. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-message.mjs +423 -0
  62. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-sidebar.cjs +227 -0
  63. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-sidebar.mjs +225 -0
  64. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.cjs +31 -0
  65. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.mjs +29 -0
  66. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/index.cjs +11 -0
  67. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/index.mjs +8 -0
  68. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/404-page.cjs +18 -0
  69. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/404-page.mjs +16 -0
  70. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.cjs +39 -0
  71. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.internal.cjs +22 -0
  72. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.internal.mjs +20 -0
  73. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.mjs +37 -0
  74. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/default-error.cjs +18 -0
  75. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/default-error.mjs +16 -0
  76. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/error-placeholder.cjs +26 -0
  77. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/error-placeholder.mjs +24 -0
  78. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/tool-call-display.cjs +123 -0
  79. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/tool-call-display.mjs +121 -0
  80. package/dist/packages/better-stack/src/plugins/ai-chat/client/hooks/chat-hooks.cjs +199 -0
  81. package/dist/packages/better-stack/src/plugins/ai-chat/client/hooks/chat-hooks.mjs +191 -0
  82. package/dist/packages/better-stack/src/plugins/ai-chat/client/localization/index.cjs +63 -0
  83. package/dist/packages/better-stack/src/plugins/ai-chat/client/localization/index.mjs +61 -0
  84. package/dist/packages/better-stack/src/plugins/ai-chat/client/overrides.cjs +14 -0
  85. package/dist/packages/better-stack/src/plugins/ai-chat/client/overrides.mjs +11 -0
  86. package/dist/packages/better-stack/src/plugins/ai-chat/client/plugin.cjs +241 -0
  87. package/dist/packages/better-stack/src/plugins/ai-chat/client/plugin.mjs +239 -0
  88. package/dist/packages/better-stack/src/plugins/ai-chat/db.cjs +65 -0
  89. package/dist/packages/better-stack/src/plugins/ai-chat/db.mjs +63 -0
  90. package/dist/packages/better-stack/src/plugins/ai-chat/schemas.cjs +42 -0
  91. package/dist/packages/better-stack/src/plugins/ai-chat/schemas.mjs +38 -0
  92. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/markdown-content.cjs +12 -309
  93. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/markdown-content.mjs +13 -303
  94. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/page-wrapper.cjs +2 -2
  95. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/page-wrapper.mjs +2 -2
  96. package/dist/packages/ui/src/components/accordion.cjs +67 -0
  97. package/dist/packages/ui/src/components/accordion.mjs +62 -0
  98. package/dist/packages/ui/src/components/alert-dialog.cjs +1 -1
  99. package/dist/packages/ui/src/components/alert-dialog.mjs +1 -1
  100. package/dist/packages/{better-stack/src/plugins/blog/client/components/shared/better-blog-attribution.cjs → ui/src/components/better-stack-attribution.cjs} +3 -3
  101. package/dist/packages/{better-stack/src/plugins/blog/client/components/shared/better-blog-attribution.mjs → ui/src/components/better-stack-attribution.mjs} +3 -3
  102. package/dist/packages/ui/src/components/dialog.cjs +14 -0
  103. package/dist/packages/ui/src/components/dialog.mjs +14 -1
  104. package/dist/packages/ui/src/components/dropdown-menu.cjs +67 -0
  105. package/dist/packages/ui/src/components/dropdown-menu.mjs +62 -0
  106. package/dist/packages/ui/src/components/markdown-content.cjs +306 -0
  107. package/dist/packages/ui/src/components/markdown-content.mjs +297 -0
  108. package/dist/packages/ui/src/components/scroll-area.cjs +63 -0
  109. package/dist/packages/ui/src/components/scroll-area.mjs +60 -0
  110. package/dist/packages/ui/src/components/select.cjs +1 -1
  111. package/dist/packages/ui/src/components/select.mjs +1 -1
  112. package/dist/packages/ui/src/components/sheet.cjs +87 -0
  113. package/dist/packages/ui/src/components/sheet.mjs +69 -0
  114. package/dist/plugins/ai-chat/api/index.cjs +9 -0
  115. package/dist/plugins/ai-chat/api/index.d.cts +9 -0
  116. package/dist/plugins/ai-chat/api/index.d.mts +9 -0
  117. package/dist/plugins/ai-chat/api/index.d.ts +9 -0
  118. package/dist/plugins/ai-chat/api/index.mjs +2 -0
  119. package/dist/plugins/ai-chat/client/components/index.cjs +29 -0
  120. package/dist/plugins/ai-chat/client/components/index.d.cts +30 -0
  121. package/dist/plugins/ai-chat/client/components/index.d.mts +30 -0
  122. package/dist/plugins/ai-chat/client/components/index.d.ts +30 -0
  123. package/dist/plugins/ai-chat/client/components/index.mjs +12 -0
  124. package/dist/plugins/ai-chat/client/hooks/index.cjs +13 -0
  125. package/dist/plugins/ai-chat/client/hooks/index.d.cts +98 -0
  126. package/dist/plugins/ai-chat/client/hooks/index.d.mts +98 -0
  127. package/dist/plugins/ai-chat/client/hooks/index.d.ts +98 -0
  128. package/dist/plugins/ai-chat/client/hooks/index.mjs +1 -0
  129. package/dist/plugins/ai-chat/client/index.cjs +21 -0
  130. package/dist/plugins/ai-chat/client/index.d.cts +156 -0
  131. package/dist/plugins/ai-chat/client/index.d.mts +156 -0
  132. package/dist/plugins/ai-chat/client/index.d.ts +156 -0
  133. package/dist/plugins/ai-chat/client/index.mjs +8 -0
  134. package/dist/plugins/ai-chat/client.css +6 -0
  135. package/dist/plugins/ai-chat/query-keys.cjs +60 -0
  136. package/dist/plugins/ai-chat/query-keys.d.cts +478 -0
  137. package/dist/plugins/ai-chat/query-keys.d.mts +478 -0
  138. package/dist/plugins/ai-chat/query-keys.d.ts +478 -0
  139. package/dist/plugins/ai-chat/query-keys.mjs +58 -0
  140. package/dist/plugins/ai-chat/style.css +19 -0
  141. package/dist/plugins/blog/api/index.d.cts +1 -1
  142. package/dist/plugins/blog/api/index.d.mts +1 -1
  143. package/dist/plugins/blog/api/index.d.ts +1 -1
  144. package/dist/plugins/blog/client/components/shared/markdown-content-styles.css +91 -62
  145. package/dist/plugins/blog/client/hooks/index.d.cts +4 -4
  146. package/dist/plugins/blog/client/hooks/index.d.mts +4 -4
  147. package/dist/plugins/blog/client/hooks/index.d.ts +4 -4
  148. package/dist/plugins/blog/client/index.d.cts +1 -1
  149. package/dist/plugins/blog/client/index.d.mts +1 -1
  150. package/dist/plugins/blog/client/index.d.ts +1 -1
  151. package/dist/plugins/blog/query-keys.d.cts +7 -7
  152. package/dist/plugins/blog/query-keys.d.mts +7 -7
  153. package/dist/plugins/blog/query-keys.d.ts +7 -7
  154. package/dist/shared/stack.Be1QIHEn.d.cts +23 -0
  155. package/dist/shared/stack.Be1QIHEn.d.mts +23 -0
  156. package/dist/shared/stack.Be1QIHEn.d.ts +23 -0
  157. package/dist/shared/stack.DaOcgmrM.d.cts +323 -0
  158. package/dist/shared/stack.DaOcgmrM.d.mts +323 -0
  159. package/dist/shared/stack.DaOcgmrM.d.ts +323 -0
  160. package/package.json +59 -1
  161. package/src/plugins/ai-chat/api/index.ts +2 -0
  162. package/src/plugins/ai-chat/api/plugin.ts +1083 -0
  163. package/src/plugins/ai-chat/client/components/chat-input.tsx +295 -0
  164. package/src/plugins/ai-chat/client/components/chat-interface.tsx +494 -0
  165. package/src/plugins/ai-chat/client/components/chat-layout.tsx +175 -0
  166. package/src/plugins/ai-chat/client/components/chat-message.tsx +561 -0
  167. package/src/plugins/ai-chat/client/components/chat-sidebar.tsx +296 -0
  168. package/src/plugins/ai-chat/client/components/index.ts +18 -0
  169. package/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.tsx +57 -0
  170. package/src/plugins/ai-chat/client/components/loading/index.tsx +11 -0
  171. package/src/plugins/ai-chat/client/components/pages/404-page.tsx +27 -0
  172. package/src/plugins/ai-chat/client/components/pages/chat-page.internal.tsx +31 -0
  173. package/src/plugins/ai-chat/client/components/pages/chat-page.tsx +46 -0
  174. package/src/plugins/ai-chat/client/components/shared/default-error.tsx +28 -0
  175. package/src/plugins/ai-chat/client/components/shared/error-placeholder.tsx +22 -0
  176. package/src/plugins/ai-chat/client/components/tool-call-display.tsx +197 -0
  177. package/src/plugins/ai-chat/client/hooks/chat-hooks.tsx +349 -0
  178. package/src/plugins/ai-chat/client/hooks/index.tsx +1 -0
  179. package/src/plugins/ai-chat/client/index.ts +25 -0
  180. package/src/plugins/ai-chat/client/localization/index.ts +156 -0
  181. package/src/plugins/ai-chat/client/overrides.ts +241 -0
  182. package/src/plugins/ai-chat/client/plugin.tsx +449 -0
  183. package/src/plugins/ai-chat/client.css +6 -0
  184. package/src/plugins/ai-chat/db.ts +65 -0
  185. package/src/plugins/ai-chat/query-keys.ts +87 -0
  186. package/src/plugins/ai-chat/schemas.ts +40 -0
  187. package/src/plugins/ai-chat/style.css +19 -0
  188. package/src/plugins/ai-chat/types.ts +29 -0
  189. package/src/plugins/blog/client/components/shared/markdown-content-styles.css +91 -62
  190. package/src/plugins/blog/client/components/shared/markdown-content.tsx +19 -427
  191. package/src/plugins/blog/client/components/shared/page-wrapper.tsx +2 -2
  192. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs +0 -9
  193. package/src/plugins/blog/client/components/shared/better-blog-attribution.tsx +0 -19
  194. package/dist/node_modules/.pnpm/{@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +0 -0
  195. package/dist/node_modules/.pnpm/{@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-compose-refs/dist/index.mjs +0 -0
  196. package/dist/node_modules/.pnpm/{@radix-ui_react-context@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-context/dist/index.cjs +0 -0
  197. package/dist/node_modules/.pnpm/{@radix-ui_react-context@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-context/dist/index.mjs +0 -0
  198. package/dist/node_modules/.pnpm/{@radix-ui_react-direction@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-direction@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-direction/dist/index.cjs +0 -0
  199. package/dist/node_modules/.pnpm/{@radix-ui_react-direction@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-direction@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-direction/dist/index.mjs +0 -0
  200. package/dist/node_modules/.pnpm/{@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-focus-guards@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +0 -0
  201. package/dist/node_modules/.pnpm/{@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-focus-guards@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-focus-guards/dist/index.mjs +0 -0
  202. package/dist/node_modules/.pnpm/{@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.2_@types_react@19.2.2__@types_rea_bdc15f10281778271ffcbe8dd3cd491e → @radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596}/node_modules/@radix-ui/react-primitive/dist/index.cjs +0 -0
  203. package/dist/node_modules/.pnpm/{@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.2_@types_react@19.2.2__@types_rea_bdc15f10281778271ffcbe8dd3cd491e → @radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596}/node_modules/@radix-ui/react-primitive/dist/index.mjs +0 -0
  204. package/dist/node_modules/.pnpm/{@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +0 -0
  205. package/dist/node_modules/.pnpm/{@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs +0 -0
  206. package/dist/node_modules/.pnpm/{@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +0 -0
  207. package/dist/node_modules/.pnpm/{@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs +0 -0
  208. package/dist/node_modules/.pnpm/{@radix-ui_react-use-previous@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-previous@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-previous/dist/index.cjs +0 -0
  209. package/dist/node_modules/.pnpm/{@radix-ui_react-use-previous@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-previous@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-previous/dist/index.mjs +0 -0
  210. package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/constants.cjs +0 -0
  211. package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/constants.mjs +0 -0
  212. package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/utils.cjs +0 -0
  213. package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/utils.mjs +0 -0
  214. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/Combination.cjs +0 -0
  215. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/Combination.mjs +0 -0
  216. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.cjs +0 -0
  217. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.mjs +0 -0
  218. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs +0 -0
  219. package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/handleScroll.mjs +0 -0
  220. package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/component.cjs +0 -0
  221. package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/component.mjs +0 -0
  222. package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/hook.cjs +0 -0
  223. package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/hook.mjs +0 -0
  224. package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/singleton.cjs +0 -0
  225. package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/singleton.mjs +0 -0
  226. package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/assignRef.cjs +0 -0
  227. package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/assignRef.mjs +0 -0
  228. package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useMergeRef.cjs +0 -0
  229. package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useMergeRef.mjs +0 -0
  230. package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useRef.cjs +0 -0
  231. package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useRef.mjs +0 -0
  232. package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/exports.cjs +0 -0
  233. package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/exports.mjs +0 -0
  234. package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/medium.cjs +0 -0
  235. package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/medium.mjs +0 -0
  236. package/dist/shared/{stack.CbuN2zVV.d.ts → stack.CcI4sYJP.d.cts} +3 -3
  237. package/dist/shared/{stack.CbuN2zVV.d.cts → stack.CcI4sYJP.d.mts} +3 -3
  238. package/dist/shared/{stack.CbuN2zVV.d.mts → stack.CcI4sYJP.d.ts} +3 -3
@@ -0,0 +1,719 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import { Primitive } from '../../../../../@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596/node_modules/@radix-ui/react-primitive/dist/index.mjs';
4
+ import { Presence } from '../../../../../@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.mjs';
5
+ import { createContextScope } from '../../../../../@radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.mjs';
6
+ import { useComposedRefs } from '../../../../../@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.mjs';
7
+ import { useCallbackRef } from '../../../../../@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs';
8
+ import { useDirection } from '../../../../../@radix-ui_react-direction@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-direction/dist/index.mjs';
9
+ import { useLayoutEffect as useLayoutEffect2 } from '../../../../../@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs';
10
+ import { clamp } from '../../../../../@radix-ui_number@1.1.1/node_modules/@radix-ui/number/dist/index.mjs';
11
+ import { composeEventHandlers } from '../../../../../@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.mjs';
12
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
+
14
+ function useStateMachine(initialState, machine) {
15
+ return React.useReducer((state, event) => {
16
+ const nextState = machine[state][event];
17
+ return nextState ?? state;
18
+ }, initialState);
19
+ }
20
+ var SCROLL_AREA_NAME = "ScrollArea";
21
+ var [createScrollAreaContext] = createContextScope(SCROLL_AREA_NAME);
22
+ var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
23
+ var ScrollArea = React.forwardRef(
24
+ (props, forwardedRef) => {
25
+ const {
26
+ __scopeScrollArea,
27
+ type = "hover",
28
+ dir,
29
+ scrollHideDelay = 600,
30
+ ...scrollAreaProps
31
+ } = props;
32
+ const [scrollArea, setScrollArea] = React.useState(null);
33
+ const [viewport, setViewport] = React.useState(null);
34
+ const [content, setContent] = React.useState(null);
35
+ const [scrollbarX, setScrollbarX] = React.useState(null);
36
+ const [scrollbarY, setScrollbarY] = React.useState(null);
37
+ const [cornerWidth, setCornerWidth] = React.useState(0);
38
+ const [cornerHeight, setCornerHeight] = React.useState(0);
39
+ const [scrollbarXEnabled, setScrollbarXEnabled] = React.useState(false);
40
+ const [scrollbarYEnabled, setScrollbarYEnabled] = React.useState(false);
41
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setScrollArea(node));
42
+ const direction = useDirection(dir);
43
+ return /* @__PURE__ */ jsx(
44
+ ScrollAreaProvider,
45
+ {
46
+ scope: __scopeScrollArea,
47
+ type,
48
+ dir: direction,
49
+ scrollHideDelay,
50
+ scrollArea,
51
+ viewport,
52
+ onViewportChange: setViewport,
53
+ content,
54
+ onContentChange: setContent,
55
+ scrollbarX,
56
+ onScrollbarXChange: setScrollbarX,
57
+ scrollbarXEnabled,
58
+ onScrollbarXEnabledChange: setScrollbarXEnabled,
59
+ scrollbarY,
60
+ onScrollbarYChange: setScrollbarY,
61
+ scrollbarYEnabled,
62
+ onScrollbarYEnabledChange: setScrollbarYEnabled,
63
+ onCornerWidthChange: setCornerWidth,
64
+ onCornerHeightChange: setCornerHeight,
65
+ children: /* @__PURE__ */ jsx(
66
+ Primitive.div,
67
+ {
68
+ dir: direction,
69
+ ...scrollAreaProps,
70
+ ref: composedRefs,
71
+ style: {
72
+ position: "relative",
73
+ // Pass corner sizes as CSS vars to reduce re-renders of context consumers
74
+ ["--radix-scroll-area-corner-width"]: cornerWidth + "px",
75
+ ["--radix-scroll-area-corner-height"]: cornerHeight + "px",
76
+ ...props.style
77
+ }
78
+ }
79
+ )
80
+ }
81
+ );
82
+ }
83
+ );
84
+ ScrollArea.displayName = SCROLL_AREA_NAME;
85
+ var VIEWPORT_NAME = "ScrollAreaViewport";
86
+ var ScrollAreaViewport = React.forwardRef(
87
+ (props, forwardedRef) => {
88
+ const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
89
+ const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
90
+ const ref = React.useRef(null);
91
+ const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);
92
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
93
+ /* @__PURE__ */ jsx(
94
+ "style",
95
+ {
96
+ dangerouslySetInnerHTML: {
97
+ __html: `[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`
98
+ },
99
+ nonce
100
+ }
101
+ ),
102
+ /* @__PURE__ */ jsx(
103
+ Primitive.div,
104
+ {
105
+ "data-radix-scroll-area-viewport": "",
106
+ ...viewportProps,
107
+ ref: composedRefs,
108
+ style: {
109
+ /**
110
+ * We don't support `visible` because the intention is to have at least one scrollbar
111
+ * if this component is used and `visible` will behave like `auto` in that case
112
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
113
+ *
114
+ * We don't handle `auto` because the intention is for the native implementation
115
+ * to be hidden if using this component. We just want to ensure the node is scrollable
116
+ * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
117
+ * the browser from having to work out whether to render native scrollbars or not,
118
+ * we tell it to with the intention of hiding them in CSS.
119
+ */
120
+ overflowX: context.scrollbarXEnabled ? "scroll" : "hidden",
121
+ overflowY: context.scrollbarYEnabled ? "scroll" : "hidden",
122
+ ...props.style
123
+ },
124
+ children: /* @__PURE__ */ jsx("div", { ref: context.onContentChange, style: { minWidth: "100%", display: "table" }, children })
125
+ }
126
+ )
127
+ ] });
128
+ }
129
+ );
130
+ ScrollAreaViewport.displayName = VIEWPORT_NAME;
131
+ var SCROLLBAR_NAME = "ScrollAreaScrollbar";
132
+ var ScrollAreaScrollbar = React.forwardRef(
133
+ (props, forwardedRef) => {
134
+ const { forceMount, ...scrollbarProps } = props;
135
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
136
+ const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context;
137
+ const isHorizontal = props.orientation === "horizontal";
138
+ React.useEffect(() => {
139
+ isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
140
+ return () => {
141
+ isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
142
+ };
143
+ }, [isHorizontal, onScrollbarXEnabledChange, onScrollbarYEnabledChange]);
144
+ return context.type === "hover" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarHover, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "scroll" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarScroll, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "auto" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarAuto, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === "always" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarVisible, { ...scrollbarProps, ref: forwardedRef }) : null;
145
+ }
146
+ );
147
+ ScrollAreaScrollbar.displayName = SCROLLBAR_NAME;
148
+ var ScrollAreaScrollbarHover = React.forwardRef((props, forwardedRef) => {
149
+ const { forceMount, ...scrollbarProps } = props;
150
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
151
+ const [visible, setVisible] = React.useState(false);
152
+ React.useEffect(() => {
153
+ const scrollArea = context.scrollArea;
154
+ let hideTimer = 0;
155
+ if (scrollArea) {
156
+ const handlePointerEnter = () => {
157
+ window.clearTimeout(hideTimer);
158
+ setVisible(true);
159
+ };
160
+ const handlePointerLeave = () => {
161
+ hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay);
162
+ };
163
+ scrollArea.addEventListener("pointerenter", handlePointerEnter);
164
+ scrollArea.addEventListener("pointerleave", handlePointerLeave);
165
+ return () => {
166
+ window.clearTimeout(hideTimer);
167
+ scrollArea.removeEventListener("pointerenter", handlePointerEnter);
168
+ scrollArea.removeEventListener("pointerleave", handlePointerLeave);
169
+ };
170
+ }
171
+ }, [context.scrollArea, context.scrollHideDelay]);
172
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || visible, children: /* @__PURE__ */ jsx(
173
+ ScrollAreaScrollbarAuto,
174
+ {
175
+ "data-state": visible ? "visible" : "hidden",
176
+ ...scrollbarProps,
177
+ ref: forwardedRef
178
+ }
179
+ ) });
180
+ });
181
+ var ScrollAreaScrollbarScroll = React.forwardRef((props, forwardedRef) => {
182
+ const { forceMount, ...scrollbarProps } = props;
183
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
184
+ const isHorizontal = props.orientation === "horizontal";
185
+ const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
186
+ const [state, send] = useStateMachine("hidden", {
187
+ hidden: {
188
+ SCROLL: "scrolling"
189
+ },
190
+ scrolling: {
191
+ SCROLL_END: "idle",
192
+ POINTER_ENTER: "interacting"
193
+ },
194
+ interacting: {
195
+ SCROLL: "interacting",
196
+ POINTER_LEAVE: "idle"
197
+ },
198
+ idle: {
199
+ HIDE: "hidden",
200
+ SCROLL: "scrolling",
201
+ POINTER_ENTER: "interacting"
202
+ }
203
+ });
204
+ React.useEffect(() => {
205
+ if (state === "idle") {
206
+ const hideTimer = window.setTimeout(() => send("HIDE"), context.scrollHideDelay);
207
+ return () => window.clearTimeout(hideTimer);
208
+ }
209
+ }, [state, context.scrollHideDelay, send]);
210
+ React.useEffect(() => {
211
+ const viewport = context.viewport;
212
+ const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
213
+ if (viewport) {
214
+ let prevScrollPos = viewport[scrollDirection];
215
+ const handleScroll = () => {
216
+ const scrollPos = viewport[scrollDirection];
217
+ const hasScrollInDirectionChanged = prevScrollPos !== scrollPos;
218
+ if (hasScrollInDirectionChanged) {
219
+ send("SCROLL");
220
+ debounceScrollEnd();
221
+ }
222
+ prevScrollPos = scrollPos;
223
+ };
224
+ viewport.addEventListener("scroll", handleScroll);
225
+ return () => viewport.removeEventListener("scroll", handleScroll);
226
+ }
227
+ }, [context.viewport, isHorizontal, send, debounceScrollEnd]);
228
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || state !== "hidden", children: /* @__PURE__ */ jsx(
229
+ ScrollAreaScrollbarVisible,
230
+ {
231
+ "data-state": state === "hidden" ? "hidden" : "visible",
232
+ ...scrollbarProps,
233
+ ref: forwardedRef,
234
+ onPointerEnter: composeEventHandlers(props.onPointerEnter, () => send("POINTER_ENTER")),
235
+ onPointerLeave: composeEventHandlers(props.onPointerLeave, () => send("POINTER_LEAVE"))
236
+ }
237
+ ) });
238
+ });
239
+ var ScrollAreaScrollbarAuto = React.forwardRef((props, forwardedRef) => {
240
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
241
+ const { forceMount, ...scrollbarProps } = props;
242
+ const [visible, setVisible] = React.useState(false);
243
+ const isHorizontal = props.orientation === "horizontal";
244
+ const handleResize = useDebounceCallback(() => {
245
+ if (context.viewport) {
246
+ const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;
247
+ const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;
248
+ setVisible(isHorizontal ? isOverflowX : isOverflowY);
249
+ }
250
+ }, 10);
251
+ useResizeObserver(context.viewport, handleResize);
252
+ useResizeObserver(context.content, handleResize);
253
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || visible, children: /* @__PURE__ */ jsx(
254
+ ScrollAreaScrollbarVisible,
255
+ {
256
+ "data-state": visible ? "visible" : "hidden",
257
+ ...scrollbarProps,
258
+ ref: forwardedRef
259
+ }
260
+ ) });
261
+ });
262
+ var ScrollAreaScrollbarVisible = React.forwardRef((props, forwardedRef) => {
263
+ const { orientation = "vertical", ...scrollbarProps } = props;
264
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
265
+ const thumbRef = React.useRef(null);
266
+ const pointerOffsetRef = React.useRef(0);
267
+ const [sizes, setSizes] = React.useState({
268
+ content: 0,
269
+ viewport: 0,
270
+ scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
271
+ });
272
+ const thumbRatio = getThumbRatio(sizes.viewport, sizes.content);
273
+ const commonProps = {
274
+ ...scrollbarProps,
275
+ sizes,
276
+ onSizesChange: setSizes,
277
+ hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
278
+ onThumbChange: (thumb) => thumbRef.current = thumb,
279
+ onThumbPointerUp: () => pointerOffsetRef.current = 0,
280
+ onThumbPointerDown: (pointerPos) => pointerOffsetRef.current = pointerPos
281
+ };
282
+ function getScrollPosition(pointerPos, dir) {
283
+ return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);
284
+ }
285
+ if (orientation === "horizontal") {
286
+ return /* @__PURE__ */ jsx(
287
+ ScrollAreaScrollbarX,
288
+ {
289
+ ...commonProps,
290
+ ref: forwardedRef,
291
+ onThumbPositionChange: () => {
292
+ if (context.viewport && thumbRef.current) {
293
+ const scrollPos = context.viewport.scrollLeft;
294
+ const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir);
295
+ thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`;
296
+ }
297
+ },
298
+ onWheelScroll: (scrollPos) => {
299
+ if (context.viewport) context.viewport.scrollLeft = scrollPos;
300
+ },
301
+ onDragScroll: (pointerPos) => {
302
+ if (context.viewport) {
303
+ context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);
304
+ }
305
+ }
306
+ }
307
+ );
308
+ }
309
+ if (orientation === "vertical") {
310
+ return /* @__PURE__ */ jsx(
311
+ ScrollAreaScrollbarY,
312
+ {
313
+ ...commonProps,
314
+ ref: forwardedRef,
315
+ onThumbPositionChange: () => {
316
+ if (context.viewport && thumbRef.current) {
317
+ const scrollPos = context.viewport.scrollTop;
318
+ const offset = getThumbOffsetFromScroll(scrollPos, sizes);
319
+ thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;
320
+ }
321
+ },
322
+ onWheelScroll: (scrollPos) => {
323
+ if (context.viewport) context.viewport.scrollTop = scrollPos;
324
+ },
325
+ onDragScroll: (pointerPos) => {
326
+ if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
327
+ }
328
+ }
329
+ );
330
+ }
331
+ return null;
332
+ });
333
+ var ScrollAreaScrollbarX = React.forwardRef((props, forwardedRef) => {
334
+ const { sizes, onSizesChange, ...scrollbarProps } = props;
335
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
336
+ const [computedStyle, setComputedStyle] = React.useState();
337
+ const ref = React.useRef(null);
338
+ const composeRefs = useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);
339
+ React.useEffect(() => {
340
+ if (ref.current) setComputedStyle(getComputedStyle(ref.current));
341
+ }, [ref]);
342
+ return /* @__PURE__ */ jsx(
343
+ ScrollAreaScrollbarImpl,
344
+ {
345
+ "data-orientation": "horizontal",
346
+ ...scrollbarProps,
347
+ ref: composeRefs,
348
+ sizes,
349
+ style: {
350
+ bottom: 0,
351
+ left: context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
352
+ right: context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
353
+ ["--radix-scroll-area-thumb-width"]: getThumbSize(sizes) + "px",
354
+ ...props.style
355
+ },
356
+ onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.x),
357
+ onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.x),
358
+ onWheelScroll: (event, maxScrollPos) => {
359
+ if (context.viewport) {
360
+ const scrollPos = context.viewport.scrollLeft + event.deltaX;
361
+ props.onWheelScroll(scrollPos);
362
+ if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {
363
+ event.preventDefault();
364
+ }
365
+ }
366
+ },
367
+ onResize: () => {
368
+ if (ref.current && context.viewport && computedStyle) {
369
+ onSizesChange({
370
+ content: context.viewport.scrollWidth,
371
+ viewport: context.viewport.offsetWidth,
372
+ scrollbar: {
373
+ size: ref.current.clientWidth,
374
+ paddingStart: toInt(computedStyle.paddingLeft),
375
+ paddingEnd: toInt(computedStyle.paddingRight)
376
+ }
377
+ });
378
+ }
379
+ }
380
+ }
381
+ );
382
+ });
383
+ var ScrollAreaScrollbarY = React.forwardRef((props, forwardedRef) => {
384
+ const { sizes, onSizesChange, ...scrollbarProps } = props;
385
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
386
+ const [computedStyle, setComputedStyle] = React.useState();
387
+ const ref = React.useRef(null);
388
+ const composeRefs = useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);
389
+ React.useEffect(() => {
390
+ if (ref.current) setComputedStyle(getComputedStyle(ref.current));
391
+ }, [ref]);
392
+ return /* @__PURE__ */ jsx(
393
+ ScrollAreaScrollbarImpl,
394
+ {
395
+ "data-orientation": "vertical",
396
+ ...scrollbarProps,
397
+ ref: composeRefs,
398
+ sizes,
399
+ style: {
400
+ top: 0,
401
+ right: context.dir === "ltr" ? 0 : void 0,
402
+ left: context.dir === "rtl" ? 0 : void 0,
403
+ bottom: "var(--radix-scroll-area-corner-height)",
404
+ ["--radix-scroll-area-thumb-height"]: getThumbSize(sizes) + "px",
405
+ ...props.style
406
+ },
407
+ onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.y),
408
+ onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.y),
409
+ onWheelScroll: (event, maxScrollPos) => {
410
+ if (context.viewport) {
411
+ const scrollPos = context.viewport.scrollTop + event.deltaY;
412
+ props.onWheelScroll(scrollPos);
413
+ if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {
414
+ event.preventDefault();
415
+ }
416
+ }
417
+ },
418
+ onResize: () => {
419
+ if (ref.current && context.viewport && computedStyle) {
420
+ onSizesChange({
421
+ content: context.viewport.scrollHeight,
422
+ viewport: context.viewport.offsetHeight,
423
+ scrollbar: {
424
+ size: ref.current.clientHeight,
425
+ paddingStart: toInt(computedStyle.paddingTop),
426
+ paddingEnd: toInt(computedStyle.paddingBottom)
427
+ }
428
+ });
429
+ }
430
+ }
431
+ }
432
+ );
433
+ });
434
+ var [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME);
435
+ var ScrollAreaScrollbarImpl = React.forwardRef((props, forwardedRef) => {
436
+ const {
437
+ __scopeScrollArea,
438
+ sizes,
439
+ hasThumb,
440
+ onThumbChange,
441
+ onThumbPointerUp,
442
+ onThumbPointerDown,
443
+ onThumbPositionChange,
444
+ onDragScroll,
445
+ onWheelScroll,
446
+ onResize,
447
+ ...scrollbarProps
448
+ } = props;
449
+ const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
450
+ const [scrollbar, setScrollbar] = React.useState(null);
451
+ const composeRefs = useComposedRefs(forwardedRef, (node) => setScrollbar(node));
452
+ const rectRef = React.useRef(null);
453
+ const prevWebkitUserSelectRef = React.useRef("");
454
+ const viewport = context.viewport;
455
+ const maxScrollPos = sizes.content - sizes.viewport;
456
+ const handleWheelScroll = useCallbackRef(onWheelScroll);
457
+ const handleThumbPositionChange = useCallbackRef(onThumbPositionChange);
458
+ const handleResize = useDebounceCallback(onResize, 10);
459
+ function handleDragScroll(event) {
460
+ if (rectRef.current) {
461
+ const x = event.clientX - rectRef.current.left;
462
+ const y = event.clientY - rectRef.current.top;
463
+ onDragScroll({ x, y });
464
+ }
465
+ }
466
+ React.useEffect(() => {
467
+ const handleWheel = (event) => {
468
+ const element = event.target;
469
+ const isScrollbarWheel = scrollbar?.contains(element);
470
+ if (isScrollbarWheel) handleWheelScroll(event, maxScrollPos);
471
+ };
472
+ document.addEventListener("wheel", handleWheel, { passive: false });
473
+ return () => document.removeEventListener("wheel", handleWheel, { passive: false });
474
+ }, [viewport, scrollbar, maxScrollPos, handleWheelScroll]);
475
+ React.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]);
476
+ useResizeObserver(scrollbar, handleResize);
477
+ useResizeObserver(context.content, handleResize);
478
+ return /* @__PURE__ */ jsx(
479
+ ScrollbarProvider,
480
+ {
481
+ scope: __scopeScrollArea,
482
+ scrollbar,
483
+ hasThumb,
484
+ onThumbChange: useCallbackRef(onThumbChange),
485
+ onThumbPointerUp: useCallbackRef(onThumbPointerUp),
486
+ onThumbPositionChange: handleThumbPositionChange,
487
+ onThumbPointerDown: useCallbackRef(onThumbPointerDown),
488
+ children: /* @__PURE__ */ jsx(
489
+ Primitive.div,
490
+ {
491
+ ...scrollbarProps,
492
+ ref: composeRefs,
493
+ style: { position: "absolute", ...scrollbarProps.style },
494
+ onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
495
+ const mainPointer = 0;
496
+ if (event.button === mainPointer) {
497
+ const element = event.target;
498
+ element.setPointerCapture(event.pointerId);
499
+ rectRef.current = scrollbar.getBoundingClientRect();
500
+ prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
501
+ document.body.style.webkitUserSelect = "none";
502
+ if (context.viewport) context.viewport.style.scrollBehavior = "auto";
503
+ handleDragScroll(event);
504
+ }
505
+ }),
506
+ onPointerMove: composeEventHandlers(props.onPointerMove, handleDragScroll),
507
+ onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
508
+ const element = event.target;
509
+ if (element.hasPointerCapture(event.pointerId)) {
510
+ element.releasePointerCapture(event.pointerId);
511
+ }
512
+ document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
513
+ if (context.viewport) context.viewport.style.scrollBehavior = "";
514
+ rectRef.current = null;
515
+ })
516
+ }
517
+ )
518
+ }
519
+ );
520
+ });
521
+ var THUMB_NAME = "ScrollAreaThumb";
522
+ var ScrollAreaThumb = React.forwardRef(
523
+ (props, forwardedRef) => {
524
+ const { forceMount, ...thumbProps } = props;
525
+ const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
526
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || scrollbarContext.hasThumb, children: /* @__PURE__ */ jsx(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }) });
527
+ }
528
+ );
529
+ var ScrollAreaThumbImpl = React.forwardRef(
530
+ (props, forwardedRef) => {
531
+ const { __scopeScrollArea, style, ...thumbProps } = props;
532
+ const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
533
+ const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
534
+ const { onThumbPositionChange } = scrollbarContext;
535
+ const composedRef = useComposedRefs(
536
+ forwardedRef,
537
+ (node) => scrollbarContext.onThumbChange(node)
538
+ );
539
+ const removeUnlinkedScrollListenerRef = React.useRef(void 0);
540
+ const debounceScrollEnd = useDebounceCallback(() => {
541
+ if (removeUnlinkedScrollListenerRef.current) {
542
+ removeUnlinkedScrollListenerRef.current();
543
+ removeUnlinkedScrollListenerRef.current = void 0;
544
+ }
545
+ }, 100);
546
+ React.useEffect(() => {
547
+ const viewport = scrollAreaContext.viewport;
548
+ if (viewport) {
549
+ const handleScroll = () => {
550
+ debounceScrollEnd();
551
+ if (!removeUnlinkedScrollListenerRef.current) {
552
+ const listener = addUnlinkedScrollListener(viewport, onThumbPositionChange);
553
+ removeUnlinkedScrollListenerRef.current = listener;
554
+ onThumbPositionChange();
555
+ }
556
+ };
557
+ onThumbPositionChange();
558
+ viewport.addEventListener("scroll", handleScroll);
559
+ return () => viewport.removeEventListener("scroll", handleScroll);
560
+ }
561
+ }, [scrollAreaContext.viewport, debounceScrollEnd, onThumbPositionChange]);
562
+ return /* @__PURE__ */ jsx(
563
+ Primitive.div,
564
+ {
565
+ "data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
566
+ ...thumbProps,
567
+ ref: composedRef,
568
+ style: {
569
+ width: "var(--radix-scroll-area-thumb-width)",
570
+ height: "var(--radix-scroll-area-thumb-height)",
571
+ ...style
572
+ },
573
+ onPointerDownCapture: composeEventHandlers(props.onPointerDownCapture, (event) => {
574
+ const thumb = event.target;
575
+ const thumbRect = thumb.getBoundingClientRect();
576
+ const x = event.clientX - thumbRect.left;
577
+ const y = event.clientY - thumbRect.top;
578
+ scrollbarContext.onThumbPointerDown({ x, y });
579
+ }),
580
+ onPointerUp: composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)
581
+ }
582
+ );
583
+ }
584
+ );
585
+ ScrollAreaThumb.displayName = THUMB_NAME;
586
+ var CORNER_NAME = "ScrollAreaCorner";
587
+ var ScrollAreaCorner = React.forwardRef(
588
+ (props, forwardedRef) => {
589
+ const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea);
590
+ const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
591
+ const hasCorner = context.type !== "scroll" && hasBothScrollbarsVisible;
592
+ return hasCorner ? /* @__PURE__ */ jsx(ScrollAreaCornerImpl, { ...props, ref: forwardedRef }) : null;
593
+ }
594
+ );
595
+ ScrollAreaCorner.displayName = CORNER_NAME;
596
+ var ScrollAreaCornerImpl = React.forwardRef((props, forwardedRef) => {
597
+ const { __scopeScrollArea, ...cornerProps } = props;
598
+ const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea);
599
+ const [width, setWidth] = React.useState(0);
600
+ const [height, setHeight] = React.useState(0);
601
+ const hasSize = Boolean(width && height);
602
+ useResizeObserver(context.scrollbarX, () => {
603
+ const height2 = context.scrollbarX?.offsetHeight || 0;
604
+ context.onCornerHeightChange(height2);
605
+ setHeight(height2);
606
+ });
607
+ useResizeObserver(context.scrollbarY, () => {
608
+ const width2 = context.scrollbarY?.offsetWidth || 0;
609
+ context.onCornerWidthChange(width2);
610
+ setWidth(width2);
611
+ });
612
+ return hasSize ? /* @__PURE__ */ jsx(
613
+ Primitive.div,
614
+ {
615
+ ...cornerProps,
616
+ ref: forwardedRef,
617
+ style: {
618
+ width,
619
+ height,
620
+ position: "absolute",
621
+ right: context.dir === "ltr" ? 0 : void 0,
622
+ left: context.dir === "rtl" ? 0 : void 0,
623
+ bottom: 0,
624
+ ...props.style
625
+ }
626
+ }
627
+ ) : null;
628
+ });
629
+ function toInt(value) {
630
+ return value ? parseInt(value, 10) : 0;
631
+ }
632
+ function getThumbRatio(viewportSize, contentSize) {
633
+ const ratio = viewportSize / contentSize;
634
+ return isNaN(ratio) ? 0 : ratio;
635
+ }
636
+ function getThumbSize(sizes) {
637
+ const ratio = getThumbRatio(sizes.viewport, sizes.content);
638
+ const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
639
+ const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;
640
+ return Math.max(thumbSize, 18);
641
+ }
642
+ function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = "ltr") {
643
+ const thumbSizePx = getThumbSize(sizes);
644
+ const thumbCenter = thumbSizePx / 2;
645
+ const offset = pointerOffset || thumbCenter;
646
+ const thumbOffsetFromEnd = thumbSizePx - offset;
647
+ const minPointerPos = sizes.scrollbar.paddingStart + offset;
648
+ const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;
649
+ const maxScrollPos = sizes.content - sizes.viewport;
650
+ const scrollRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
651
+ const interpolate = linearScale([minPointerPos, maxPointerPos], scrollRange);
652
+ return interpolate(pointerPos);
653
+ }
654
+ function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
655
+ const thumbSizePx = getThumbSize(sizes);
656
+ const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
657
+ const scrollbar = sizes.scrollbar.size - scrollbarPadding;
658
+ const maxScrollPos = sizes.content - sizes.viewport;
659
+ const maxThumbPos = scrollbar - thumbSizePx;
660
+ const scrollClampRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
661
+ const scrollWithoutMomentum = clamp(scrollPos, scrollClampRange);
662
+ const interpolate = linearScale([0, maxScrollPos], [0, maxThumbPos]);
663
+ return interpolate(scrollWithoutMomentum);
664
+ }
665
+ function linearScale(input, output) {
666
+ return (value) => {
667
+ if (input[0] === input[1] || output[0] === output[1]) return output[0];
668
+ const ratio = (output[1] - output[0]) / (input[1] - input[0]);
669
+ return output[0] + ratio * (value - input[0]);
670
+ };
671
+ }
672
+ function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
673
+ return scrollPos > 0 && scrollPos < maxScrollPos;
674
+ }
675
+ var addUnlinkedScrollListener = (node, handler = () => {
676
+ }) => {
677
+ let prevPosition = { left: node.scrollLeft, top: node.scrollTop };
678
+ let rAF = 0;
679
+ (function loop() {
680
+ const position = { left: node.scrollLeft, top: node.scrollTop };
681
+ const isHorizontalScroll = prevPosition.left !== position.left;
682
+ const isVerticalScroll = prevPosition.top !== position.top;
683
+ if (isHorizontalScroll || isVerticalScroll) handler();
684
+ prevPosition = position;
685
+ rAF = window.requestAnimationFrame(loop);
686
+ })();
687
+ return () => window.cancelAnimationFrame(rAF);
688
+ };
689
+ function useDebounceCallback(callback, delay) {
690
+ const handleCallback = useCallbackRef(callback);
691
+ const debounceTimerRef = React.useRef(0);
692
+ React.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
693
+ return React.useCallback(() => {
694
+ window.clearTimeout(debounceTimerRef.current);
695
+ debounceTimerRef.current = window.setTimeout(handleCallback, delay);
696
+ }, [handleCallback, delay]);
697
+ }
698
+ function useResizeObserver(element, onResize) {
699
+ const handleResize = useCallbackRef(onResize);
700
+ useLayoutEffect2(() => {
701
+ let rAF = 0;
702
+ if (element) {
703
+ const resizeObserver = new ResizeObserver(() => {
704
+ cancelAnimationFrame(rAF);
705
+ rAF = window.requestAnimationFrame(handleResize);
706
+ });
707
+ resizeObserver.observe(element);
708
+ return () => {
709
+ window.cancelAnimationFrame(rAF);
710
+ resizeObserver.unobserve(element);
711
+ };
712
+ }
713
+ }, [element, handleResize]);
714
+ }
715
+ var Root = ScrollArea;
716
+ var Viewport = ScrollAreaViewport;
717
+ var Corner = ScrollAreaCorner;
718
+
719
+ export { Corner, Root, ScrollArea, ScrollAreaCorner, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport, Viewport };