@ctrl-ui/react 0.8.0

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 (500) hide show
  1. package/README.md +70 -0
  2. package/dist/action-bar.d.ts +44 -0
  3. package/dist/action-bar.js +89 -0
  4. package/dist/activity.d.ts +53 -0
  5. package/dist/activity.js +188 -0
  6. package/dist/audio-recorder.d.ts +32 -0
  7. package/dist/audio-recorder.js +235 -0
  8. package/dist/audio-visualizer.d.ts +12 -0
  9. package/dist/audio-visualizer.js +58 -0
  10. package/dist/blocks/chat.d.ts +10 -0
  11. package/dist/blocks/chat.js +12 -0
  12. package/dist/blocks/coding-agent.d.ts +61 -0
  13. package/dist/blocks/coding-agent.js +255 -0
  14. package/dist/blocks/file-explorer-data.d.ts +57 -0
  15. package/dist/blocks/file-explorer-data.js +74 -0
  16. package/dist/blocks/file-explorer.d.ts +24 -0
  17. package/dist/blocks/file-explorer.js +427 -0
  18. package/dist/blocks/settings-data.d.ts +36 -0
  19. package/dist/blocks/settings-data.js +66 -0
  20. package/dist/blocks/settings.d.ts +19 -0
  21. package/dist/blocks/settings.js +282 -0
  22. package/dist/blocks/theme-toggle.d.ts +43 -0
  23. package/dist/blocks/theme-toggle.js +180 -0
  24. package/dist/chat-composer-attachment.d.ts +55 -0
  25. package/dist/chat-composer-attachment.js +267 -0
  26. package/dist/chat-composer-editor/extensions/mention.d.ts +14 -0
  27. package/dist/chat-composer-editor/extensions/mention.js +278 -0
  28. package/dist/chat-composer-editor/ghost.d.ts +5 -0
  29. package/dist/chat-composer-editor/ghost.js +55 -0
  30. package/dist/chat-composer-editor/schema.d.ts +6 -0
  31. package/dist/chat-composer-editor/schema.js +25 -0
  32. package/dist/chat-composer-editor/serialize.d.ts +6 -0
  33. package/dist/chat-composer-editor/serialize.js +16 -0
  34. package/dist/chat-composer-editor/types.d.ts +29 -0
  35. package/dist/chat-composer-editor/types.js +0 -0
  36. package/dist/chat-composer-editor.d.ts +9 -0
  37. package/dist/chat-composer-editor.js +154 -0
  38. package/dist/chat-composer.d.ts +60 -0
  39. package/dist/chat-composer.js +134 -0
  40. package/dist/chat-layout.d.ts +27 -0
  41. package/dist/chat-layout.js +114 -0
  42. package/dist/chat-message.d.ts +31 -0
  43. package/dist/chat-message.js +95 -0
  44. package/dist/code-block-editor.d.ts +59 -0
  45. package/dist/code-block-editor.js +250 -0
  46. package/dist/context-model.d.ts +33 -0
  47. package/dist/context-model.js +52 -0
  48. package/dist/context.d.ts +47 -0
  49. package/dist/context.js +335 -0
  50. package/dist/control-props.d.ts +28 -0
  51. package/dist/control-props.js +4 -0
  52. package/dist/control-variants.d.ts +8 -0
  53. package/dist/control-variants.js +14 -0
  54. package/dist/dynamic-notification-glass.d.ts +10 -0
  55. package/dist/dynamic-notification-glass.js +311 -0
  56. package/dist/dynamic-notification-liquid.d.ts +24 -0
  57. package/dist/dynamic-notification-liquid.js +682 -0
  58. package/dist/dynamic-notification-siri-wave.d.ts +4 -0
  59. package/dist/dynamic-notification-siri-wave.js +82 -0
  60. package/dist/dynamic-notification.d.ts +74 -0
  61. package/dist/dynamic-notification.js +342 -0
  62. package/dist/environment-variables.d.ts +124 -0
  63. package/dist/environment-variables.js +492 -0
  64. package/dist/extensions/create-track-highlight.d.ts +12 -0
  65. package/dist/extensions/create-track-highlight.js +147 -0
  66. package/dist/extensions/track-highlight.d.ts +22 -0
  67. package/dist/extensions/track-highlight.js +52 -0
  68. package/dist/hooks/use-audio-recorder.d.ts +107 -0
  69. package/dist/hooks/use-audio-recorder.js +577 -0
  70. package/dist/hooks/use-chat-composer.d.ts +56 -0
  71. package/dist/hooks/use-chat-composer.js +63 -0
  72. package/dist/hooks/use-chat-message.d.ts +28 -0
  73. package/dist/hooks/use-chat-message.js +24 -0
  74. package/dist/hooks/use-color-area.d.ts +18 -0
  75. package/dist/hooks/use-color-area.js +60 -0
  76. package/dist/hooks/use-copy-to-clipboard.d.ts +22 -0
  77. package/dist/hooks/use-copy-to-clipboard.js +90 -0
  78. package/dist/hooks/use-dropzone.d.ts +59 -0
  79. package/dist/hooks/use-dropzone.js +372 -0
  80. package/dist/hooks/use-dynamic-notification.d.ts +37 -0
  81. package/dist/hooks/use-dynamic-notification.js +87 -0
  82. package/dist/hooks/use-environment-variables.d.ts +51 -0
  83. package/dist/hooks/use-environment-variables.js +188 -0
  84. package/dist/hooks/use-mobile.d.ts +5 -0
  85. package/dist/hooks/use-mobile.js +29 -0
  86. package/dist/hooks/use-textarea-trigger-menu.d.ts +8 -0
  87. package/dist/hooks/use-textarea-trigger-menu.js +69 -0
  88. package/dist/hooks/use-trigger-menu.d.ts +49 -0
  89. package/dist/hooks/use-trigger-menu.js +102 -0
  90. package/dist/hooks/use-user-ask.d.ts +48 -0
  91. package/dist/hooks/use-user-ask.js +167 -0
  92. package/dist/inline-attachment.d.ts +37 -0
  93. package/dist/inline-attachment.js +192 -0
  94. package/dist/inline-citation.d.ts +56 -0
  95. package/dist/inline-citation.js +319 -0
  96. package/dist/knob-contracts/accordion-knobs.d.ts +5 -0
  97. package/dist/knob-contracts/accordion-knobs.js +9 -0
  98. package/dist/knob-contracts/action-bar-knobs.d.ts +5 -0
  99. package/dist/knob-contracts/action-bar-knobs.js +4 -0
  100. package/dist/knob-contracts/activity-knobs.d.ts +5 -0
  101. package/dist/knob-contracts/activity-knobs.js +9 -0
  102. package/dist/knob-contracts/alert-knobs.d.ts +5 -0
  103. package/dist/knob-contracts/alert-knobs.js +9 -0
  104. package/dist/knob-contracts/audio-recorder-knobs.d.ts +5 -0
  105. package/dist/knob-contracts/audio-recorder-knobs.js +9 -0
  106. package/dist/knob-contracts/audio-visualizer-knobs.d.ts +5 -0
  107. package/dist/knob-contracts/audio-visualizer-knobs.js +9 -0
  108. package/dist/knob-contracts/avatar-knobs.d.ts +5 -0
  109. package/dist/knob-contracts/avatar-knobs.js +9 -0
  110. package/dist/knob-contracts/badge-knobs.d.ts +5 -0
  111. package/dist/knob-contracts/badge-knobs.js +9 -0
  112. package/dist/knob-contracts/button-group-knobs.d.ts +5 -0
  113. package/dist/knob-contracts/button-group-knobs.js +9 -0
  114. package/dist/knob-contracts/button-knobs.d.ts +5 -0
  115. package/dist/knob-contracts/button-knobs.js +25 -0
  116. package/dist/knob-contracts/calendar-knobs.d.ts +5 -0
  117. package/dist/knob-contracts/calendar-knobs.js +10 -0
  118. package/dist/knob-contracts/card-knobs.d.ts +5 -0
  119. package/dist/knob-contracts/card-knobs.js +11 -0
  120. package/dist/knob-contracts/chat-composer-attachment-knobs.d.ts +5 -0
  121. package/dist/knob-contracts/chat-composer-attachment-knobs.js +11 -0
  122. package/dist/knob-contracts/chat-composer-knobs.d.ts +5 -0
  123. package/dist/knob-contracts/chat-composer-knobs.js +18 -0
  124. package/dist/knob-contracts/chat-layout-knobs.d.ts +5 -0
  125. package/dist/knob-contracts/chat-layout-knobs.js +11 -0
  126. package/dist/knob-contracts/chat-message-knobs.d.ts +5 -0
  127. package/dist/knob-contracts/chat-message-knobs.js +17 -0
  128. package/dist/knob-contracts/choice-knobs.d.ts +5 -0
  129. package/dist/knob-contracts/choice-knobs.js +9 -0
  130. package/dist/knob-contracts/code-block-editor-knobs.d.ts +5 -0
  131. package/dist/knob-contracts/code-block-editor-knobs.js +11 -0
  132. package/dist/knob-contracts/code-diff-knobs.d.ts +5 -0
  133. package/dist/knob-contracts/code-diff-knobs.js +18 -0
  134. package/dist/knob-contracts/code-knobs.d.ts +5 -0
  135. package/dist/knob-contracts/code-knobs.js +11 -0
  136. package/dist/knob-contracts/collapsible-knobs.d.ts +5 -0
  137. package/dist/knob-contracts/collapsible-knobs.js +4 -0
  138. package/dist/knob-contracts/color-picker-knobs.d.ts +5 -0
  139. package/dist/knob-contracts/color-picker-knobs.js +12 -0
  140. package/dist/knob-contracts/context-knobs.d.ts +5 -0
  141. package/dist/knob-contracts/context-knobs.js +13 -0
  142. package/dist/knob-contracts/dockable-panel-knobs.d.ts +5 -0
  143. package/dist/knob-contracts/dockable-panel-knobs.js +12 -0
  144. package/dist/knob-contracts/dropzone-knobs.d.ts +5 -0
  145. package/dist/knob-contracts/dropzone-knobs.js +11 -0
  146. package/dist/knob-contracts/dynamic-notification-knobs.d.ts +5 -0
  147. package/dist/knob-contracts/dynamic-notification-knobs.js +18 -0
  148. package/dist/knob-contracts/empty-knobs.d.ts +5 -0
  149. package/dist/knob-contracts/empty-knobs.js +12 -0
  150. package/dist/knob-contracts/environment-variables-knobs.d.ts +5 -0
  151. package/dist/knob-contracts/environment-variables-knobs.js +11 -0
  152. package/dist/knob-contracts/field-knobs.d.ts +5 -0
  153. package/dist/knob-contracts/field-knobs.js +16 -0
  154. package/dist/knob-contracts/gradient-editor-knobs.d.ts +5 -0
  155. package/dist/knob-contracts/gradient-editor-knobs.js +13 -0
  156. package/dist/knob-contracts/infinite-canvas-knobs.d.ts +5 -0
  157. package/dist/knob-contracts/infinite-canvas-knobs.js +13 -0
  158. package/dist/knob-contracts/inline-attachment-knobs.d.ts +5 -0
  159. package/dist/knob-contracts/inline-attachment-knobs.js +14 -0
  160. package/dist/knob-contracts/inline-citation-knobs.d.ts +5 -0
  161. package/dist/knob-contracts/inline-citation-knobs.js +14 -0
  162. package/dist/knob-contracts/item-knobs.d.ts +5 -0
  163. package/dist/knob-contracts/item-knobs.js +10 -0
  164. package/dist/knob-contracts/kbd-knobs.d.ts +5 -0
  165. package/dist/knob-contracts/kbd-knobs.js +10 -0
  166. package/dist/knob-contracts/markdown-block-knobs.d.ts +5 -0
  167. package/dist/knob-contracts/markdown-block-knobs.js +11 -0
  168. package/dist/knob-contracts/markdown-knobs.d.ts +5 -0
  169. package/dist/knob-contracts/markdown-knobs.js +14 -0
  170. package/dist/knob-contracts/morphing-panel-knobs.d.ts +5 -0
  171. package/dist/knob-contracts/morphing-panel-knobs.js +11 -0
  172. package/dist/knob-contracts/pagination-knobs.d.ts +5 -0
  173. package/dist/knob-contracts/pagination-knobs.js +10 -0
  174. package/dist/knob-contracts/phone-input-knobs.d.ts +5 -0
  175. package/dist/knob-contracts/phone-input-knobs.js +10 -0
  176. package/dist/knob-contracts/popup-knobs.d.ts +5 -0
  177. package/dist/knob-contracts/popup-knobs.js +21 -0
  178. package/dist/knob-contracts/range-knobs.d.ts +5 -0
  179. package/dist/knob-contracts/range-knobs.js +13 -0
  180. package/dist/knob-contracts/resizable-knobs.d.ts +5 -0
  181. package/dist/knob-contracts/resizable-knobs.js +14 -0
  182. package/dist/knob-contracts/rich-tooltip-knobs.d.ts +5 -0
  183. package/dist/knob-contracts/rich-tooltip-knobs.js +13 -0
  184. package/dist/knob-contracts/scroll-area-knobs.d.ts +5 -0
  185. package/dist/knob-contracts/scroll-area-knobs.js +8 -0
  186. package/dist/knob-contracts/separator-knobs.d.ts +5 -0
  187. package/dist/knob-contracts/separator-knobs.js +4 -0
  188. package/dist/knob-contracts/sidebar-knobs.d.ts +5 -0
  189. package/dist/knob-contracts/sidebar-knobs.js +26 -0
  190. package/dist/knob-contracts/skeleton-knobs.d.ts +5 -0
  191. package/dist/knob-contracts/skeleton-knobs.js +4 -0
  192. package/dist/knob-contracts/source-badge-knobs.d.ts +5 -0
  193. package/dist/knob-contracts/source-badge-knobs.js +11 -0
  194. package/dist/knob-contracts/spinner-knobs.d.ts +5 -0
  195. package/dist/knob-contracts/spinner-knobs.js +4 -0
  196. package/dist/knob-contracts/stepper-knobs.d.ts +5 -0
  197. package/dist/knob-contracts/stepper-knobs.js +11 -0
  198. package/dist/knob-contracts/switch-knobs.d.ts +5 -0
  199. package/dist/knob-contracts/switch-knobs.js +12 -0
  200. package/dist/knob-contracts/table-knobs.d.ts +5 -0
  201. package/dist/knob-contracts/table-knobs.js +12 -0
  202. package/dist/knob-contracts/table-of-contents-knobs.d.ts +5 -0
  203. package/dist/knob-contracts/table-of-contents-knobs.js +8 -0
  204. package/dist/knob-contracts/tabs-knobs.d.ts +5 -0
  205. package/dist/knob-contracts/tabs-knobs.js +16 -0
  206. package/dist/knob-contracts/task-list-knobs.d.ts +5 -0
  207. package/dist/knob-contracts/task-list-knobs.js +14 -0
  208. package/dist/knob-contracts/thread-rail-knobs.d.ts +5 -0
  209. package/dist/knob-contracts/thread-rail-knobs.js +14 -0
  210. package/dist/knob-contracts/timeline-knobs.d.ts +5 -0
  211. package/dist/knob-contracts/timeline-knobs.js +12 -0
  212. package/dist/knob-contracts/toolbar-knobs.d.ts +5 -0
  213. package/dist/knob-contracts/toolbar-knobs.js +20 -0
  214. package/dist/knob-contracts/track-highlight-knobs.d.ts +5 -0
  215. package/dist/knob-contracts/track-highlight-knobs.js +11 -0
  216. package/dist/knob-contracts/transcript-divider-knobs.d.ts +5 -0
  217. package/dist/knob-contracts/transcript-divider-knobs.js +10 -0
  218. package/dist/knob-contracts/tree-knobs.d.ts +5 -0
  219. package/dist/knob-contracts/tree-knobs.js +13 -0
  220. package/dist/knob-contracts/user-ask-knobs.d.ts +5 -0
  221. package/dist/knob-contracts/user-ask-knobs.js +17 -0
  222. package/dist/lib/cn.d.ts +5 -0
  223. package/dist/lib/cn.js +34 -0
  224. package/dist/lib/code-block-shiki.d.ts +9 -0
  225. package/dist/lib/code-block-shiki.js +6 -0
  226. package/dist/lib/code-tokens.d.ts +28 -0
  227. package/dist/lib/code-tokens.js +160 -0
  228. package/dist/lib/color.d.ts +72 -0
  229. package/dist/lib/color.js +490 -0
  230. package/dist/lib/contrast.d.ts +30 -0
  231. package/dist/lib/contrast.js +64 -0
  232. package/dist/lib/diff.d.ts +50 -0
  233. package/dist/lib/diff.js +315 -0
  234. package/dist/lib/dropzone-validation.d.ts +66 -0
  235. package/dist/lib/dropzone-validation.js +228 -0
  236. package/dist/lib/env-file.d.ts +28 -0
  237. package/dist/lib/env-file.js +218 -0
  238. package/dist/lib/format-audio-recorder-duration.d.ts +4 -0
  239. package/dist/lib/format-audio-recorder-duration.js +7 -0
  240. package/dist/lib/liquid-glass-optics.d.ts +4 -0
  241. package/dist/lib/liquid-glass-optics.js +96 -0
  242. package/dist/lib/phone-input-format.d.ts +6 -0
  243. package/dist/lib/phone-input-format.js +26 -0
  244. package/dist/lib/phone-number.d.ts +18 -0
  245. package/dist/lib/phone-number.js +28 -0
  246. package/dist/lib/trigger-detect.d.ts +15 -0
  247. package/dist/lib/trigger-detect.js +77 -0
  248. package/dist/markdown-block.d.ts +25 -0
  249. package/dist/markdown-block.js +77 -0
  250. package/dist/skin.config.d.ts +5 -0
  251. package/dist/skin.config.js +4 -0
  252. package/dist/skin.d.ts +69 -0
  253. package/dist/skin.js +62 -0
  254. package/dist/source-badge.d.ts +23 -0
  255. package/dist/source-badge.js +72 -0
  256. package/dist/styles/chat-composer-editor.css +44 -0
  257. package/dist/styles/code.css +57 -0
  258. package/dist/styles/effects.css +126 -0
  259. package/dist/styles/index.css +81 -0
  260. package/dist/styles/recipes/accordion.css +87 -0
  261. package/dist/styles/recipes/action-bar.css +19 -0
  262. package/dist/styles/recipes/activity.css +129 -0
  263. package/dist/styles/recipes/alert.css +75 -0
  264. package/dist/styles/recipes/audio-recorder.css +102 -0
  265. package/dist/styles/recipes/audio-visualizer.css +90 -0
  266. package/dist/styles/recipes/avatar.css +52 -0
  267. package/dist/styles/recipes/badge.css +110 -0
  268. package/dist/styles/recipes/button-group.css +64 -0
  269. package/dist/styles/recipes/button.css +305 -0
  270. package/dist/styles/recipes/calendar.css +152 -0
  271. package/dist/styles/recipes/card.css +93 -0
  272. package/dist/styles/recipes/chat-composer-attachment.css +177 -0
  273. package/dist/styles/recipes/chat-composer.css +195 -0
  274. package/dist/styles/recipes/chat-layout.css +108 -0
  275. package/dist/styles/recipes/chat-message.css +160 -0
  276. package/dist/styles/recipes/choice.css +108 -0
  277. package/dist/styles/recipes/code-block-editor.css +136 -0
  278. package/dist/styles/recipes/code-diff.css +256 -0
  279. package/dist/styles/recipes/code.css +136 -0
  280. package/dist/styles/recipes/collapsible.css +27 -0
  281. package/dist/styles/recipes/color-picker-details.css +61 -0
  282. package/dist/styles/recipes/color-picker-values.css +117 -0
  283. package/dist/styles/recipes/color-picker.css +158 -0
  284. package/dist/styles/recipes/context.css +237 -0
  285. package/dist/styles/recipes/dockable-panel.css +106 -0
  286. package/dist/styles/recipes/dropzone.css +149 -0
  287. package/dist/styles/recipes/dynamic-notification-input.css +29 -0
  288. package/dist/styles/recipes/dynamic-notification-motion.css +298 -0
  289. package/dist/styles/recipes/dynamic-notification.css +241 -0
  290. package/dist/styles/recipes/empty.css +96 -0
  291. package/dist/styles/recipes/environment-variables.css +173 -0
  292. package/dist/styles/recipes/field-parts.css +148 -0
  293. package/dist/styles/recipes/field.css +234 -0
  294. package/dist/styles/recipes/gradient-editor.css +109 -0
  295. package/dist/styles/recipes/infinite-canvas.css +78 -0
  296. package/dist/styles/recipes/inline-attachment.css +182 -0
  297. package/dist/styles/recipes/inline-citation.css +174 -0
  298. package/dist/styles/recipes/item.css +107 -0
  299. package/dist/styles/recipes/kbd.css +55 -0
  300. package/dist/styles/recipes/markdown-block.css +75 -0
  301. package/dist/styles/recipes/markdown.css +204 -0
  302. package/dist/styles/recipes/morphing-panel.css +123 -0
  303. package/dist/styles/recipes/pagination.css +86 -0
  304. package/dist/styles/recipes/phone-input.css +105 -0
  305. package/dist/styles/recipes/popup-controls.css +59 -0
  306. package/dist/styles/recipes/popup-drawer.css +162 -0
  307. package/dist/styles/recipes/popup-lists.css +198 -0
  308. package/dist/styles/recipes/popup-motion.css +94 -0
  309. package/dist/styles/recipes/popup-toast.css +126 -0
  310. package/dist/styles/recipes/popup.css +396 -0
  311. package/dist/styles/recipes/range.css +259 -0
  312. package/dist/styles/recipes/resizable.css +170 -0
  313. package/dist/styles/recipes/rich-tooltip.css +272 -0
  314. package/dist/styles/recipes/scroll-area.css +59 -0
  315. package/dist/styles/recipes/separator.css +12 -0
  316. package/dist/styles/recipes/sidebar.css +345 -0
  317. package/dist/styles/recipes/skeleton.css +23 -0
  318. package/dist/styles/recipes/source-badge.css +77 -0
  319. package/dist/styles/recipes/spinner.css +33 -0
  320. package/dist/styles/recipes/stepper.css +178 -0
  321. package/dist/styles/recipes/switch.css +149 -0
  322. package/dist/styles/recipes/table-of-contents.css +107 -0
  323. package/dist/styles/recipes/table.css +124 -0
  324. package/dist/styles/recipes/tabs.css +235 -0
  325. package/dist/styles/recipes/task-list.css +146 -0
  326. package/dist/styles/recipes/thread-rail.css +247 -0
  327. package/dist/styles/recipes/timeline.css +107 -0
  328. package/dist/styles/recipes/toolbar.css +260 -0
  329. package/dist/styles/recipes/track-highlight.css +73 -0
  330. package/dist/styles/recipes/transcript-divider.css +64 -0
  331. package/dist/styles/recipes/tree.css +137 -0
  332. package/dist/styles/recipes/user-ask-details.css +45 -0
  333. package/dist/styles/recipes/user-ask.css +204 -0
  334. package/dist/styles/skin-theme.css +137 -0
  335. package/dist/styles/skin.css +143 -0
  336. package/dist/styles/theme.css +628 -0
  337. package/dist/styles/type-scale.css +45 -0
  338. package/dist/surface-variants.d.ts +6 -0
  339. package/dist/surface-variants.js +16 -0
  340. package/dist/task-list.d.ts +34 -0
  341. package/dist/task-list.js +177 -0
  342. package/dist/thread-rail.d.ts +52 -0
  343. package/dist/thread-rail.js +190 -0
  344. package/dist/transcript-divider.d.ts +15 -0
  345. package/dist/transcript-divider.js +25 -0
  346. package/dist/ui/accordion.d.ts +31 -0
  347. package/dist/ui/accordion.js +60 -0
  348. package/dist/ui/alert-dialog.d.ts +36 -0
  349. package/dist/ui/alert-dialog.js +100 -0
  350. package/dist/ui/alert.d.ts +21 -0
  351. package/dist/ui/alert.js +36 -0
  352. package/dist/ui/aspect-ratio.d.ts +8 -0
  353. package/dist/ui/aspect-ratio.js +17 -0
  354. package/dist/ui/autocomplete.d.ts +70 -0
  355. package/dist/ui/autocomplete.js +150 -0
  356. package/dist/ui/avatar.d.ts +24 -0
  357. package/dist/ui/avatar.js +44 -0
  358. package/dist/ui/badge.d.ts +20 -0
  359. package/dist/ui/badge.js +36 -0
  360. package/dist/ui/button-group.d.ts +24 -0
  361. package/dist/ui/button-group.js +45 -0
  362. package/dist/ui/button.d.ts +36 -0
  363. package/dist/ui/button.js +104 -0
  364. package/dist/ui/calendar.d.ts +11 -0
  365. package/dist/ui/calendar.js +160 -0
  366. package/dist/ui/card.d.ts +36 -0
  367. package/dist/ui/card.js +70 -0
  368. package/dist/ui/checkbox-group.d.ts +11 -0
  369. package/dist/ui/checkbox-group.js +16 -0
  370. package/dist/ui/checkbox.d.ts +23 -0
  371. package/dist/ui/checkbox.js +58 -0
  372. package/dist/ui/code-diff.d.ts +28 -0
  373. package/dist/ui/code-diff.js +561 -0
  374. package/dist/ui/code.d.ts +62 -0
  375. package/dist/ui/code.js +292 -0
  376. package/dist/ui/collapsible.d.ts +31 -0
  377. package/dist/ui/collapsible.js +72 -0
  378. package/dist/ui/color-picker.d.ts +137 -0
  379. package/dist/ui/color-picker.js +797 -0
  380. package/dist/ui/combobox-disabled-selection.d.ts +5 -0
  381. package/dist/ui/combobox-disabled-selection.js +11 -0
  382. package/dist/ui/combobox.d.ts +70 -0
  383. package/dist/ui/combobox.js +194 -0
  384. package/dist/ui/command.d.ts +44 -0
  385. package/dist/ui/command.js +166 -0
  386. package/dist/ui/context-menu.d.ts +86 -0
  387. package/dist/ui/context-menu.js +202 -0
  388. package/dist/ui/dialog.d.ts +38 -0
  389. package/dist/ui/dialog.js +124 -0
  390. package/dist/ui/dockable-panel-geometry.d.ts +18 -0
  391. package/dist/ui/dockable-panel-geometry.js +17 -0
  392. package/dist/ui/dockable-panel.d.ts +58 -0
  393. package/dist/ui/dockable-panel.js +366 -0
  394. package/dist/ui/drawer.d.ts +42 -0
  395. package/dist/ui/drawer.js +182 -0
  396. package/dist/ui/dropdown-menu.d.ts +46 -0
  397. package/dist/ui/dropdown-menu.js +89 -0
  398. package/dist/ui/dropzone.d.ts +66 -0
  399. package/dist/ui/dropzone.js +311 -0
  400. package/dist/ui/empty.d.ts +28 -0
  401. package/dist/ui/empty.js +59 -0
  402. package/dist/ui/field.d.ts +64 -0
  403. package/dist/ui/field.js +166 -0
  404. package/dist/ui/form.d.ts +10 -0
  405. package/dist/ui/form.js +17 -0
  406. package/dist/ui/gradient-editor.d.ts +47 -0
  407. package/dist/ui/gradient-editor.js +301 -0
  408. package/dist/ui/hover-card.d.ts +25 -0
  409. package/dist/ui/hover-card.js +46 -0
  410. package/dist/ui/infinite-canvas.d.ts +40 -0
  411. package/dist/ui/infinite-canvas.js +278 -0
  412. package/dist/ui/input-group.d.ts +21 -0
  413. package/dist/ui/input-group.js +44 -0
  414. package/dist/ui/input-otp.d.ts +38 -0
  415. package/dist/ui/input-otp.js +45 -0
  416. package/dist/ui/input.d.ts +12 -0
  417. package/dist/ui/input.js +18 -0
  418. package/dist/ui/item.d.ts +46 -0
  419. package/dist/ui/item.js +110 -0
  420. package/dist/ui/kbd.d.ts +12 -0
  421. package/dist/ui/kbd.js +23 -0
  422. package/dist/ui/markdown-elements.d.ts +52 -0
  423. package/dist/ui/markdown-elements.js +211 -0
  424. package/dist/ui/markdown.d.ts +14 -0
  425. package/dist/ui/markdown.js +31 -0
  426. package/dist/ui/menubar.d.ts +74 -0
  427. package/dist/ui/menubar.js +162 -0
  428. package/dist/ui/meter.d.ts +34 -0
  429. package/dist/ui/meter.js +57 -0
  430. package/dist/ui/morphing-panel.d.ts +24 -0
  431. package/dist/ui/morphing-panel.js +87 -0
  432. package/dist/ui/native-select.d.ts +12 -0
  433. package/dist/ui/native-select.js +41 -0
  434. package/dist/ui/navigation-menu.d.ts +51 -0
  435. package/dist/ui/navigation-menu.js +135 -0
  436. package/dist/ui/number-field.d.ts +72 -0
  437. package/dist/ui/number-field.js +124 -0
  438. package/dist/ui/pagination.d.ts +26 -0
  439. package/dist/ui/pagination.js +77 -0
  440. package/dist/ui/phone-input.d.ts +30 -0
  441. package/dist/ui/phone-input.js +263 -0
  442. package/dist/ui/popover.d.ts +34 -0
  443. package/dist/ui/popover.js +87 -0
  444. package/dist/ui/progress.d.ts +34 -0
  445. package/dist/ui/progress.js +57 -0
  446. package/dist/ui/radio-group.d.ts +29 -0
  447. package/dist/ui/radio-group.js +37 -0
  448. package/dist/ui/resizable.d.ts +56 -0
  449. package/dist/ui/resizable.js +82 -0
  450. package/dist/ui/responsive-dialog.d.ts +18 -0
  451. package/dist/ui/responsive-dialog.js +121 -0
  452. package/dist/ui/rich-tooltip-tour.d.ts +12 -0
  453. package/dist/ui/rich-tooltip-tour.js +20 -0
  454. package/dist/ui/rich-tooltip.d.ts +83 -0
  455. package/dist/ui/rich-tooltip.js +331 -0
  456. package/dist/ui/scroll-area.d.ts +25 -0
  457. package/dist/ui/scroll-area.js +93 -0
  458. package/dist/ui/select.d.ts +44 -0
  459. package/dist/ui/select.js +124 -0
  460. package/dist/ui/separator.d.ts +9 -0
  461. package/dist/ui/separator.js +16 -0
  462. package/dist/ui/sheet.d.ts +25 -0
  463. package/dist/ui/sheet.js +76 -0
  464. package/dist/ui/sidebar.d.ts +88 -0
  465. package/dist/ui/sidebar.js +362 -0
  466. package/dist/ui/skeleton.d.ts +8 -0
  467. package/dist/ui/skeleton.js +13 -0
  468. package/dist/ui/slider.d.ts +24 -0
  469. package/dist/ui/slider.js +114 -0
  470. package/dist/ui/spinner.d.ts +12 -0
  471. package/dist/ui/spinner.js +26 -0
  472. package/dist/ui/stepper.d.ts +58 -0
  473. package/dist/ui/stepper.js +232 -0
  474. package/dist/ui/switch.d.ts +26 -0
  475. package/dist/ui/switch.js +71 -0
  476. package/dist/ui/table-of-contents.d.ts +22 -0
  477. package/dist/ui/table-of-contents.js +181 -0
  478. package/dist/ui/table.d.ts +37 -0
  479. package/dist/ui/table.js +83 -0
  480. package/dist/ui/tabs.d.ts +36 -0
  481. package/dist/ui/tabs.js +127 -0
  482. package/dist/ui/textarea.d.ts +9 -0
  483. package/dist/ui/textarea.js +16 -0
  484. package/dist/ui/timeline.d.ts +40 -0
  485. package/dist/ui/timeline.js +80 -0
  486. package/dist/ui/toast.d.ts +28 -0
  487. package/dist/ui/toast.js +132 -0
  488. package/dist/ui/toggle.d.ts +20 -0
  489. package/dist/ui/toggle.js +71 -0
  490. package/dist/ui/toolbar.d.ts +40 -0
  491. package/dist/ui/toolbar.js +72 -0
  492. package/dist/ui/tooltip.d.ts +27 -0
  493. package/dist/ui/tooltip.js +93 -0
  494. package/dist/ui/tree.d.ts +56 -0
  495. package/dist/ui/tree.js +438 -0
  496. package/dist/ui/trigger-menu.d.ts +46 -0
  497. package/dist/ui/trigger-menu.js +116 -0
  498. package/dist/user-ask.d.ts +50 -0
  499. package/dist/user-ask.js +398 -0
  500. package/package.json +115 -0
@@ -0,0 +1,682 @@
1
+ import { DYNAMIC_NOTIFICATION_SIRI_WAVE_GLSL } from "./dynamic-notification-siri-wave.js";
2
+ import { LIQUID_GLASS_OPTICS_GLSL } from "./lib/liquid-glass-optics.js";
3
+ //#region src/dynamic-notification-liquid.ts
4
+ const VERTEX_SHADER = `
5
+ attribute vec2 a_position;
6
+ varying vec2 v_uv;
7
+ void main() {
8
+ /* v_uv is y-DOWN (v=0 = top) to match the 2D-canvas texture orientation */
9
+ v_uv = vec2(a_position.x * 0.5 + 0.5, 0.5 - a_position.y * 0.5);
10
+ gl_Position = vec4(a_position, 0.0, 1.0);
11
+ }
12
+ `;
13
+ const FRAGMENT_SHADER = `
14
+ precision highp float;
15
+
16
+ uniform sampler2D u_sharpTex;
17
+ uniform sampler2D u_blurTex;
18
+ uniform vec2 u_size; /* panel size, css px */
19
+ uniform vec2 u_panelOffset; /* panel top-left inside the scene, css px */
20
+ uniform vec2 u_sceneSize; /* scene size, css px */
21
+ uniform float u_radius; /* corner radius, css px */
22
+ uniform float u_zRadius; /* inner refraction band cap, css px */
23
+ uniform float u_refract;
24
+ uniform float u_chroma;
25
+ uniform float u_edgeDarkening;
26
+ uniform float u_spec;
27
+ uniform float u_fresnel;
28
+ uniform float u_edgeHL;
29
+ uniform float u_time;
30
+ uniform float u_aurora;
31
+ uniform float u_reveal;
32
+ uniform float u_settle;
33
+ uniform float u_lift;
34
+ uniform float u_ribbonHorizon;
35
+
36
+ varying vec2 v_uv;
37
+
38
+ ${LIQUID_GLASS_OPTICS_GLSL}
39
+ ${DYNAMIC_NOTIFICATION_SIRI_WAVE_GLSL}
40
+
41
+ vec2 sceneUV(vec2 posCss) {
42
+ return clamp(posCss / u_sceneSize, 0.0, 1.0);
43
+ }
44
+
45
+ void main() {
46
+ vec2 local = (v_uv - 0.5) * u_size;
47
+ vec2 half_ = u_size * 0.5;
48
+ float r = min(u_radius, min(half_.x, half_.y));
49
+ float sdf = liquidSurfaceSDF(local, half_, r, 2.0);
50
+
51
+ /* mask clips only shape; resting Clear material has no separate shadow stage. */
52
+ float mask = 1.0 - smoothstep(-1.5, 0.5, sdf);
53
+ if (mask <= 0.0) {
54
+ gl_FragColor = vec4(0.0);
55
+ return;
56
+ }
57
+
58
+ float materialScale = smoothstep(40.0, 120.0, u_size.y);
59
+ float edgeWidth = liquidEdgeWidth(u_size, 0.36, u_zRadius);
60
+ float opticalInside = liquidOpticalInsideDistance(local, half_, r, 2.0);
61
+ float lens = liquidEdgeLens(opticalInside, edgeWidth);
62
+ vec2 boundaryNormal = liquidInwardOpticalNormal(local, half_, r, 2.0);
63
+
64
+ vec2 refrPx = liquidRefractedOffset(boundaryNormal, opticalInside, edgeWidth, u_refract);
65
+ vec3 N = liquidLensSurfaceNormal(boundaryNormal, opticalInside, edgeWidth);
66
+ vec2 keyDirection = normalize(vec2(0.707106, -0.707106));
67
+ float outerRim = 1.0 - smoothstep(0.35, 1.35, opticalInside);
68
+ float innerRim = exp(-pow((opticalInside - 2.0) / 0.9, 2.0));
69
+
70
+ float caS = u_chroma * 10.0 * lens;
71
+ vec2 caD = N.xy * caS;
72
+ vec2 base = u_panelOffset + v_uv * u_size + refrPx;
73
+
74
+ vec3 sharp = vec3(
75
+ texture2D(u_sharpTex, sceneUV(base + caD)).r,
76
+ texture2D(u_sharpTex, sceneUV(base)).g,
77
+ texture2D(u_sharpTex, sceneUV(base - caD)).b
78
+ );
79
+ vec3 blur = vec3(
80
+ texture2D(u_blurTex, sceneUV(base + caD)).r,
81
+ texture2D(u_blurTex, sceneUV(base)).g,
82
+ texture2D(u_blurTex, sceneUV(base - caD)).b
83
+ );
84
+ float diffusion = mix(0.08, 0.14, materialScale) * mix(0.25, 1.0, lens);
85
+ vec3 col = mix(sharp, blur, diffusion);
86
+
87
+ /* Map transmitted luminance to measured Clear-material endpoints while preserving hue. */
88
+ float transmittedLuma = dot(col, vec3(0.2126, 0.7152, 0.0722));
89
+ float environmentLuma = dot(blur, vec3(0.2126, 0.7152, 0.0722));
90
+ float lightEnvironment = smoothstep(0.38, 0.72, environmentLuma);
91
+ float blackEndpoint = mix(0.05, 0.20, lightEnvironment);
92
+ float whiteEndpoint = mix(0.80, 0.95, lightEnvironment);
93
+ float mappedLuma = mix(blackEndpoint, whiteEndpoint, transmittedLuma);
94
+ col = clamp(col + vec3(mappedLuma - transmittedLuma), 0.0, 1.0);
95
+
96
+ /* Ink and ribbon share refracted coordinate so their horizon stays joined at edges. */
97
+ vec2 auroraUv = clamp(v_uv + N.xy * lens * 0.012, vec2(0.0), vec2(1.0));
98
+ float yUp = 1.0 - auroraUv.y;
99
+ float inkThinking = mix(0.10, 0.985, smoothstep(u_ribbonHorizon - 0.10, u_ribbonHorizon + 0.10, yUp));
100
+ float inkExpanded = mix(0.24, 0.97, smoothstep(0.00, 0.30, yUp));
101
+ float ink = mix(0.985, mix(inkThinking, inkExpanded, u_settle), u_reveal);
102
+ vec3 materialColor = mix(col, vec3(0.004, 0.004, 0.006), ink);
103
+
104
+ float keyArc = pow(max(dot(boundaryNormal, keyDirection), 0.0), 6.0);
105
+ float fillArc = pow(max(dot(boundaryNormal, -keyDirection), 0.0), 8.0) * 0.28;
106
+ float shadowArc = pow(max(dot(boundaryNormal, -keyDirection), 0.0), 6.0);
107
+ materialColor *= 1.0 - innerRim * shadowArc * u_edgeDarkening;
108
+ float highlight = outerRim * u_edgeHL * 0.22 + innerRim * (keyArc * u_spec + fillArc * u_spec * 1.3);
109
+ float grazing = outerRim * u_fresnel * 0.025;
110
+ vec3 rimLight = mix(vec3(1.0), blur, 0.12);
111
+
112
+ vec3 auroraEmission = dynamicNotificationSiriWave(vec2(auroraUv.x, yUp), u_size, u_time, u_ribbonHorizon, u_lift)
113
+ * u_aurora * (1.0 - u_lift);
114
+
115
+ vec3 material = materialColor + rimLight * highlight + vec3(grazing) + auroraEmission;
116
+ gl_FragColor = vec4(material * mask, mask);
117
+ }
118
+ `;
119
+ function compileShader(gl, type, source) {
120
+ const shader = gl.createShader(type);
121
+ if (!shader) return null;
122
+ gl.shaderSource(shader, source);
123
+ gl.compileShader(shader);
124
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
125
+ gl.deleteShader(shader);
126
+ return null;
127
+ }
128
+ return shader;
129
+ }
130
+ function createSceneTexture(gl) {
131
+ const texture = gl.createTexture();
132
+ if (!texture) return null;
133
+ gl.bindTexture(gl.TEXTURE_2D, texture);
134
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
135
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
136
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
137
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
138
+ return texture;
139
+ }
140
+ function buildProgram(gl) {
141
+ const vertex = compileShader(gl, gl.VERTEX_SHADER, VERTEX_SHADER);
142
+ const fragment = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);
143
+ if (!vertex || !fragment) return null;
144
+ const program = gl.createProgram();
145
+ const buffer = gl.createBuffer();
146
+ const sharpTexture = createSceneTexture(gl);
147
+ const blurTexture = createSceneTexture(gl);
148
+ if (!program || !buffer || !sharpTexture || !blurTexture) return null;
149
+ gl.attachShader(program, vertex);
150
+ gl.attachShader(program, fragment);
151
+ gl.linkProgram(program);
152
+ gl.deleteShader(vertex);
153
+ gl.deleteShader(fragment);
154
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) return null;
155
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
156
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
157
+ -1,
158
+ -1,
159
+ 1,
160
+ -1,
161
+ -1,
162
+ 1,
163
+ 1,
164
+ 1
165
+ ]), gl.STATIC_DRAW);
166
+ const position = gl.getAttribLocation(program, "a_position");
167
+ gl.enableVertexAttribArray(position);
168
+ gl.vertexAttribPointer(position, 2, gl.FLOAT, false, 0, 0);
169
+ return {
170
+ program,
171
+ buffer,
172
+ sharpTexture,
173
+ blurTexture,
174
+ sharpTex: gl.getUniformLocation(program, "u_sharpTex"),
175
+ blurTex: gl.getUniformLocation(program, "u_blurTex"),
176
+ size: gl.getUniformLocation(program, "u_size"),
177
+ panelOffset: gl.getUniformLocation(program, "u_panelOffset"),
178
+ sceneSize: gl.getUniformLocation(program, "u_sceneSize"),
179
+ radius: gl.getUniformLocation(program, "u_radius"),
180
+ zRadius: gl.getUniformLocation(program, "u_zRadius"),
181
+ refract: gl.getUniformLocation(program, "u_refract"),
182
+ chroma: gl.getUniformLocation(program, "u_chroma"),
183
+ edgeDarkening: gl.getUniformLocation(program, "u_edgeDarkening"),
184
+ spec: gl.getUniformLocation(program, "u_spec"),
185
+ fresnel: gl.getUniformLocation(program, "u_fresnel"),
186
+ edgeHL: gl.getUniformLocation(program, "u_edgeHL"),
187
+ time: gl.getUniformLocation(program, "u_time"),
188
+ aurora: gl.getUniformLocation(program, "u_aurora"),
189
+ reveal: gl.getUniformLocation(program, "u_reveal"),
190
+ settle: gl.getUniformLocation(program, "u_settle"),
191
+ lift: gl.getUniformLocation(program, "u_lift"),
192
+ ribbonHorizon: gl.getUniformLocation(program, "u_ribbonHorizon")
193
+ };
194
+ }
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
+ const EXCLUDE_SELECTOR = "[data-control-ui=\"dynamic-notification\"]";
209
+ function cssImageUrls(value) {
210
+ return Array.from(value.matchAll(/url\((["']?)(.*?)\1\)/g), (match) => match[2]?.trim()).filter((url) => Boolean(url && !url.startsWith("data:") && !url.startsWith("#")));
211
+ }
212
+ function sceneImageUrls(scene) {
213
+ const urls = /* @__PURE__ */ new Set();
214
+ for (const element of [scene, ...scene.querySelectorAll("*")]) {
215
+ if (element.closest(EXCLUDE_SELECTOR)) continue;
216
+ if (element instanceof HTMLImageElement && element.currentSrc && !element.currentSrc.startsWith("data:")) urls.add(element.currentSrc);
217
+ const computed = getComputedStyle(element);
218
+ for (let index = 0; index < computed.length; index += 1) for (const url of cssImageUrls(computed.getPropertyValue(computed.item(index)))) urls.add(url);
219
+ }
220
+ return urls;
221
+ }
222
+ function blobDataUrl(blob) {
223
+ return new Promise((resolve) => {
224
+ const reader = new FileReader();
225
+ reader.addEventListener("load", () => resolve(typeof reader.result === "string" ? reader.result : null), { once: true });
226
+ reader.addEventListener("error", () => resolve(null), { once: true });
227
+ reader.readAsDataURL(blob);
228
+ });
229
+ }
230
+ async function fetchImageDataUrl(url) {
231
+ try {
232
+ const resolved = new URL(url, document.baseURI);
233
+ const sameOrigin = resolved.origin === window.location.origin;
234
+ const response = await fetch(resolved, {
235
+ cache: "force-cache",
236
+ credentials: sameOrigin ? "same-origin" : "omit",
237
+ mode: sameOrigin ? "same-origin" : "cors"
238
+ });
239
+ if (!response.ok) return null;
240
+ return blobDataUrl(await response.blob());
241
+ } catch {
242
+ return null;
243
+ }
244
+ }
245
+ async function embedSceneImages(scene) {
246
+ const urls = [...sceneImageUrls(scene)];
247
+ const dataUrls = await Promise.all(urls.map(fetchImageDataUrl));
248
+ const images = /* @__PURE__ */ new Map();
249
+ for (let index = 0; index < urls.length; index += 1) {
250
+ const url = urls[index];
251
+ const dataUrl = dataUrls[index];
252
+ if (!url || !dataUrl) return null;
253
+ images.set(url, dataUrl);
254
+ }
255
+ return images;
256
+ }
257
+ function embedCssImages(value, images) {
258
+ return value.replace(/url\((["']?)(.*?)\1\)/g, (match, _quote, url) => {
259
+ const embedded = images.get(url.trim());
260
+ return embedded ? `url("${embedded}")` : match;
261
+ });
262
+ }
263
+ function cloneCanvas(source) {
264
+ try {
265
+ const snapshot = document.createElement("img");
266
+ snapshot.src = source.toDataURL();
267
+ snapshot.setAttribute("style", getComputedStyle(source).cssText);
268
+ return snapshot;
269
+ } catch {
270
+ return null;
271
+ }
272
+ }
273
+ function computedStyleText(source, images) {
274
+ const computed = getComputedStyle(source);
275
+ const parts = [];
276
+ for (let index = 0; index < computed.length; index += 1) {
277
+ const property = computed.item(index);
278
+ parts.push(`${property}: ${embedCssImages(computed.getPropertyValue(property), images)};`);
279
+ }
280
+ return parts.join(" ");
281
+ }
282
+ function appendClonedChildren(source, target, images) {
283
+ for (const child of source.childNodes) if (child instanceof Element) {
284
+ const cloned = cloneTree(child, images);
285
+ if (cloned) target.appendChild(cloned);
286
+ } else if (child.nodeType === Node.TEXT_NODE) target.appendChild(child.cloneNode(false));
287
+ }
288
+ function cloneTree(source, images) {
289
+ if (source.matches(EXCLUDE_SELECTOR)) return null;
290
+ if (source instanceof HTMLCanvasElement) return cloneCanvas(source);
291
+ const node = source.cloneNode(false);
292
+ if (!(node instanceof Element)) return null;
293
+ node.setAttribute("style", computedStyleText(source, images));
294
+ if (source instanceof HTMLImageElement && node instanceof HTMLImageElement) {
295
+ const embedded = images.get(source.currentSrc);
296
+ if (embedded) node.src = embedded;
297
+ node.removeAttribute("srcset");
298
+ node.removeAttribute("sizes");
299
+ }
300
+ if (source instanceof HTMLSourceElement && source.parentElement instanceof HTMLPictureElement) {
301
+ node.removeAttribute("srcset");
302
+ node.removeAttribute("sizes");
303
+ }
304
+ appendClonedChildren(source, node, images);
305
+ return node;
306
+ }
307
+ function scaleCanvas(source, width, height) {
308
+ const step = document.createElement("canvas");
309
+ step.width = width;
310
+ step.height = height;
311
+ const context = step.getContext("2d");
312
+ if (!context) return null;
313
+ context.imageSmoothingEnabled = true;
314
+ context.imageSmoothingQuality = "high";
315
+ context.drawImage(source, 0, 0, width, height);
316
+ return step;
317
+ }
318
+ function sceneCaptureDimensions(scene, scale) {
319
+ const rect = scene.getBoundingClientRect();
320
+ const width = Math.max(1, Math.round(rect.width));
321
+ const height = Math.max(1, Math.round(rect.height));
322
+ return {
323
+ width,
324
+ height,
325
+ rasterWidth: Math.max(1, Math.round(width * scale)),
326
+ rasterHeight: Math.max(1, Math.round(height * scale))
327
+ };
328
+ }
329
+ function prepareSceneClone(scene, dimensions, images) {
330
+ const clone = cloneTree(scene, images);
331
+ if (!(clone instanceof HTMLElement)) return null;
332
+ clone.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
333
+ clone.style.width = `${dimensions.width}px`;
334
+ clone.style.height = `${dimensions.height}px`;
335
+ clone.style.margin = "0";
336
+ clone.style.boxSizing = "border-box";
337
+ return clone;
338
+ }
339
+ async function decodeSceneImage(clone, dimensions) {
340
+ const markup = new XMLSerializer().serializeToString(clone);
341
+ const { width, height, rasterWidth, rasterHeight } = dimensions;
342
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${rasterWidth}" height="${rasterHeight}" viewBox="0 0 ${width} ${height}"><foreignObject width="${width}" height="${height}">${markup}</foreignObject></svg>`;
343
+ const image = new Image();
344
+ image.decoding = "async";
345
+ image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
346
+ try {
347
+ await image.decode();
348
+ return image;
349
+ } catch {
350
+ return null;
351
+ }
352
+ }
353
+ function drawSharpScene(image, dimensions) {
354
+ const sharp = document.createElement("canvas");
355
+ sharp.width = dimensions.rasterWidth;
356
+ sharp.height = dimensions.rasterHeight;
357
+ const context = sharp.getContext("2d");
358
+ if (!context) return null;
359
+ context.drawImage(image, 0, 0, sharp.width, sharp.height);
360
+ return sharp;
361
+ }
362
+ function downsampleForFrost(sharp, frost) {
363
+ const targetWidth = Math.max(1, Math.round(sharp.width / frost));
364
+ const targetHeight = Math.max(1, Math.round(sharp.height / frost));
365
+ let small = sharp;
366
+ let stepWidth = sharp.width;
367
+ let stepHeight = sharp.height;
368
+ while (small && stepWidth * .5 >= targetWidth) {
369
+ stepWidth = Math.max(targetWidth, Math.round(stepWidth * .5));
370
+ stepHeight = Math.max(targetHeight, Math.round(stepHeight * .5));
371
+ small = scaleCanvas(small, stepWidth, stepHeight);
372
+ }
373
+ if (small && (small.width !== targetWidth || small.height !== targetHeight)) small = scaleCanvas(small, targetWidth, targetHeight);
374
+ if (!small) return null;
375
+ const bounced = scaleCanvas(small, Math.max(1, Math.round(targetWidth / 2)), Math.max(1, Math.round(targetHeight / 2)));
376
+ return bounced ? scaleCanvas(bounced, targetWidth, targetHeight) ?? small : small;
377
+ }
378
+ function drawFrostedScene(sharp, frost) {
379
+ const frosted = document.createElement("canvas");
380
+ frosted.width = sharp.width;
381
+ frosted.height = sharp.height;
382
+ const context = frosted.getContext("2d");
383
+ if (!context) return null;
384
+ if (frost <= 1) {
385
+ context.drawImage(sharp, 0, 0);
386
+ return frosted;
387
+ }
388
+ const smoothed = downsampleForFrost(sharp, frost);
389
+ if (smoothed) {
390
+ context.imageSmoothingEnabled = true;
391
+ context.imageSmoothingQuality = "high";
392
+ context.drawImage(smoothed, 0, 0, frosted.width, frosted.height);
393
+ } else context.drawImage(sharp, 0, 0);
394
+ return frosted;
395
+ }
396
+ async function captureScene(scene, scale, frost) {
397
+ const images = await embedSceneImages(scene);
398
+ if (!images) return null;
399
+ const dimensions = sceneCaptureDimensions(scene, scale);
400
+ const clone = prepareSceneClone(scene, dimensions, images);
401
+ if (!clone) return null;
402
+ const image = await decodeSceneImage(clone, dimensions);
403
+ if (!image) return null;
404
+ const sharp = drawSharpScene(image, dimensions);
405
+ if (!sharp) return null;
406
+ const frosted = drawFrostedScene(sharp, frost);
407
+ if (!frosted) return null;
408
+ return {
409
+ sharp,
410
+ frosted
411
+ };
412
+ }
413
+ function createDynamicNotificationLiquid(canvas, options = {}) {
414
+ const { refraction = .85, chromaticAberration = 0, zRadius = 32, edgeDarkening = .05, specular = .11, fresnel = .35, edgeHighlight = .16, frost = 4, maxDpr = 2 } = options;
415
+ const gl = canvas.getContext("webgl", {
416
+ alpha: true,
417
+ premultipliedAlpha: true,
418
+ antialias: true
419
+ });
420
+ if (!gl) {
421
+ canvas.dataset.glassFailed = "webgl";
422
+ return () => {
423
+ delete canvas.dataset.glassFailed;
424
+ };
425
+ }
426
+ const closestScene = canvas.closest("[data-dn-scene]");
427
+ const scene = closestScene instanceof HTMLElement ? closestScene : document.body;
428
+ let contextLost = gl.isContextLost();
429
+ let liquid = contextLost ? null : buildProgram(gl);
430
+ if (!contextLost && !liquid) {
431
+ canvas.dataset.glassFailed = "shader";
432
+ return () => {
433
+ delete canvas.dataset.glassFailed;
434
+ };
435
+ }
436
+ let destroyed = false;
437
+ let intersecting = true;
438
+ let pageVisible = !document.hidden;
439
+ let rafId = 0;
440
+ 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;
448
+ let captured = null;
449
+ let textureFresh = false;
450
+ let captureToken = 0;
451
+ let captureTimer = 0;
452
+ 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
+ function resize() {
463
+ dpr = Math.min(window.devicePixelRatio || 1, maxDpr);
464
+ const width = Math.max(1, Math.round(canvas.clientWidth * dpr));
465
+ const height = Math.max(1, Math.round(canvas.clientHeight * dpr));
466
+ if (canvas.width !== width || canvas.height !== height) {
467
+ canvas.width = width;
468
+ canvas.height = height;
469
+ }
470
+ }
471
+ function uploadTexture() {
472
+ if (!gl || !liquid || contextLost || !captured) return;
473
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
474
+ gl.bindTexture(gl.TEXTURE_2D, liquid.sharpTexture);
475
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, captured.sharp);
476
+ gl.bindTexture(gl.TEXTURE_2D, liquid.blurTexture);
477
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, captured.frosted);
478
+ textureFresh = true;
479
+ }
480
+ function recapture() {
481
+ captureToken += 1;
482
+ const token = captureToken;
483
+ const rect = scene.getBoundingClientRect();
484
+ const supersample = Math.min((window.devicePixelRatio || 1) * 1.5, 3, 4096 / Math.max(rect.width, rect.height, 1));
485
+ captureScene(scene, Math.max(1, supersample), frost).then((result) => {
486
+ if (destroyed || token !== captureToken) return;
487
+ if (!result) {
488
+ captured = null;
489
+ textureFresh = false;
490
+ delete canvas.dataset.glassReady;
491
+ canvas.dataset.glassFailed = "capture";
492
+ return;
493
+ }
494
+ captured = result;
495
+ delete canvas.dataset.glassFailed;
496
+ uploadTexture();
497
+ invalidate();
498
+ });
499
+ }
500
+ function scheduleRecapture() {
501
+ window.clearTimeout(captureTimer);
502
+ captureTimer = window.setTimeout(recapture, 200);
503
+ }
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() {
527
+ if (!gl || !liquid || contextLost || !textureFresh) return false;
528
+ const host = canvas.parentElement;
529
+ if (!host) return false;
530
+ resize();
531
+ const hostRect = host.getBoundingClientRect();
532
+ const sceneRect = scene.getBoundingClientRect();
533
+ if (sceneRect.width < 1 || sceneRect.height < 1) return false;
534
+ gl.viewport(0, 0, canvas.width, canvas.height);
535
+ gl.clearColor(0, 0, 0, 0);
536
+ gl.clear(gl.COLOR_BUFFER_BIT);
537
+ 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
+ gl.activeTexture(gl.TEXTURE0);
544
+ gl.bindTexture(gl.TEXTURE_2D, liquid.sharpTexture);
545
+ gl.activeTexture(gl.TEXTURE1);
546
+ gl.bindTexture(gl.TEXTURE_2D, liquid.blurTexture);
547
+ gl.uniform1i(liquid.sharpTex, 0);
548
+ gl.uniform1i(liquid.blurTex, 1);
549
+ gl.uniform2f(liquid.size, Math.max(1, canvas.clientWidth), Math.max(1, canvas.clientHeight));
550
+ gl.uniform2f(liquid.panelOffset, hostRect.left - sceneRect.left, hostRect.top - sceneRect.top);
551
+ gl.uniform2f(liquid.sceneSize, sceneRect.width, sceneRect.height);
552
+ gl.uniform1f(liquid.radius, radius);
553
+ gl.uniform1f(liquid.zRadius, zRadius);
554
+ gl.uniform1f(liquid.refract, refraction);
555
+ gl.uniform1f(liquid.chroma, chromaticAberration);
556
+ gl.uniform1f(liquid.edgeDarkening, edgeDarkening);
557
+ gl.uniform1f(liquid.spec, specular);
558
+ gl.uniform1f(liquid.fresnel, fresnel);
559
+ gl.uniform1f(liquid.edgeHL, edgeHighlight);
560
+ gl.uniform1f(liquid.time, reduced ? 4.2 : (now - startedAt) / 1e3);
561
+ gl.uniform1f(liquid.aurora, aurora);
562
+ gl.uniform1f(liquid.reveal, reveal);
563
+ gl.uniform1f(liquid.settle, settle);
564
+ gl.uniform1f(liquid.lift, lift);
565
+ gl.uniform1f(liquid.ribbonHorizon, .5);
566
+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
567
+ delete canvas.dataset.glassFailed;
568
+ 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();
592
+ }
593
+ function handleContextLost(event) {
594
+ event.preventDefault();
595
+ contextLost = true;
596
+ textureFresh = false;
597
+ delete canvas.dataset.glassReady;
598
+ canvas.dataset.glassFailed = "context";
599
+ if (rafId !== 0) cancelAnimationFrame(rafId);
600
+ rafId = 0;
601
+ }
602
+ function handleContextRestored() {
603
+ if (!gl) return;
604
+ contextLost = false;
605
+ liquid = buildProgram(gl);
606
+ if (!liquid) {
607
+ canvas.dataset.glassFailed = "shader";
608
+ return;
609
+ }
610
+ uploadTexture();
611
+ invalidate();
612
+ }
613
+ const resizeObserver = new ResizeObserver(() => {
614
+ invalidate();
615
+ });
616
+ resizeObserver.observe(canvas);
617
+ const sceneResizeObserver = new ResizeObserver(() => {
618
+ scheduleRecapture();
619
+ });
620
+ sceneResizeObserver.observe(scene);
621
+ const sceneMutationObserver = new MutationObserver((mutations) => {
622
+ for (const mutation of mutations) {
623
+ const target = mutation.target;
624
+ if ((target instanceof Element ? target : target.parentElement)?.closest(EXCLUDE_SELECTOR)) continue;
625
+ scheduleRecapture();
626
+ return;
627
+ }
628
+ });
629
+ sceneMutationObserver.observe(scene, {
630
+ attributes: true,
631
+ characterData: true,
632
+ childList: true,
633
+ subtree: true
634
+ });
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
+ canvas.addEventListener("webglcontextlost", handleContextLost);
653
+ canvas.addEventListener("webglcontextrestored", handleContextRestored);
654
+ recapture();
655
+ invalidate();
656
+ return () => {
657
+ destroyed = true;
658
+ if (rafId !== 0) cancelAnimationFrame(rafId);
659
+ window.clearTimeout(captureTimer);
660
+ resizeObserver.disconnect();
661
+ sceneResizeObserver.disconnect();
662
+ sceneMutationObserver.disconnect();
663
+ intersectionObserver.disconnect();
664
+ motionObserver.disconnect();
665
+ document.removeEventListener("visibilitychange", handleVisibility);
666
+ reducedMotionQuery.removeEventListener("change", handleMotionPreference);
667
+ canvas.removeEventListener("webglcontextlost", handleContextLost);
668
+ canvas.removeEventListener("webglcontextrestored", handleContextRestored);
669
+ delete canvas.dataset.glassReady;
670
+ delete canvas.dataset.glassFailed;
671
+ if (liquid && !gl.isContextLost()) {
672
+ gl.deleteProgram(liquid.program);
673
+ gl.deleteBuffer(liquid.buffer);
674
+ gl.deleteTexture(liquid.sharpTexture);
675
+ gl.deleteTexture(liquid.blurTexture);
676
+ }
677
+ liquid = null;
678
+ captured = null;
679
+ };
680
+ }
681
+ //#endregion
682
+ export { createDynamicNotificationLiquid };
@@ -0,0 +1,4 @@
1
+ //#region src/dynamic-notification-siri-wave.d.ts
2
+ declare const DYNAMIC_NOTIFICATION_SIRI_WAVE_GLSL = "\nconst float SIRI_PI = 3.14159265359;\nconst float SIRI_AMPLITUDE = 0.32;\nconst float SIRI_FREQUENCY = 1.1;\nconst float SIRI_ABERRATION_FREQUENCY = 1.0;\nconst float SIRI_SPEED = 2.4;\nconst float SIRI_WAVE_SCALE = 0.6;\nconst float SIRI_ABERRATION = 2.6;\nconst float SIRI_THICKNESS = 3.0;\nconst float SIRI_INTENSITY = 2.0;\nconst float SIRI_FALLOFF = 1.7;\nconst float SIRI_EDGE_MASK = 0.4;\nconst float SIRI_BAND_FILL = 30000.0;\nconst float SIRI_BAND_THICKNESS = 0.08;\nconst float SIRI_SOFTNESS = 2.5;\nconst float SIRI_LOW_AMPLITUDE = 6.0;\nconst float SIRI_LOW_INTENSITY = 1.5;\nconst float SIRI_MID_ABERRATION = 0.8;\nconst float SIRI_MID_ABERRATION_AMPLITUDE = 0.05;\nconst float SIRI_MID_SOFTNESS = 0.4;\nconst float SIRI_HIGH_ABERRATION = 0.5;\nconst float SIRI_HIGH_ABERRATION_AMPLITUDE = 0.06;\n\nvec3 siriSpectrum(int strand) {\n float x = float(strand);\n return clamp(vec3(abs(x - 3.0) - 1.0, 2.0 - abs(x - 2.0), 2.0 - abs(x - 4.0)), 0.0, 1.0);\n}\n\nvec3 dynamicNotificationSiriWave(vec2 uv, vec2 resolution, float time, float horizon, float lift) {\n float aspect = resolution.x / max(resolution.y, 1.0);\n vec2 p = vec2((uv.x * 2.0 - 1.0) * aspect, (uv.y - horizon + lift * 0.55) * 2.0);\n float screenY = p.y;\n p /= max(SIRI_WAVE_SCALE, 0.1);\n\n float low = clamp(0.45 + 0.45 * sin(time * 0.8) * sin(time * 0.37 + 1.0), 0.0, 1.0);\n float mid = clamp(0.40 + 0.40 * sin(time * 1.7 + 2.0) * sin(time * 0.53), 0.0, 1.0);\n float high = clamp(0.30 + 0.30 * sin(time * 2.9 + 4.0) * sin(time * 0.71 + 2.0), 0.0, 1.0);\n float drift = mod(time, 20.0 * SIRI_PI) * SIRI_SPEED;\n\n float horizontalPosition = uv.x * 2.0 - 1.0;\n float envelope = cos(SIRI_PI * 0.5 * min(abs(0.9 * horizontalPosition), 1.0));\n envelope *= envelope;\n\n float primaryAmplitude = SIRI_AMPLITUDE + 0.01 * low * SIRI_LOW_AMPLITUDE;\n float strandAmplitude = primaryAmplitude + mid * SIRI_MID_ABERRATION_AMPLITUDE + high * SIRI_HIGH_ABERRATION_AMPLITUDE;\n float aberration = SIRI_ABERRATION + mid * SIRI_MID_ABERRATION + high * SIRI_HIGH_ABERRATION;\n float thickness = 0.01 * SIRI_THICKNESS;\n float intensity = 0.01 * (SIRI_INTENSITY + low * SIRI_LOW_INTENSITY);\n float softness = 0.01 * max(0.0, SIRI_SOFTNESS + mid * SIRI_MID_SOFTNESS);\n float primaryY = primaryAmplitude * envelope * sin(p.x * SIRI_FREQUENCY + drift);\n float bandAmount = 1e-4 * SIRI_BAND_FILL * intensity;\n\n vec3 numerator = vec3(0.0);\n vec3 denominator = vec3(0.0);\n for (int strand = 0; strand < 4; strand++) {\n vec3 hue = siriSpectrum(strand);\n denominator += hue;\n float phase = mix(-aberration, aberration, float(strand) / 3.0);\n float strandY = strandAmplitude * envelope * sin(p.x * SIRI_ABERRATION_FREQUENCY + drift + phase);\n float distanceToStrand = abs(p.y - strandY);\n float line = intensity / (sqrt(distanceToStrand * distanceToStrand + softness * softness) + thickness);\n float bandLow = min(primaryY, strandY);\n float bandHigh = max(primaryY, strandY);\n float distanceToBand = max(0.0, max(p.y - bandHigh, bandLow - p.y));\n float band = bandAmount / (distanceToBand + SIRI_BAND_THICKNESS);\n numerator += hue * (line + band);\n }\n\n vec3 color = numerator / max(denominator, vec3(0.0001));\n float primaryDistance = abs(p.y - primaryY);\n color += 0.5 * intensity / (sqrt(primaryDistance * primaryDistance + softness * softness) + thickness);\n color = pow(max(color, 0.0), vec3(1.5));\n\n float edgeFadePosition = clamp((abs(screenY) - 1.0) / -SIRI_EDGE_MASK, 0.0, 1.0);\n float edgeFade = edgeFadePosition * edgeFadePosition * (3.0 - 2.0 * edgeFadePosition);\n color *= edgeFade * exp(-pow(horizontalPosition * SIRI_FALLOFF, 2.0));\n return color;\n}\n";
3
+ //#endregion
4
+ export { DYNAMIC_NOTIFICATION_SIRI_WAVE_GLSL };