@ctrl-ui/react 0.8.6 → 0.8.8

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 (376) hide show
  1. package/dist/action-bar.d.ts +15 -7
  2. package/dist/action-bar.js +39 -19
  3. package/dist/activity.js +7 -15
  4. package/dist/audio-recorder.d.ts +14 -4
  5. package/dist/audio-recorder.js +82 -29
  6. package/dist/audio-visualizer.js +1 -1
  7. package/dist/blocks/coding-agent.js +54 -57
  8. package/dist/blocks/design-canvas-data.d.ts +32 -0
  9. package/dist/blocks/design-canvas-data.js +100 -0
  10. package/dist/blocks/design-canvas-inspector.d.ts +8 -0
  11. package/dist/blocks/design-canvas-inspector.js +238 -0
  12. package/dist/blocks/design-canvas.d.ts +21 -0
  13. package/dist/blocks/design-canvas.js +452 -0
  14. package/dist/blocks/discussion.d.ts +28 -0
  15. package/dist/blocks/discussion.js +67 -0
  16. package/dist/blocks/file-explorer-data.d.ts +1 -0
  17. package/dist/blocks/file-explorer-data.js +4 -1
  18. package/dist/blocks/file-explorer.d.ts +9 -1
  19. package/dist/blocks/file-explorer.js +461 -192
  20. package/dist/blocks/settings.d.ts +2 -1
  21. package/dist/blocks/settings.js +101 -79
  22. package/dist/blocks/team-chat.d.ts +12 -0
  23. package/dist/blocks/team-chat.js +26 -0
  24. package/dist/blocks/theme-toggle.js +23 -31
  25. package/dist/chat-composer-attachment.d.ts +12 -3
  26. package/dist/chat-composer-attachment.js +61 -19
  27. package/dist/chat-composer-editor/extensions/mention.d.ts +5 -1
  28. package/dist/chat-composer-editor/extensions/mention.js +58 -27
  29. package/dist/chat-composer-editor/ghost.js +2 -4
  30. package/dist/chat-composer-editor/types.d.ts +5 -0
  31. package/dist/chat-composer-editor.d.ts +1 -1
  32. package/dist/chat-composer-editor.js +71 -28
  33. package/dist/chat-composer.d.ts +13 -32
  34. package/dist/chat-composer.js +54 -13
  35. package/dist/chat-layout.d.ts +19 -0
  36. package/dist/chat-layout.js +96 -32
  37. package/dist/chat-message/social.d.ts +26 -0
  38. package/dist/chat-message/social.js +122 -0
  39. package/dist/chat-message.d.ts +28 -29
  40. package/dist/chat-message.js +106 -25
  41. package/dist/context.d.ts +2 -2
  42. package/dist/context.js +38 -23
  43. package/dist/dynamic-notification-canvas-loop.d.ts +24 -0
  44. package/dist/dynamic-notification-canvas-loop.js +113 -0
  45. package/dist/dynamic-notification-glass.js +23 -114
  46. package/dist/dynamic-notification-liquid.js +14 -118
  47. package/dist/dynamic-notification.d.ts +16 -8
  48. package/dist/dynamic-notification.js +85 -22
  49. package/dist/email/email-brand.d.ts +7 -4
  50. package/dist/email/email-brand.js +9 -6
  51. package/dist/email/email-code.d.ts +3 -2
  52. package/dist/email/email-code.js +11 -9
  53. package/dist/email/email-footer.d.ts +5 -3
  54. package/dist/email/email-footer.js +11 -5
  55. package/dist/email/email.d.ts +31 -9
  56. package/dist/email/email.js +50 -26
  57. package/dist/email/templates.d.ts +10 -9
  58. package/dist/email/templates.js +102 -38
  59. package/dist/email/theme.js +1 -1
  60. package/dist/environment-variables.d.ts +4 -2
  61. package/dist/environment-variables.js +52 -32
  62. package/dist/filter-bar/context.d.ts +32 -0
  63. package/dist/filter-bar/context.js +11 -0
  64. package/dist/filter-bar/editor.d.ts +14 -0
  65. package/dist/filter-bar/editor.js +216 -0
  66. package/dist/filter-bar/model.d.ts +10 -0
  67. package/dist/filter-bar/model.js +57 -0
  68. package/dist/filter-bar/motion.d.ts +10 -0
  69. package/dist/filter-bar/motion.js +84 -0
  70. package/dist/filter-bar/parts.d.ts +19 -0
  71. package/dist/filter-bar/parts.js +244 -0
  72. package/dist/filter-bar/types.d.ts +54 -0
  73. package/dist/filter-bar/types.js +0 -0
  74. package/dist/filter-bar.d.ts +27 -0
  75. package/dist/filter-bar.js +310 -0
  76. package/dist/hooks/use-audio-recorder.js +12 -6
  77. package/dist/hooks/use-chat-composer.d.ts +21 -7
  78. package/dist/hooks/use-chat-composer.js +32 -5
  79. package/dist/hooks/use-chat-message.d.ts +28 -2
  80. package/dist/hooks/use-chat-message.js +41 -10
  81. package/dist/hooks/use-chat-thread-scroll.js +43 -7
  82. package/dist/hooks/use-color-area.d.ts +3 -3
  83. package/dist/hooks/use-color-area.js +13 -12
  84. package/dist/hooks/use-copy-to-clipboard.d.ts +2 -1
  85. package/dist/hooks/use-copy-to-clipboard.js +20 -20
  86. package/dist/hooks/use-dropzone.d.ts +7 -4
  87. package/dist/hooks/use-dropzone.js +34 -3
  88. package/dist/hooks/use-dynamic-notification.d.ts +6 -2
  89. package/dist/hooks/use-dynamic-notification.js +26 -10
  90. package/dist/hooks/use-mobile.d.ts +3 -2
  91. package/dist/hooks/use-mobile.js +8 -4
  92. package/dist/hooks/use-textarea-trigger-menu.js +2 -1
  93. package/dist/hooks/use-trigger-menu.d.ts +54 -0
  94. package/dist/hooks/use-trigger-menu.js +102 -47
  95. package/dist/hooks/use-user-ask.d.ts +2 -0
  96. package/dist/hooks/use-user-ask.js +35 -41
  97. package/dist/inline-attachment.d.ts +6 -2
  98. package/dist/inline-attachment.js +44 -29
  99. package/dist/inline-citation.d.ts +12 -5
  100. package/dist/inline-citation.js +25 -16
  101. package/dist/knob-contracts/audio-recorder-knobs.d.ts +1 -1
  102. package/dist/knob-contracts/audio-recorder-knobs.js +2 -1
  103. package/dist/knob-contracts/audio-visualizer-knobs.d.ts +1 -1
  104. package/dist/knob-contracts/audio-visualizer-knobs.js +2 -1
  105. package/dist/knob-contracts/avatar-knobs.d.ts +1 -1
  106. package/dist/knob-contracts/avatar-knobs.js +6 -1
  107. package/dist/knob-contracts/badge-knobs.d.ts +1 -1
  108. package/dist/knob-contracts/badge-knobs.js +2 -1
  109. package/dist/knob-contracts/breadcrumb-knobs.d.ts +4 -0
  110. package/dist/knob-contracts/breadcrumb-knobs.js +8 -0
  111. package/dist/knob-contracts/button-knobs.d.ts +1 -1
  112. package/dist/knob-contracts/button-knobs.js +1 -0
  113. package/dist/knob-contracts/chat-layout-knobs.d.ts +1 -1
  114. package/dist/knob-contracts/chat-layout-knobs.js +2 -1
  115. package/dist/knob-contracts/chat-message-knobs.d.ts +1 -1
  116. package/dist/knob-contracts/chat-message-knobs.js +8 -1
  117. package/dist/knob-contracts/choice-knobs.d.ts +1 -1
  118. package/dist/knob-contracts/choice-knobs.js +1 -0
  119. package/dist/knob-contracts/code-diff-knobs.d.ts +1 -1
  120. package/dist/knob-contracts/code-diff-knobs.js +2 -0
  121. package/dist/knob-contracts/code-knobs.d.ts +1 -1
  122. package/dist/knob-contracts/code-knobs.js +2 -1
  123. package/dist/knob-contracts/collapsible-knobs.d.ts +1 -1
  124. package/dist/knob-contracts/collapsible-knobs.js +1 -1
  125. package/dist/knob-contracts/dynamic-notification-knobs.d.ts +1 -1
  126. package/dist/knob-contracts/dynamic-notification-knobs.js +2 -0
  127. package/dist/knob-contracts/emoji-picker-knobs.d.ts +4 -0
  128. package/dist/knob-contracts/emoji-picker-knobs.js +10 -0
  129. package/dist/knob-contracts/field-knobs.d.ts +1 -1
  130. package/dist/knob-contracts/field-knobs.js +5 -1
  131. package/dist/knob-contracts/filter-bar-knobs.d.ts +4 -0
  132. package/dist/knob-contracts/filter-bar-knobs.js +15 -0
  133. package/dist/knob-contracts/infinite-canvas-knobs.d.ts +1 -1
  134. package/dist/knob-contracts/infinite-canvas-knobs.js +3 -0
  135. package/dist/knob-contracts/markdown-knobs.d.ts +1 -1
  136. package/dist/knob-contracts/markdown-knobs.js +3 -1
  137. package/dist/knob-contracts/page-layout-knobs.d.ts +1 -1
  138. package/dist/knob-contracts/page-layout-knobs.js +4 -1
  139. package/dist/knob-contracts/popup-knobs.d.ts +1 -1
  140. package/dist/knob-contracts/popup-knobs.js +28 -0
  141. package/dist/knob-contracts/range-knobs.d.ts +1 -1
  142. package/dist/knob-contracts/range-knobs.js +1 -0
  143. package/dist/knob-contracts/rich-tooltip-knobs.d.ts +1 -1
  144. package/dist/knob-contracts/rich-tooltip-knobs.js +2 -1
  145. package/dist/knob-contracts/sidebar-knobs.d.ts +1 -1
  146. package/dist/knob-contracts/sidebar-knobs.js +27 -2
  147. package/dist/knob-contracts/spinner-knobs.d.ts +1 -1
  148. package/dist/knob-contracts/spinner-knobs.js +1 -1
  149. package/dist/knob-contracts/stepper-knobs.d.ts +1 -1
  150. package/dist/knob-contracts/stepper-knobs.js +4 -1
  151. package/dist/knob-contracts/switch-knobs.d.ts +1 -1
  152. package/dist/knob-contracts/switch-knobs.js +5 -0
  153. package/dist/knob-contracts/table-of-contents-knobs.d.ts +1 -1
  154. package/dist/knob-contracts/table-of-contents-knobs.js +4 -5
  155. package/dist/knob-contracts/tabs-knobs.d.ts +1 -1
  156. package/dist/knob-contracts/tabs-knobs.js +1 -0
  157. package/dist/knob-contracts/tree-knobs.d.ts +1 -1
  158. package/dist/knob-contracts/tree-knobs.js +2 -1
  159. package/dist/lib/cn.js +0 -4
  160. package/dist/lib/contrast.d.ts +1 -0
  161. package/dist/lib/contrast.js +17 -5
  162. package/dist/lib/dropzone-validation.js +41 -28
  163. package/dist/lib/env-file.d.ts +1 -1
  164. package/dist/lib/env-file.js +5 -5
  165. package/dist/lib/motion.d.ts +4 -0
  166. package/dist/lib/motion.js +15 -0
  167. package/dist/lib/trigger-detect.js +6 -8
  168. package/dist/markdown-block.js +13 -8
  169. package/dist/popup-parts.d.ts +8 -0
  170. package/dist/popup-parts.js +43 -0
  171. package/dist/scripts/contrast-eval.js +5 -4
  172. package/dist/source-badge.js +3 -1
  173. package/dist/styles/code.css +0 -2
  174. package/dist/styles/effects.css +6 -32
  175. package/dist/styles/index.css +14 -8
  176. package/dist/styles/recipes/accordion.css +9 -6
  177. package/dist/styles/recipes/action-bar.css +0 -15
  178. package/dist/styles/recipes/activity.css +5 -11
  179. package/dist/styles/recipes/alert.css +4 -4
  180. package/dist/styles/recipes/audio-recorder.css +15 -3
  181. package/dist/styles/recipes/audio-visualizer.css +13 -2
  182. package/dist/styles/recipes/avatar.css +78 -1
  183. package/dist/styles/recipes/badge.css +14 -4
  184. package/dist/styles/recipes/breadcrumb.css +77 -0
  185. package/dist/styles/recipes/button-group.css +6 -8
  186. package/dist/styles/recipes/button-states.css +66 -0
  187. package/dist/styles/recipes/button.css +26 -85
  188. package/dist/styles/recipes/calendar.css +17 -23
  189. package/dist/styles/recipes/card.css +2 -2
  190. package/dist/styles/recipes/chat-composer-attachment.css +9 -3
  191. package/dist/styles/recipes/chat-composer.css +21 -16
  192. package/dist/styles/recipes/chat-layout.css +64 -2
  193. package/dist/styles/recipes/chat-message-social.css +123 -0
  194. package/dist/styles/recipes/chat-message.css +157 -37
  195. package/dist/styles/recipes/choice.css +25 -21
  196. package/dist/styles/recipes/code-diff.css +51 -26
  197. package/dist/styles/recipes/code.css +44 -18
  198. package/dist/styles/recipes/collapsible.css +43 -1
  199. package/dist/styles/recipes/color-picker-details.css +3 -4
  200. package/dist/styles/recipes/color-picker-values.css +9 -8
  201. package/dist/styles/recipes/color-picker.css +23 -4
  202. package/dist/styles/recipes/context.css +3 -3
  203. package/dist/styles/recipes/dockable-panel.css +18 -7
  204. package/dist/styles/recipes/dropzone.css +7 -8
  205. package/dist/styles/recipes/dynamic-notification-input.css +8 -5
  206. package/dist/styles/recipes/dynamic-notification-motion.css +12 -21
  207. package/dist/styles/recipes/dynamic-notification.css +40 -26
  208. package/dist/styles/recipes/emoji-picker.css +132 -0
  209. package/dist/styles/recipes/empty.css +5 -4
  210. package/dist/styles/recipes/environment-variables.css +4 -15
  211. package/dist/styles/recipes/field-parts.css +89 -21
  212. package/dist/styles/recipes/field.css +83 -26
  213. package/dist/styles/recipes/filter-bar.css +161 -0
  214. package/dist/styles/recipes/gradient-editor.css +18 -7
  215. package/dist/styles/recipes/infinite-canvas.css +51 -4
  216. package/dist/styles/recipes/inline-attachment.css +9 -4
  217. package/dist/styles/recipes/inline-citation.css +10 -4
  218. package/dist/styles/recipes/item.css +23 -9
  219. package/dist/styles/recipes/markdown-block.css +5 -4
  220. package/dist/styles/recipes/markdown.css +68 -26
  221. package/dist/styles/recipes/morphing-panel.css +8 -8
  222. package/dist/styles/recipes/page-layout.css +36 -10
  223. package/dist/styles/recipes/pagination.css +5 -6
  224. package/dist/styles/recipes/phone-input.css +12 -8
  225. package/dist/styles/recipes/popup-controls.css +175 -26
  226. package/dist/styles/recipes/popup-drawer.css +35 -44
  227. package/dist/styles/recipes/popup-lists.css +139 -29
  228. package/dist/styles/recipes/popup-motion.css +4 -45
  229. package/dist/styles/recipes/popup-toast.css +55 -26
  230. package/dist/styles/recipes/popup.css +149 -153
  231. package/dist/styles/recipes/range.css +55 -19
  232. package/dist/styles/recipes/resizable.css +36 -7
  233. package/dist/styles/recipes/rich-tooltip.css +24 -34
  234. package/dist/styles/recipes/scroll-area.css +8 -1
  235. package/dist/styles/recipes/sidebar-menu.css +149 -34
  236. package/dist/styles/recipes/sidebar-parts.css +154 -0
  237. package/dist/styles/recipes/sidebar.css +187 -128
  238. package/dist/styles/recipes/source-badge.css +1 -1
  239. package/dist/styles/recipes/spinner.css +12 -1
  240. package/dist/styles/recipes/stepper.css +31 -13
  241. package/dist/styles/recipes/switch.css +68 -23
  242. package/dist/styles/recipes/table-of-contents.css +49 -41
  243. package/dist/styles/recipes/table.css +14 -10
  244. package/dist/styles/recipes/tabs.css +38 -12
  245. package/dist/styles/recipes/task-list.css +7 -14
  246. package/dist/styles/recipes/thread-rail.css +42 -19
  247. package/dist/styles/recipes/timeline.css +2 -0
  248. package/dist/styles/recipes/toolbar.css +27 -25
  249. package/dist/styles/recipes/track-highlight.css +12 -8
  250. package/dist/styles/recipes/transcript-divider.css +2 -2
  251. package/dist/styles/recipes/tree.css +31 -4
  252. package/dist/styles/recipes/user-ask-details.css +0 -1
  253. package/dist/styles/recipes/user-ask.css +4 -4
  254. package/dist/styles/theme.css +287 -107
  255. package/dist/task-list.d.ts +4 -1
  256. package/dist/task-list.js +24 -8
  257. package/dist/thread-rail.d.ts +1 -1
  258. package/dist/thread-rail.js +61 -19
  259. package/dist/transcript-divider.js +2 -1
  260. package/dist/ui/alert.d.ts +3 -1
  261. package/dist/ui/alert.js +14 -8
  262. package/dist/ui/autocomplete.js +7 -1
  263. package/dist/ui/avatar.d.ts +8 -0
  264. package/dist/ui/avatar.js +23 -3
  265. package/dist/ui/badge.js +1 -1
  266. package/dist/ui/breadcrumb.d.ts +27 -0
  267. package/dist/ui/breadcrumb.js +88 -0
  268. package/dist/ui/button.d.ts +2 -1
  269. package/dist/ui/button.js +1 -1
  270. package/dist/ui/calendar.js +2 -2
  271. package/dist/ui/card.d.ts +3 -1
  272. package/dist/ui/card.js +12 -7
  273. package/dist/ui/checkbox-group.js +1 -1
  274. package/dist/ui/checkbox.d.ts +2 -0
  275. package/dist/ui/code-diff.d.ts +1 -1
  276. package/dist/ui/code-diff.js +71 -27
  277. package/dist/ui/code.d.ts +5 -3
  278. package/dist/ui/code.js +27 -28
  279. package/dist/ui/color-picker.d.ts +5 -2
  280. package/dist/ui/color-picker.js +84 -36
  281. package/dist/ui/combobox-disabled-selection.d.ts +1 -2
  282. package/dist/ui/combobox-disabled-selection.js +7 -8
  283. package/dist/ui/combobox.d.ts +5 -23
  284. package/dist/ui/combobox.js +36 -16
  285. package/dist/ui/command.d.ts +8 -2
  286. package/dist/ui/command.js +39 -15
  287. package/dist/ui/context-menu.js +3 -0
  288. package/dist/ui/dialog.d.ts +2 -1
  289. package/dist/ui/dialog.js +3 -22
  290. package/dist/ui/dockable-panel-geometry.d.ts +1 -0
  291. package/dist/ui/dockable-panel-geometry.js +7 -1
  292. package/dist/ui/dockable-panel.d.ts +9 -6
  293. package/dist/ui/dockable-panel.js +81 -33
  294. package/dist/ui/drawer.d.ts +7 -4
  295. package/dist/ui/drawer.js +35 -22
  296. package/dist/ui/dropdown-menu.js +4 -3
  297. package/dist/ui/dropzone.d.ts +5 -3
  298. package/dist/ui/dropzone.js +78 -17
  299. package/dist/ui/emoji-picker.d.ts +18 -0
  300. package/dist/ui/emoji-picker.js +136 -0
  301. package/dist/ui/empty.d.ts +3 -1
  302. package/dist/ui/empty.js +12 -7
  303. package/dist/ui/field.js +1 -1
  304. package/dist/ui/gradient-editor.d.ts +1 -1
  305. package/dist/ui/gradient-editor.js +37 -21
  306. package/dist/ui/infinite-canvas.d.ts +13 -1
  307. package/dist/ui/infinite-canvas.js +139 -20
  308. package/dist/ui/input-group.d.ts +2 -4
  309. package/dist/ui/input-group.js +13 -14
  310. package/dist/ui/input-otp.d.ts +1 -1
  311. package/dist/ui/input-otp.js +32 -15
  312. package/dist/ui/input.js +11 -2
  313. package/dist/ui/item.d.ts +2 -1
  314. package/dist/ui/item.js +11 -7
  315. package/dist/ui/live-status.d.ts +7 -0
  316. package/dist/ui/live-status.js +17 -0
  317. package/dist/ui/markdown-elements.d.ts +6 -0
  318. package/dist/ui/markdown-elements.js +42 -9
  319. package/dist/ui/menubar.js +2 -2
  320. package/dist/ui/morphing-panel.js +2 -1
  321. package/dist/ui/native-select.d.ts +1 -1
  322. package/dist/ui/native-select.js +24 -11
  323. package/dist/ui/number-field.d.ts +1 -1
  324. package/dist/ui/number-field.js +13 -2
  325. package/dist/ui/page-layout.d.ts +2 -2
  326. package/dist/ui/page-layout.js +2 -4
  327. package/dist/ui/pagination.d.ts +7 -5
  328. package/dist/ui/pagination.js +19 -13
  329. package/dist/ui/phone-input.d.ts +1 -0
  330. package/dist/ui/phone-input.js +56 -58
  331. package/dist/ui/radio-group.d.ts +3 -0
  332. package/dist/ui/radio-group.js +11 -1
  333. package/dist/ui/resizable.d.ts +20 -2
  334. package/dist/ui/resizable.js +130 -8
  335. package/dist/ui/responsive-dialog.d.ts +1 -1
  336. package/dist/ui/responsive-dialog.js +9 -23
  337. package/dist/ui/rich-tooltip.d.ts +10 -4
  338. package/dist/ui/rich-tooltip.js +81 -33
  339. package/dist/ui/scroll-area.d.ts +4 -1
  340. package/dist/ui/scroll-area.js +44 -28
  341. package/dist/ui/select.d.ts +2 -1
  342. package/dist/ui/select.js +57 -32
  343. package/dist/ui/sidebar-menu.d.ts +5 -1
  344. package/dist/ui/sidebar-menu.js +31 -33
  345. package/dist/ui/sidebar-provider.d.ts +10 -1
  346. package/dist/ui/sidebar-provider.js +38 -13
  347. package/dist/ui/sidebar-resize-rail.js +7 -3
  348. package/dist/ui/sidebar.d.ts +11 -6
  349. package/dist/ui/sidebar.js +46 -23
  350. package/dist/ui/slider.js +31 -22
  351. package/dist/ui/spinner.d.ts +3 -2
  352. package/dist/ui/spinner.js +3 -2
  353. package/dist/ui/stepper.d.ts +8 -1
  354. package/dist/ui/stepper.js +74 -25
  355. package/dist/ui/switch.d.ts +1 -0
  356. package/dist/ui/table-of-contents.d.ts +5 -4
  357. package/dist/ui/table-of-contents.js +143 -52
  358. package/dist/ui/table.js +15 -9
  359. package/dist/ui/textarea.d.ts +1 -1
  360. package/dist/ui/textarea.js +20 -9
  361. package/dist/ui/timeline.d.ts +3 -1
  362. package/dist/ui/timeline.js +17 -9
  363. package/dist/ui/toast.d.ts +11 -5
  364. package/dist/ui/toast.js +100 -54
  365. package/dist/ui/toggle.d.ts +1 -1
  366. package/dist/ui/toggle.js +2 -1
  367. package/dist/ui/toolbar.d.ts +3 -2
  368. package/dist/ui/toolbar.js +4 -2
  369. package/dist/ui/tooltip.js +3 -20
  370. package/dist/ui/tree.js +120 -80
  371. package/dist/ui/trigger-menu.js +7 -2
  372. package/dist/user-ask.d.ts +10 -5
  373. package/dist/user-ask.js +31 -11
  374. package/package.json +5 -1
  375. package/dist/hooks/use-keyboard-navigation.d.ts +0 -3
  376. package/dist/hooks/use-keyboard-navigation.js +0 -22
@@ -1,3 +1,4 @@
1
+ import { createNotificationCanvasLoop, createNotificationMotion } from "./dynamic-notification-canvas-loop.js";
1
2
  import { DYNAMIC_NOTIFICATION_SIRI_WAVE_GLSL } from "./dynamic-notification-siri-wave.js";
2
3
  //#region src/dynamic-notification-glass.ts
3
4
  const VERTEX_SHADER = `
@@ -141,15 +142,6 @@ function buildProgram(gl) {
141
142
  ribbonHorizon: gl.getUniformLocation(program, "u_ribbonHorizon")
142
143
  };
143
144
  }
144
- function auroraTarget(state) {
145
- return state === "thinking" ? 1 : 0;
146
- }
147
- function revealTarget(state) {
148
- return state === "collapsed" ? 0 : 1;
149
- }
150
- function settleTarget(state) {
151
- return state === "expanded" ? 1 : 0;
152
- }
153
145
  function createDynamicNotificationGlass(canvas, options = {}) {
154
146
  const { intensity = 1, maxDpr = 2 } = options;
155
147
  const gl = canvas.getContext("webgl", {
@@ -161,28 +153,9 @@ function createDynamicNotificationGlass(canvas, options = {}) {
161
153
  let contextLost = gl.isContextLost();
162
154
  let glass = contextLost ? null : buildProgram(gl);
163
155
  if (!contextLost && !glass) return () => {};
164
- let destroyed = false;
165
- let intersecting = true;
166
- let pageVisible = !document.hidden;
167
- let rafId = 0;
168
156
  let dpr = 1;
169
- let radius = 0;
170
- let aurora = auroraTarget(canvas.parentElement?.dataset.state);
171
- let lift = 1 - aurora;
172
- let reveal = revealTarget(canvas.parentElement?.dataset.state);
173
- let settle = settleTarget(canvas.parentElement?.dataset.state);
174
- let staticFrameDrawn = false;
157
+ const motion = createNotificationMotion(canvas.parentElement?.dataset.state);
175
158
  const startedAt = performance.now();
176
- const reducedMotionQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
177
- function reducedMotion() {
178
- return reducedMotionQuery.matches || canvas.closest("[data-motion=\"reduced\"]") !== null;
179
- }
180
- function targetRadius() {
181
- const host = canvas.parentElement;
182
- if (!host) return 0;
183
- const parsed = Number.parseFloat(getComputedStyle(host).borderTopLeftRadius);
184
- return Number.isFinite(parsed) ? parsed * dpr : 0;
185
- }
186
159
  function resize() {
187
160
  dpr = Math.min(window.devicePixelRatio || 1, maxDpr);
188
161
  const width = Math.max(1, Math.round(canvas.clientWidth * dpr));
@@ -192,111 +165,47 @@ function createDynamicNotificationGlass(canvas, options = {}) {
192
165
  canvas.height = height;
193
166
  }
194
167
  }
195
- function advanceMotion(reduced) {
196
- const target = targetRadius();
197
- radius = reduced ? target : radius + (target - radius) * .25;
198
- const auroraGoal = auroraTarget(canvas.parentElement?.dataset.state);
199
- aurora = reduced ? auroraGoal : aurora + (auroraGoal - aurora) * .06;
200
- const liftGoal = auroraGoal >= .5 ? 0 : 1;
201
- if (reduced) lift = liftGoal;
202
- else if (liftGoal === 1) lift = Math.min(1, lift + .036);
203
- else lift *= .72;
204
- const revealGoal = revealTarget(canvas.parentElement?.dataset.state);
205
- reveal = reduced ? revealGoal : reveal + (revealGoal - reveal) * .07;
206
- const settleGoal = settleTarget(canvas.parentElement?.dataset.state);
207
- settle = reduced ? settleGoal : settle + (settleGoal - settle) * .07;
208
- }
209
- function uploadUniforms(activeGl, activeGlass, reduced) {
210
- activeGl.uniform2f(activeGlass.resolution, canvas.width, canvas.height);
211
- activeGl.uniform1f(activeGlass.time, reduced ? 4.2 : (performance.now() - startedAt) / 1e3);
212
- activeGl.uniform1f(activeGlass.radius, radius);
213
- activeGl.uniform1f(activeGlass.intensity, intensity);
214
- activeGl.uniform1f(activeGlass.aurora, aurora);
215
- activeGl.uniform1f(activeGlass.reveal, reveal);
216
- activeGl.uniform1f(activeGlass.settle, settle);
217
- activeGl.uniform1f(activeGlass.lift, lift);
218
- activeGl.uniform1f(activeGlass.ribbonHorizon, .5);
219
- }
220
- function draw() {
221
- if (!gl || !glass || contextLost) return;
168
+ function render({ reduced, now, deltaMs }) {
169
+ const host = canvas.parentElement;
170
+ if (!gl || !glass || contextLost || !host) return false;
222
171
  resize();
172
+ const hostRadius = Number.parseFloat(getComputedStyle(host).borderTopLeftRadius);
173
+ const keepAnimating = motion.advance(host.dataset.state, Number.isFinite(hostRadius) ? hostRadius * dpr : 0, reduced, deltaMs);
174
+ const { radius, aurora, reveal, settle, lift } = motion.values;
223
175
  gl.viewport(0, 0, canvas.width, canvas.height);
224
176
  gl.clearColor(0, 0, 0, 0);
225
177
  gl.clear(gl.COLOR_BUFFER_BIT);
226
178
  gl.useProgram(glass.program);
227
- const reduced = reducedMotion();
228
- advanceMotion(reduced);
229
- uploadUniforms(gl, glass, reduced);
179
+ gl.uniform2f(glass.resolution, canvas.width, canvas.height);
180
+ gl.uniform1f(glass.time, reduced ? 4.2 : (now - startedAt) / 1e3);
181
+ gl.uniform1f(glass.radius, radius);
182
+ gl.uniform1f(glass.intensity, intensity);
183
+ gl.uniform1f(glass.aurora, aurora);
184
+ gl.uniform1f(glass.reveal, reveal);
185
+ gl.uniform1f(glass.settle, settle);
186
+ gl.uniform1f(glass.lift, lift);
187
+ gl.uniform1f(glass.ribbonHorizon, .5);
230
188
  gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
231
189
  if (canvas.dataset.glassReady !== "true") canvas.dataset.glassReady = "true";
190
+ return keepAnimating;
232
191
  }
233
- function visible() {
234
- return intersecting && pageVisible;
235
- }
236
- function tick() {
237
- rafId = 0;
238
- if (destroyed || !visible() || contextLost) return;
239
- draw();
240
- if (reducedMotion()) {
241
- staticFrameDrawn = true;
242
- return;
243
- }
244
- staticFrameDrawn = false;
245
- rafId = requestAnimationFrame(tick);
246
- }
247
- function invalidate() {
248
- staticFrameDrawn = false;
249
- if (destroyed || !visible() || contextLost || rafId !== 0) return;
250
- rafId = requestAnimationFrame(tick);
251
- }
252
- function handleVisibility() {
253
- pageVisible = !document.hidden;
254
- invalidate();
255
- }
192
+ const loop = createNotificationCanvasLoop(canvas, render);
256
193
  function handleContextLost(event) {
257
194
  event.preventDefault();
258
195
  contextLost = true;
259
- if (rafId !== 0) cancelAnimationFrame(rafId);
260
- rafId = 0;
196
+ loop.cancel();
261
197
  }
262
198
  function handleContextRestored() {
263
199
  if (!gl) return;
264
200
  contextLost = false;
265
201
  glass = buildProgram(gl);
266
- invalidate();
267
- }
268
- const resizeObserver = new ResizeObserver(() => {
269
- invalidate();
270
- });
271
- resizeObserver.observe(canvas);
272
- const intersectionObserver = new IntersectionObserver((entries) => {
273
- for (const entry of entries) intersecting = entry.isIntersecting;
274
- invalidate();
275
- }, { rootMargin: "64px" });
276
- intersectionObserver.observe(canvas);
277
- const motionObserver = new MutationObserver(() => {
278
- if (!staticFrameDrawn || !reducedMotion()) invalidate();
279
- });
280
- motionObserver.observe(document.documentElement, {
281
- attributes: true,
282
- attributeFilter: ["data-motion"]
283
- });
284
- function handleMotionPreference() {
285
- invalidate();
202
+ loop.invalidate();
286
203
  }
287
- document.addEventListener("visibilitychange", handleVisibility);
288
- reducedMotionQuery.addEventListener("change", handleMotionPreference);
289
204
  canvas.addEventListener("webglcontextlost", handleContextLost);
290
205
  canvas.addEventListener("webglcontextrestored", handleContextRestored);
291
- invalidate();
206
+ loop.invalidate();
292
207
  return () => {
293
- destroyed = true;
294
- if (rafId !== 0) cancelAnimationFrame(rafId);
295
- resizeObserver.disconnect();
296
- intersectionObserver.disconnect();
297
- motionObserver.disconnect();
298
- document.removeEventListener("visibilitychange", handleVisibility);
299
- reducedMotionQuery.removeEventListener("change", handleMotionPreference);
208
+ loop.destroy();
300
209
  canvas.removeEventListener("webglcontextlost", handleContextLost);
301
210
  canvas.removeEventListener("webglcontextrestored", handleContextRestored);
302
211
  delete canvas.dataset.glassReady;
@@ -1,3 +1,4 @@
1
+ import { createNotificationCanvasLoop, createNotificationMotion } from "./dynamic-notification-canvas-loop.js";
1
2
  import { DYNAMIC_NOTIFICATION_SIRI_WAVE_GLSL } from "./dynamic-notification-siri-wave.js";
2
3
  import { LIQUID_GLASS_OPTICS_GLSL } from "./lib/liquid-glass-optics.js";
3
4
  //#region src/dynamic-notification-liquid.ts
@@ -192,19 +193,6 @@ function buildProgram(gl) {
192
193
  ribbonHorizon: gl.getUniformLocation(program, "u_ribbonHorizon")
193
194
  };
194
195
  }
195
- function auroraTarget(state) {
196
- return state === "thinking" ? 1 : 0;
197
- }
198
- function revealTarget(state) {
199
- return state === "collapsed" ? 0 : 1;
200
- }
201
- function settleTarget(state) {
202
- return state === "expanded" ? 1 : 0;
203
- }
204
- function approachAt60Hz(current, target, response, deltaMs) {
205
- const frameScale = Math.max(0, deltaMs) / (1e3 / 60);
206
- return current + (target - current) * (1 - (1 - response) ** frameScale);
207
- }
208
196
  const EXCLUDE_SELECTOR = "[data-control-ui=\"dynamic-notification\"]";
209
197
  function cssImageUrls(value) {
210
198
  return Array.from(value.matchAll(/url\((["']?)(.*?)\1\)/g), (match) => match[2]?.trim()).filter((url) => Boolean(url && !url.startsWith("data:") && !url.startsWith("#")));
@@ -434,31 +422,13 @@ function createDynamicNotificationLiquid(canvas, options = {}) {
434
422
  };
435
423
  }
436
424
  let destroyed = false;
437
- let intersecting = true;
438
- let pageVisible = !document.hidden;
439
- let rafId = 0;
440
425
  let dpr = 1;
441
- let radius = 0;
442
- const initialState = canvas.parentElement?.dataset.state;
443
- let aurora = auroraTarget(initialState);
444
- let reveal = revealTarget(initialState);
445
- let settle = settleTarget(initialState);
446
- let lift = 1 - aurora;
447
- let staticFrameDrawn = false;
426
+ const motion = createNotificationMotion(canvas.parentElement?.dataset.state);
448
427
  let captured = null;
449
428
  let textureFresh = false;
450
429
  let captureToken = 0;
451
430
  let captureTimer = 0;
452
431
  const startedAt = performance.now();
453
- let previousFrameAt = startedAt;
454
- const reducedMotionQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
455
- function reducedMotion() {
456
- return reducedMotionQuery.matches || canvas.closest("[data-motion=\"reduced\"]") !== null;
457
- }
458
- function targetRadius(host) {
459
- const parsed = Number.parseFloat(getComputedStyle(host).borderTopLeftRadius);
460
- return Number.isFinite(parsed) ? parsed : 0;
461
- }
462
432
  function resize() {
463
433
  dpr = Math.min(window.devicePixelRatio || 1, maxDpr);
464
434
  const width = Math.max(1, Math.round(canvas.clientWidth * dpr));
@@ -494,36 +464,14 @@ function createDynamicNotificationLiquid(canvas, options = {}) {
494
464
  captured = result;
495
465
  delete canvas.dataset.glassFailed;
496
466
  uploadTexture();
497
- invalidate();
467
+ loop.invalidate();
498
468
  });
499
469
  }
500
470
  function scheduleRecapture() {
501
471
  window.clearTimeout(captureTimer);
502
472
  captureTimer = window.setTimeout(recapture, 200);
503
473
  }
504
- function advanceMotion(host, reduced, deltaMs) {
505
- const state = host.dataset.state;
506
- const targetAurora = auroraTarget(state);
507
- const targets = {
508
- radius: targetRadius(host),
509
- aurora: targetAurora,
510
- reveal: revealTarget(state),
511
- settle: settleTarget(state),
512
- lift: targetAurora >= .5 ? 0 : 1
513
- };
514
- radius = reduced ? targets.radius : approachAt60Hz(radius, targets.radius, .25, deltaMs);
515
- aurora = reduced ? targets.aurora : approachAt60Hz(aurora, targets.aurora, .06, deltaMs);
516
- reveal = reduced ? targets.reveal : approachAt60Hz(reveal, targets.reveal, .07, deltaMs);
517
- settle = reduced ? targets.settle : approachAt60Hz(settle, targets.settle, .07, deltaMs);
518
- if (reduced) lift = targets.lift;
519
- else if (targets.lift === 1) lift = Math.min(1, lift + deltaMs * .00216);
520
- else lift = approachAt60Hz(lift, 0, .28, deltaMs);
521
- return targets;
522
- }
523
- function shouldAnimate(host, reduced, targets) {
524
- return !reduced && (host.dataset.state === "thinking" || Math.abs(radius - targets.radius) > .05 || Math.abs(aurora - targets.aurora) > .002 || Math.abs(reveal - targets.reveal) > .002 || Math.abs(settle - targets.settle) > .002 || Math.abs(lift - targets.lift) > .002);
525
- }
526
- function draw() {
474
+ function render({ reduced, now, deltaMs }) {
527
475
  if (!gl || !liquid || contextLost || !textureFresh) return false;
528
476
  const host = canvas.parentElement;
529
477
  if (!host) return false;
@@ -531,15 +479,13 @@ function createDynamicNotificationLiquid(canvas, options = {}) {
531
479
  const hostRect = host.getBoundingClientRect();
532
480
  const sceneRect = scene.getBoundingClientRect();
533
481
  if (sceneRect.width < 1 || sceneRect.height < 1) return false;
482
+ const hostRadius = Number.parseFloat(getComputedStyle(host).borderTopLeftRadius);
483
+ const keepAnimating = motion.advance(host.dataset.state, Number.isFinite(hostRadius) ? hostRadius : 0, reduced, deltaMs);
484
+ const { radius, aurora, reveal, settle, lift } = motion.values;
534
485
  gl.viewport(0, 0, canvas.width, canvas.height);
535
486
  gl.clearColor(0, 0, 0, 0);
536
487
  gl.clear(gl.COLOR_BUFFER_BIT);
537
488
  gl.useProgram(liquid.program);
538
- const reduced = reducedMotion();
539
- const now = performance.now();
540
- const deltaMs = Math.min(100, now - previousFrameAt);
541
- previousFrameAt = now;
542
- const targets = advanceMotion(host, reduced, deltaMs);
543
489
  gl.activeTexture(gl.TEXTURE0);
544
490
  gl.bindTexture(gl.TEXTURE_2D, liquid.sharpTexture);
545
491
  gl.activeTexture(gl.TEXTURE1);
@@ -566,38 +512,16 @@ function createDynamicNotificationLiquid(canvas, options = {}) {
566
512
  gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
567
513
  delete canvas.dataset.glassFailed;
568
514
  if (canvas.dataset.glassReady !== "true") canvas.dataset.glassReady = "true";
569
- return shouldAnimate(host, reduced, targets);
570
- }
571
- function visible() {
572
- return intersecting && pageVisible;
573
- }
574
- function tick() {
575
- rafId = 0;
576
- if (destroyed || !visible() || contextLost) return;
577
- if (!draw()) {
578
- staticFrameDrawn = true;
579
- return;
580
- }
581
- staticFrameDrawn = false;
582
- rafId = requestAnimationFrame(tick);
583
- }
584
- function invalidate() {
585
- staticFrameDrawn = false;
586
- if (destroyed || !visible() || contextLost || rafId !== 0) return;
587
- rafId = requestAnimationFrame(tick);
588
- }
589
- function handleVisibility() {
590
- pageVisible = !document.hidden;
591
- invalidate();
515
+ return keepAnimating;
592
516
  }
517
+ const loop = createNotificationCanvasLoop(canvas, render);
593
518
  function handleContextLost(event) {
594
519
  event.preventDefault();
595
520
  contextLost = true;
596
521
  textureFresh = false;
597
522
  delete canvas.dataset.glassReady;
598
523
  canvas.dataset.glassFailed = "context";
599
- if (rafId !== 0) cancelAnimationFrame(rafId);
600
- rafId = 0;
524
+ loop.cancel();
601
525
  }
602
526
  function handleContextRestored() {
603
527
  if (!gl) return;
@@ -608,15 +532,9 @@ function createDynamicNotificationLiquid(canvas, options = {}) {
608
532
  return;
609
533
  }
610
534
  uploadTexture();
611
- invalidate();
535
+ loop.invalidate();
612
536
  }
613
- const resizeObserver = new ResizeObserver(() => {
614
- invalidate();
615
- });
616
- resizeObserver.observe(canvas);
617
- const sceneResizeObserver = new ResizeObserver(() => {
618
- scheduleRecapture();
619
- });
537
+ const sceneResizeObserver = new ResizeObserver(scheduleRecapture);
620
538
  sceneResizeObserver.observe(scene);
621
539
  const sceneMutationObserver = new MutationObserver((mutations) => {
622
540
  for (const mutation of mutations) {
@@ -632,38 +550,16 @@ function createDynamicNotificationLiquid(canvas, options = {}) {
632
550
  childList: true,
633
551
  subtree: true
634
552
  });
635
- const intersectionObserver = new IntersectionObserver((entries) => {
636
- for (const entry of entries) intersecting = entry.isIntersecting;
637
- invalidate();
638
- }, { rootMargin: "64px" });
639
- intersectionObserver.observe(canvas);
640
- const motionObserver = new MutationObserver(() => {
641
- if (!staticFrameDrawn || !reducedMotion()) invalidate();
642
- });
643
- motionObserver.observe(document.documentElement, {
644
- attributes: true,
645
- attributeFilter: ["data-motion"]
646
- });
647
- function handleMotionPreference() {
648
- invalidate();
649
- }
650
- document.addEventListener("visibilitychange", handleVisibility);
651
- reducedMotionQuery.addEventListener("change", handleMotionPreference);
652
553
  canvas.addEventListener("webglcontextlost", handleContextLost);
653
554
  canvas.addEventListener("webglcontextrestored", handleContextRestored);
654
555
  recapture();
655
- invalidate();
556
+ loop.invalidate();
656
557
  return () => {
657
558
  destroyed = true;
658
- if (rafId !== 0) cancelAnimationFrame(rafId);
559
+ loop.destroy();
659
560
  window.clearTimeout(captureTimer);
660
- resizeObserver.disconnect();
661
561
  sceneResizeObserver.disconnect();
662
562
  sceneMutationObserver.disconnect();
663
- intersectionObserver.disconnect();
664
- motionObserver.disconnect();
665
- document.removeEventListener("visibilitychange", handleVisibility);
666
- reducedMotionQuery.removeEventListener("change", handleMotionPreference);
667
563
  canvas.removeEventListener("webglcontextlost", handleContextLost);
668
564
  canvas.removeEventListener("webglcontextrestored", handleContextRestored);
669
565
  delete canvas.dataset.glassReady;
@@ -2,25 +2,31 @@ import { FormSubmitEvent, OpenChangeReason } from "./control-props.js";
2
2
  import { Button } from "./ui/button.js";
3
3
  import { DynamicNotificationKnobStyle } from "./knob-contracts/dynamic-notification-knobs.js";
4
4
  import { DynamicNotificationProps, DynamicNotificationVariant } from "./hooks/use-dynamic-notification.js";
5
- import { CSSProperties, ComponentProps } from "react";
5
+ import { CSSProperties, ComponentProps, RefObject } from "react";
6
6
  //#region src/dynamic-notification.d.ts
7
7
  export type DynamicNotificationState = "collapsed" | "thinking" | "expanded";
8
8
  export declare function useDynamicNotificationContext(): {
9
9
  open: boolean;
10
10
  disabled: boolean;
11
- setOpen: (nextOpen: boolean, reason: OpenChangeReason, event: Event, trigger?: Element) => void;
11
+ setOpen: (nextOpen: boolean, reason: OpenChangeReason, event: Event, trigger?: Element) => boolean;
12
12
  reply: string;
13
13
  setReply: (nextValue: string) => void;
14
14
  normalizedReply: string;
15
15
  canSubmit: boolean;
16
+ replyPending: boolean;
17
+ replyFailed: boolean;
16
18
  clear: () => void;
17
- submitReply: () => void;
19
+ submitReply: () => Promise<void>;
18
20
  handleReplySubmit: (event: FormSubmitEvent) => void;
19
21
  state: DynamicNotificationState;
20
22
  variant: DynamicNotificationVariant;
21
23
  contentId: string;
24
+ publishMessage: (text: string) => void;
25
+ pillRef: RefObject<HTMLButtonElement | null>;
26
+ focusReplyOnExpandRef: RefObject<boolean>;
27
+ replyErrorLabel: string;
22
28
  };
23
- export declare function DynamicNotification({ open, defaultOpen, onOpenChange, loading, replyValue, defaultReplyValue, onReplyValueChange, onReply, variant, disabled, className, children, ...props }: DynamicNotificationProps): import("react").JSX.Element;
29
+ export declare function DynamicNotification({ open, defaultOpen, onOpenChange, loading, replyValue, defaultReplyValue, onReplyValueChange, onReply, variant, disabled, thinkingLabel, replyErrorLabel, className, children, ...props }: DynamicNotificationProps): import("react").JSX.Element;
24
30
  export type DynamicNotificationIslandProps = ComponentProps<"section"> & {
25
31
  style?: CSSProperties & DynamicNotificationKnobStyle;
26
32
  };
@@ -38,7 +44,7 @@ export declare function DynamicNotificationLiquid({ className, ...props }: Dynam
38
44
  export type DynamicNotificationPillProps = ComponentProps<"button"> & {
39
45
  style?: CSSProperties & DynamicNotificationKnobStyle;
40
46
  };
41
- export declare function DynamicNotificationPill({ className, children, onClick, ...props }: DynamicNotificationPillProps): import("react").JSX.Element;
47
+ export declare function DynamicNotificationPill({ className, children, onClick, ref, ...props }: DynamicNotificationPillProps): import("react").JSX.Element;
42
48
  export type DynamicNotificationIndicatorProps = ComponentProps<"span"> & {
43
49
  style?: CSSProperties & DynamicNotificationKnobStyle;
44
50
  };
@@ -61,13 +67,15 @@ export declare function DynamicNotificationMessage({ className, children, ...pro
61
67
  export type DynamicNotificationReplyProps = ComponentProps<"form"> & {
62
68
  style?: CSSProperties & DynamicNotificationKnobStyle;
63
69
  };
64
- export declare function DynamicNotificationReply({ className, onSubmit, ...props }: DynamicNotificationReplyProps): import("react").JSX.Element;
70
+ export declare function DynamicNotificationReply({ className, onSubmit, children, ...props }: DynamicNotificationReplyProps): import("react").JSX.Element;
65
71
  export type DynamicNotificationReplyInputProps = ComponentProps<"input"> & {
66
72
  style?: CSSProperties & DynamicNotificationKnobStyle;
67
73
  };
68
74
  export declare function DynamicNotificationReplyInput({ className, onChange, disabled, ...props }: DynamicNotificationReplyInputProps): import("react").JSX.Element;
69
75
  export type DynamicNotificationReplySubmitProps = ComponentProps<typeof Button>;
70
76
  export declare function DynamicNotificationReplySubmit({ className, disabled, children, ...props }: DynamicNotificationReplySubmitProps): import("react").JSX.Element;
71
- export type DynamicNotificationCloseProps = ComponentProps<typeof Button>;
72
- export declare function DynamicNotificationClose({ className, children, onClick, ...props }: DynamicNotificationCloseProps): import("react").JSX.Element;
77
+ export type DynamicNotificationCloseProps = ComponentProps<typeof Button> & {
78
+ collapseLabel?: string;
79
+ };
80
+ export declare function DynamicNotificationClose({ className, children, onClick, collapseLabel, ...props }: DynamicNotificationCloseProps): import("react").JSX.Element;
73
81
  //#endregion