@ctrl-ui/react 0.8.1 → 0.8.4

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 (377) hide show
  1. package/README.md +32 -23
  2. package/dist/action-bar.d.ts +11 -12
  3. package/dist/activity.d.ts +24 -25
  4. package/dist/audio-recorder.d.ts +16 -16
  5. package/dist/audio-visualizer.d.ts +3 -4
  6. package/dist/blocks/chat.d.ts +3 -4
  7. package/dist/blocks/chat.js +6 -3
  8. package/dist/blocks/coding-agent.d.ts +11 -12
  9. package/dist/blocks/coding-agent.js +10 -9
  10. package/dist/blocks/file-explorer-data.d.ts +11 -12
  11. package/dist/blocks/file-explorer.d.ts +3 -3
  12. package/dist/blocks/settings-data.d.ts +8 -9
  13. package/dist/blocks/settings.d.ts +4 -4
  14. package/dist/blocks/theme-toggle.d.ts +11 -12
  15. package/dist/blocks/theme-toggle.js +14 -4
  16. package/dist/chat-composer-attachment.d.ts +20 -21
  17. package/dist/chat-composer-attachment.js +24 -20
  18. package/dist/chat-composer-editor/extensions/mention.d.ts +5 -6
  19. package/dist/chat-composer-editor/ghost.d.ts +3 -4
  20. package/dist/chat-composer-editor/schema.d.ts +2 -3
  21. package/dist/chat-composer-editor/serialize.d.ts +3 -4
  22. package/dist/chat-composer-editor/types.d.ts +5 -6
  23. package/dist/chat-composer-editor.d.ts +2 -3
  24. package/dist/chat-composer-editor.js +18 -4
  25. package/dist/chat-composer.d.ts +17 -18
  26. package/dist/chat-composer.js +14 -8
  27. package/dist/chat-layout.d.ts +12 -21
  28. package/dist/chat-layout.js +28 -83
  29. package/dist/chat-message.d.ts +14 -15
  30. package/dist/context-model.d.ts +7 -8
  31. package/dist/context.d.ts +21 -22
  32. package/dist/control-props.d.ts +10 -11
  33. package/dist/control-variants.d.ts +6 -7
  34. package/dist/dynamic-notification-glass.d.ts +3 -4
  35. package/dist/dynamic-notification-liquid.d.ts +3 -4
  36. package/dist/dynamic-notification-siri-wave.d.ts +2 -3
  37. package/dist/dynamic-notification.d.ts +28 -29
  38. package/dist/email/email.d.ts +6 -7
  39. package/dist/email/email.js +12 -3
  40. package/dist/email/length.d.ts +3 -0
  41. package/dist/email/length.js +34 -0
  42. package/dist/email/templates.d.ts +7 -8
  43. package/dist/email/templates.js +5 -5
  44. package/dist/email/theme.d.ts +16 -5
  45. package/dist/email/theme.js +21 -6
  46. package/dist/environment-variables.d.ts +35 -36
  47. package/dist/extensions/create-track-highlight.d.ts +3 -4
  48. package/dist/extensions/supports-anchor-transitions.d.ts +2 -3
  49. package/dist/extensions/track-highlight.d.ts +3 -4
  50. package/dist/hooks/use-audio-recorder.d.ts +14 -15
  51. package/dist/hooks/use-chat-composer.d.ts +5 -6
  52. package/dist/hooks/use-chat-message.d.ts +7 -8
  53. package/dist/hooks/use-color-area.d.ts +5 -6
  54. package/dist/hooks/use-copy-to-clipboard.d.ts +7 -8
  55. package/dist/hooks/use-dropzone.d.ts +11 -12
  56. package/dist/hooks/use-dynamic-notification.d.ts +6 -7
  57. package/dist/hooks/use-environment-variables.d.ts +9 -10
  58. package/dist/hooks/use-keyboard-navigation.d.ts +3 -0
  59. package/dist/hooks/use-keyboard-navigation.js +22 -0
  60. package/dist/hooks/use-mobile.d.ts +2 -3
  61. package/dist/hooks/use-textarea-trigger-menu.d.ts +2 -3
  62. package/dist/hooks/use-trigger-menu.d.ts +7 -8
  63. package/dist/hooks/use-user-ask.d.ts +6 -7
  64. package/dist/inline-attachment.d.ts +16 -17
  65. package/dist/inline-citation.d.ts +22 -23
  66. package/dist/knob-contracts/accordion-knobs.d.ts +3 -4
  67. package/dist/knob-contracts/accordion-knobs.js +1 -0
  68. package/dist/knob-contracts/action-bar-knobs.d.ts +3 -4
  69. package/dist/knob-contracts/activity-knobs.d.ts +3 -4
  70. package/dist/knob-contracts/alert-knobs.d.ts +3 -4
  71. package/dist/knob-contracts/alert-knobs.js +12 -1
  72. package/dist/knob-contracts/audio-recorder-knobs.d.ts +3 -4
  73. package/dist/knob-contracts/audio-visualizer-knobs.d.ts +3 -4
  74. package/dist/knob-contracts/avatar-knobs.d.ts +3 -4
  75. package/dist/knob-contracts/avatar-knobs.js +2 -1
  76. package/dist/knob-contracts/badge-knobs.d.ts +3 -4
  77. package/dist/knob-contracts/button-group-knobs.d.ts +3 -4
  78. package/dist/knob-contracts/button-knobs.d.ts +3 -4
  79. package/dist/knob-contracts/button-knobs.js +1 -0
  80. package/dist/knob-contracts/calendar-knobs.d.ts +3 -4
  81. package/dist/knob-contracts/card-knobs.d.ts +3 -4
  82. package/dist/knob-contracts/chat-composer-attachment-knobs.d.ts +3 -4
  83. package/dist/knob-contracts/chat-composer-attachment-knobs.js +3 -1
  84. package/dist/knob-contracts/chat-composer-knobs.d.ts +3 -4
  85. package/dist/knob-contracts/chat-composer-knobs.js +1 -0
  86. package/dist/knob-contracts/chat-layout-knobs.d.ts +3 -4
  87. package/dist/knob-contracts/chat-layout-knobs.js +2 -3
  88. package/dist/knob-contracts/chat-message-knobs.d.ts +3 -4
  89. package/dist/knob-contracts/choice-knobs.d.ts +3 -4
  90. package/dist/knob-contracts/choice-knobs.js +2 -1
  91. package/dist/knob-contracts/code-diff-knobs.d.ts +3 -4
  92. package/dist/knob-contracts/code-diff-knobs.js +1 -0
  93. package/dist/knob-contracts/code-knobs.d.ts +3 -4
  94. package/dist/knob-contracts/code-knobs.js +3 -1
  95. package/dist/knob-contracts/collapsible-knobs.d.ts +3 -4
  96. package/dist/knob-contracts/color-picker-knobs.d.ts +3 -4
  97. package/dist/knob-contracts/context-knobs.d.ts +3 -4
  98. package/dist/knob-contracts/dockable-panel-knobs.d.ts +3 -4
  99. package/dist/knob-contracts/dockable-panel-knobs.js +1 -0
  100. package/dist/knob-contracts/dropzone-knobs.d.ts +3 -4
  101. package/dist/knob-contracts/dropzone-knobs.js +1 -0
  102. package/dist/knob-contracts/dynamic-notification-knobs.d.ts +3 -4
  103. package/dist/knob-contracts/empty-knobs.d.ts +3 -4
  104. package/dist/knob-contracts/empty-knobs.js +14 -1
  105. package/dist/knob-contracts/environment-variables-knobs.d.ts +3 -4
  106. package/dist/knob-contracts/environment-variables-knobs.js +2 -1
  107. package/dist/knob-contracts/field-knobs.d.ts +3 -4
  108. package/dist/knob-contracts/gradient-editor-knobs.d.ts +3 -4
  109. package/dist/knob-contracts/gradient-editor-knobs.js +3 -1
  110. package/dist/knob-contracts/infinite-canvas-knobs.d.ts +3 -4
  111. package/dist/knob-contracts/inline-attachment-knobs.d.ts +3 -4
  112. package/dist/knob-contracts/inline-attachment-knobs.js +2 -1
  113. package/dist/knob-contracts/inline-citation-knobs.d.ts +3 -4
  114. package/dist/knob-contracts/inline-citation-knobs.js +1 -0
  115. package/dist/knob-contracts/item-knobs.d.ts +3 -4
  116. package/dist/knob-contracts/kbd-knobs.d.ts +3 -4
  117. package/dist/knob-contracts/markdown-block-knobs.d.ts +3 -4
  118. package/dist/knob-contracts/markdown-block-knobs.js +2 -0
  119. package/dist/knob-contracts/markdown-knobs.d.ts +3 -4
  120. package/dist/knob-contracts/markdown-knobs.js +1 -0
  121. package/dist/knob-contracts/morphing-panel-knobs.d.ts +3 -4
  122. package/dist/knob-contracts/pagination-knobs.d.ts +3 -4
  123. package/dist/knob-contracts/phone-input-knobs.d.ts +3 -4
  124. package/dist/knob-contracts/phone-input-knobs.js +1 -0
  125. package/dist/knob-contracts/popup-knobs.d.ts +3 -4
  126. package/dist/knob-contracts/progressive-blur-knobs.d.ts +3 -4
  127. package/dist/knob-contracts/progressive-blur-knobs.js +1 -0
  128. package/dist/knob-contracts/range-knobs.d.ts +3 -4
  129. package/dist/knob-contracts/resizable-knobs.d.ts +3 -4
  130. package/dist/knob-contracts/resizable-knobs.js +1 -0
  131. package/dist/knob-contracts/rich-tooltip-knobs.d.ts +3 -4
  132. package/dist/knob-contracts/scroll-area-knobs.d.ts +3 -4
  133. package/dist/knob-contracts/separator-knobs.d.ts +3 -4
  134. package/dist/knob-contracts/sidebar-knobs.d.ts +3 -4
  135. package/dist/knob-contracts/sidebar-knobs.js +1 -0
  136. package/dist/knob-contracts/skeleton-knobs.d.ts +3 -4
  137. package/dist/knob-contracts/skeleton-knobs.js +9 -1
  138. package/dist/knob-contracts/source-badge-knobs.d.ts +3 -4
  139. package/dist/knob-contracts/spinner-knobs.d.ts +3 -4
  140. package/dist/knob-contracts/stepper-knobs.d.ts +3 -4
  141. package/dist/knob-contracts/stepper-knobs.js +1 -0
  142. package/dist/knob-contracts/switch-knobs.d.ts +3 -4
  143. package/dist/knob-contracts/switch-knobs.js +7 -1
  144. package/dist/knob-contracts/table-knobs.d.ts +3 -4
  145. package/dist/knob-contracts/table-of-contents-knobs.d.ts +3 -4
  146. package/dist/knob-contracts/table-of-contents-knobs.js +25 -0
  147. package/dist/knob-contracts/tabs-knobs.d.ts +3 -4
  148. package/dist/knob-contracts/tabs-knobs.js +2 -1
  149. package/dist/knob-contracts/task-list-knobs.d.ts +3 -4
  150. package/dist/knob-contracts/task-list-knobs.js +1 -0
  151. package/dist/knob-contracts/thread-rail-knobs.d.ts +3 -4
  152. package/dist/knob-contracts/timeline-knobs.d.ts +3 -4
  153. package/dist/knob-contracts/toolbar-knobs.d.ts +3 -4
  154. package/dist/knob-contracts/toolbar-knobs.js +1 -0
  155. package/dist/knob-contracts/track-highlight-knobs.d.ts +3 -4
  156. package/dist/knob-contracts/transcript-divider-knobs.d.ts +3 -4
  157. package/dist/knob-contracts/tree-knobs.d.ts +3 -4
  158. package/dist/knob-contracts/user-ask-knobs.d.ts +3 -4
  159. package/dist/knob-contracts/user-ask-knobs.js +1 -0
  160. package/dist/lib/cn.d.ts +2 -3
  161. package/dist/lib/code-tokens.d.ts +12 -13
  162. package/dist/lib/color.d.ts +26 -27
  163. package/dist/lib/contrast.d.ts +12 -13
  164. package/dist/lib/diff.d.ts +14 -15
  165. package/dist/lib/dropzone-validation.d.ts +25 -26
  166. package/dist/lib/env-file.d.ts +12 -13
  167. package/dist/lib/format-audio-recorder-duration.d.ts +2 -3
  168. package/dist/lib/liquid-glass-optics.d.ts +2 -3
  169. package/dist/lib/phone-input-format.d.ts +3 -4
  170. package/dist/lib/phone-input-format.js +1 -1
  171. package/dist/lib/phone-number.d.ts +8 -9
  172. package/dist/lib/trigger-detect.d.ts +4 -5
  173. package/dist/markdown-block.d.ts +11 -12
  174. package/dist/scripts/contrast-eval.d.ts +16 -17
  175. package/dist/scripts/contrast-eval.js +13 -7
  176. package/dist/skin-provider.d.ts +14 -0
  177. package/dist/skin-provider.js +21 -0
  178. package/dist/skin.d.ts +14 -33
  179. package/dist/skin.js +3 -46
  180. package/dist/source-badge.d.ts +7 -8
  181. package/dist/styles/index.css +2 -4
  182. package/dist/styles/recipes/accordion.css +8 -2
  183. package/dist/styles/recipes/action-bar.css +5 -2
  184. package/dist/styles/recipes/alert.css +95 -16
  185. package/dist/styles/recipes/avatar.css +17 -1
  186. package/dist/styles/recipes/badge.css +0 -1
  187. package/dist/styles/recipes/button.css +34 -8
  188. package/dist/styles/recipes/calendar.css +0 -6
  189. package/dist/styles/recipes/chat-composer-attachment.css +51 -53
  190. package/dist/styles/recipes/chat-composer.css +26 -21
  191. package/dist/styles/recipes/chat-layout.css +21 -62
  192. package/dist/styles/recipes/chat-message.css +11 -5
  193. package/dist/styles/recipes/choice.css +9 -2
  194. package/dist/styles/recipes/code-diff.css +8 -1
  195. package/dist/styles/recipes/code.css +39 -17
  196. package/dist/styles/recipes/collapsible.css +0 -3
  197. package/dist/styles/recipes/color-picker-details.css +1 -2
  198. package/dist/styles/recipes/color-picker-values.css +0 -4
  199. package/dist/styles/recipes/dockable-panel.css +8 -1
  200. package/dist/styles/recipes/dropzone.css +9 -2
  201. package/dist/styles/recipes/empty.css +118 -17
  202. package/dist/styles/recipes/environment-variables.css +8 -1
  203. package/dist/styles/recipes/field-parts.css +1 -6
  204. package/dist/styles/recipes/field.css +9 -5
  205. package/dist/styles/recipes/gradient-editor.css +16 -5
  206. package/dist/styles/recipes/inline-attachment.css +13 -8
  207. package/dist/styles/recipes/inline-citation.css +8 -4
  208. package/dist/styles/recipes/item.css +1 -1
  209. package/dist/styles/recipes/kbd.css +8 -0
  210. package/dist/styles/recipes/markdown-block.css +16 -2
  211. package/dist/styles/recipes/markdown.css +12 -0
  212. package/dist/styles/recipes/morphing-panel.css +1 -1
  213. package/dist/styles/recipes/pagination.css +0 -4
  214. package/dist/styles/recipes/phone-input.css +8 -4
  215. package/dist/styles/recipes/popup-lists.css +11 -0
  216. package/dist/styles/recipes/popup-toast.css +1 -29
  217. package/dist/styles/recipes/popup.css +2 -2
  218. package/dist/styles/recipes/progressive-blur.css +28 -7
  219. package/dist/styles/recipes/range.css +50 -1
  220. package/dist/styles/recipes/resizable.css +8 -10
  221. package/dist/styles/recipes/rich-tooltip.css +0 -4
  222. package/dist/styles/recipes/scroll-area.css +8 -2
  223. package/dist/styles/recipes/sidebar-menu.css +150 -0
  224. package/dist/styles/recipes/sidebar.css +56 -110
  225. package/dist/styles/recipes/skeleton.css +85 -3
  226. package/dist/styles/recipes/source-badge.css +0 -3
  227. package/dist/styles/recipes/stepper.css +8 -1
  228. package/dist/styles/recipes/switch.css +89 -17
  229. package/dist/styles/recipes/table-of-contents.css +211 -45
  230. package/dist/styles/recipes/table.css +0 -1
  231. package/dist/styles/recipes/tabs.css +19 -2
  232. package/dist/styles/recipes/task-list.css +8 -2
  233. package/dist/styles/recipes/thread-rail.css +0 -4
  234. package/dist/styles/recipes/toolbar.css +18 -4
  235. package/dist/styles/recipes/track-highlight.css +63 -5
  236. package/dist/styles/recipes/tree.css +2 -0
  237. package/dist/styles/recipes/user-ask.css +8 -4
  238. package/dist/styles/theme.css +130 -138
  239. package/dist/surface-variants.d.ts +4 -5
  240. package/dist/task-list.d.ts +16 -17
  241. package/dist/thread-rail.d.ts +21 -22
  242. package/dist/transcript-divider.d.ts +6 -7
  243. package/dist/ui/accordion.d.ts +10 -11
  244. package/dist/ui/alert-dialog.d.ts +11 -12
  245. package/dist/ui/alert-dialog.js +8 -6
  246. package/dist/ui/alert.d.ts +9 -10
  247. package/dist/ui/alert.js +3 -3
  248. package/dist/ui/aspect-ratio.d.ts +3 -4
  249. package/dist/ui/autocomplete.d.ts +19 -20
  250. package/dist/ui/autocomplete.js +5 -3
  251. package/dist/ui/avatar.d.ts +9 -10
  252. package/dist/ui/badge.d.ts +9 -10
  253. package/dist/ui/button-group.d.ts +7 -8
  254. package/dist/ui/button-group.js +3 -2
  255. package/dist/ui/button.d.ts +17 -18
  256. package/dist/ui/button.js +20 -5
  257. package/dist/ui/calendar.d.ts +3 -4
  258. package/dist/ui/card.d.ts +16 -17
  259. package/dist/ui/checkbox-group.d.ts +4 -5
  260. package/dist/ui/checkbox-group.js +3 -2
  261. package/dist/ui/checkbox.d.ts +3 -4
  262. package/dist/ui/code-diff.d.ts +8 -9
  263. package/dist/ui/code.d.ts +32 -23
  264. package/dist/ui/code.js +41 -20
  265. package/dist/ui/collapsible.d.ts +7 -8
  266. package/dist/ui/color-picker.d.ts +40 -41
  267. package/dist/ui/color-picker.js +5 -3
  268. package/dist/ui/combobox-disabled-selection.d.ts +3 -4
  269. package/dist/ui/combobox.d.ts +21 -20
  270. package/dist/ui/combobox.js +5 -3
  271. package/dist/ui/command.d.ts +19 -18
  272. package/dist/ui/command.js +38 -12
  273. package/dist/ui/context-menu.d.ts +30 -31
  274. package/dist/ui/context-menu.js +8 -5
  275. package/dist/ui/dialog.d.ts +13 -13
  276. package/dist/ui/dialog.js +10 -8
  277. package/dist/ui/dockable-panel-geometry.d.ts +7 -8
  278. package/dist/ui/dockable-panel.d.ts +21 -22
  279. package/dist/ui/drawer.d.ts +17 -18
  280. package/dist/ui/drawer.js +7 -6
  281. package/dist/ui/dropdown-menu.d.ts +36 -29
  282. package/dist/ui/dropdown-menu.js +116 -9
  283. package/dist/ui/dropzone.d.ts +24 -24
  284. package/dist/ui/empty.d.ts +14 -14
  285. package/dist/ui/empty.js +3 -3
  286. package/dist/ui/field.d.ts +26 -27
  287. package/dist/ui/form.d.ts +4 -5
  288. package/dist/ui/gradient-editor.d.ts +16 -17
  289. package/dist/ui/hover-card.d.ts +6 -7
  290. package/dist/ui/hover-card.js +5 -3
  291. package/dist/ui/infinite-canvas.d.ts +11 -12
  292. package/dist/ui/input-group.d.ts +6 -7
  293. package/dist/ui/input-otp.d.ts +7 -8
  294. package/dist/ui/input.d.ts +3 -4
  295. package/dist/ui/item.d.ts +20 -21
  296. package/dist/ui/kbd.d.ts +7 -5
  297. package/dist/ui/kbd.js +4 -2
  298. package/dist/ui/markdown-elements.d.ts +20 -21
  299. package/dist/ui/markdown.d.ts +5 -6
  300. package/dist/ui/menubar.d.ts +25 -26
  301. package/dist/ui/menubar.js +8 -5
  302. package/dist/ui/meter.d.ts +11 -12
  303. package/dist/ui/morphing-panel.d.ts +8 -9
  304. package/dist/ui/native-select.d.ts +3 -4
  305. package/dist/ui/native-select.js +1 -1
  306. package/dist/ui/navigation-menu.d.ts +17 -18
  307. package/dist/ui/navigation-menu.js +5 -3
  308. package/dist/ui/number-field.d.ts +15 -16
  309. package/dist/ui/pagination.d.ts +10 -11
  310. package/dist/ui/phone-input.d.ts +5 -6
  311. package/dist/ui/phone-input.js +40 -37
  312. package/dist/ui/popover.d.ts +11 -12
  313. package/dist/ui/popover.js +5 -3
  314. package/dist/ui/progress.d.ts +11 -12
  315. package/dist/ui/progressive-blur.d.ts +4 -5
  316. package/dist/ui/radio-group.d.ts +5 -6
  317. package/dist/ui/resizable.d.ts +12 -13
  318. package/dist/ui/responsive-dialog.d.ts +11 -12
  319. package/dist/ui/rich-tooltip-tour.d.ts +5 -6
  320. package/dist/ui/rich-tooltip.d.ts +21 -23
  321. package/dist/ui/rich-tooltip.js +5 -5
  322. package/dist/ui/scroll-area.d.ts +7 -8
  323. package/dist/ui/scroll-area.js +9 -6
  324. package/dist/ui/select.d.ts +21 -14
  325. package/dist/ui/select.js +7 -4
  326. package/dist/ui/separator.d.ts +2 -3
  327. package/dist/ui/sheet.d.ts +8 -9
  328. package/dist/ui/sheet.js +7 -5
  329. package/dist/ui/sidebar-menu.d.ts +24 -15
  330. package/dist/ui/sidebar-menu.js +30 -4
  331. package/dist/ui/sidebar-provider.d.ts +32 -7
  332. package/dist/ui/sidebar-provider.js +82 -22
  333. package/dist/ui/sidebar-resize-rail.d.ts +8 -0
  334. package/dist/ui/sidebar-resize-rail.js +192 -0
  335. package/dist/ui/sidebar.d.ts +20 -14
  336. package/dist/ui/sidebar.js +122 -57
  337. package/dist/ui/skeleton.d.ts +7 -4
  338. package/dist/ui/skeleton.js +9 -2
  339. package/dist/ui/slider.d.ts +6 -5
  340. package/dist/ui/slider.js +16 -13
  341. package/dist/ui/spinner.d.ts +3 -4
  342. package/dist/ui/stepper.d.ts +22 -23
  343. package/dist/ui/switch.d.ts +3 -4
  344. package/dist/ui/switch.js +12 -1
  345. package/dist/ui/table-of-contents.d.ts +7 -8
  346. package/dist/ui/table-of-contents.js +4 -2
  347. package/dist/ui/table.d.ts +17 -18
  348. package/dist/ui/tabs.d.ts +14 -11
  349. package/dist/ui/textarea.d.ts +3 -4
  350. package/dist/ui/timeline.d.ts +18 -19
  351. package/dist/ui/toast.d.ts +9 -9
  352. package/dist/ui/toast.js +21 -14
  353. package/dist/ui/toggle.d.ts +5 -6
  354. package/dist/ui/toggle.js +3 -2
  355. package/dist/ui/toolbar.d.ts +15 -16
  356. package/dist/ui/toolbar.js +15 -4
  357. package/dist/ui/tooltip.d.ts +6 -13
  358. package/dist/ui/tooltip.js +7 -8
  359. package/dist/ui/tree.d.ts +18 -19
  360. package/dist/ui/tree.js +3 -2
  361. package/dist/ui/trigger-menu.d.ts +15 -16
  362. package/dist/ui/trigger-menu.js +5 -3
  363. package/dist/ui/use-switch-drag.d.ts +7 -0
  364. package/dist/ui/use-switch-drag.js +104 -0
  365. package/dist/user-ask.d.ts +24 -25
  366. package/package.json +15 -15
  367. package/dist/code-block-editor.d.ts +0 -59
  368. package/dist/code-block-editor.js +0 -250
  369. package/dist/knob-contracts/code-block-editor-knobs.d.ts +0 -5
  370. package/dist/knob-contracts/code-block-editor-knobs.js +0 -11
  371. package/dist/lib/code-block-shiki.d.ts +0 -9
  372. package/dist/lib/code-block-shiki.js +0 -6
  373. package/dist/skin.config.d.ts +0 -5
  374. package/dist/skin.config.js +0 -12
  375. package/dist/styles/recipes/code-block-editor.css +0 -136
  376. package/dist/styles/skin-theme.css +0 -137
  377. package/dist/styles/skin.css +0 -143
@@ -1,29 +1,47 @@
1
1
  import { cn } from "./lib/cn.js";
2
- import { skinAdornment } from "./skin.js";
3
- import { ScrollArea } from "./ui/scroll-area.js";
4
- import { Activity, ActivityContent, ActivityTitle, ActivityTrigger } from "./activity.js";
2
+ import { SkinAdornment } from "./skin-provider.js";
5
3
  import { jsx, jsxs } from "react/jsx-runtime";
6
4
  //#region src/chat-layout.tsx
7
- function ChatLayout({ children, className, ...props }) {
5
+ function ChatLayout({ children, chrome = "panel", className, ...props }) {
8
6
  return /* @__PURE__ */ jsxs("section", {
9
7
  "data-control-ui": "chat-layout",
10
8
  "data-control-family": "chat-layout",
11
9
  "data-slot": "root",
12
- "data-surface": "panel",
10
+ "data-chrome": chrome,
11
+ "data-surface": chrome === "panel" ? "panel" : void 0,
13
12
  className: cn("relative mx-auto flex min-h-[640px] w-full max-w-3xl flex-col overflow-hidden", className),
14
13
  ...props,
15
- children: [skinAdornment("chat-layout", "titlebar", {}), children]
14
+ children: [chrome === "panel" ? /* @__PURE__ */ jsx(SkinAdornment, {
15
+ scope: "chat-layout",
16
+ part: "titlebar",
17
+ context: {}
18
+ }) : null, children]
16
19
  });
17
20
  }
18
- function ChatThread({ children, className, ...props }) {
21
+ function ChatThread({ children, composer, className, ...props }) {
19
22
  return /* @__PURE__ */ jsx("div", {
20
23
  "data-control-ui": "chat-thread",
21
24
  "data-control-family": "chat-layout",
22
25
  "data-chat-layout-kind": "thread",
23
26
  "data-slot": "root",
24
- className: cn("flex min-h-0 flex-1 flex-col overflow-y-auto", className),
27
+ className: cn("min-h-0 min-w-0 flex-1 overflow-y-auto", className),
25
28
  ...props,
26
- children
29
+ children: /* @__PURE__ */ jsxs("div", {
30
+ className: "relative flex min-h-full min-w-0 flex-col",
31
+ children: [/* @__PURE__ */ jsx("div", {
32
+ "data-control-ui": "chat-thread",
33
+ "data-control-family": "chat-layout",
34
+ "data-slot": "thread-content",
35
+ className: "flex min-w-0 flex-1 flex-col",
36
+ children
37
+ }), composer ? /* @__PURE__ */ jsx("div", {
38
+ "data-control-ui": "chat-thread",
39
+ "data-control-family": "chat-layout",
40
+ "data-slot": "dock",
41
+ className: "sticky bottom-0 z-10 shrink-0",
42
+ children: composer
43
+ }) : null]
44
+ })
27
45
  });
28
46
  }
29
47
  function ChatTurn({ from, children, className, ...props }) {
@@ -37,78 +55,5 @@ function ChatTurn({ from, children, className, ...props }) {
37
55
  children
38
56
  });
39
57
  }
40
- function ChatThought({ children = "Thought for a couple of seconds", details = "Read the attachment, grouped the notes by intent, and kept the final markdown compact enough to scan.", defaultOpen = false, collapsible, className, style, ...props }) {
41
- if (collapsible) {
42
- const Root = collapsible.Root;
43
- const Trigger = collapsible.Trigger;
44
- const Content = collapsible.Content;
45
- return /* @__PURE__ */ jsxs(Root, {
46
- defaultOpen,
47
- "data-control-ui": "chat-thought",
48
- "data-control-family": "chat-layout",
49
- "data-chat-layout-kind": "thought",
50
- "data-slot": "root",
51
- className: cn("self-start", className),
52
- style,
53
- ...props,
54
- children: [/* @__PURE__ */ jsxs(Trigger, {
55
- type: "button",
56
- "data-control-ui": "chat-thought",
57
- "data-control-family": "chat-layout",
58
- "data-slot": "trigger",
59
- className: "inline-flex items-center",
60
- children: [children, /* @__PURE__ */ jsx("span", {
61
- "aria-hidden": "true",
62
- "data-control-ui": "chat-thought",
63
- "data-control-family": "chat-layout",
64
- "data-slot": "chevron",
65
- children: "›"
66
- })]
67
- }), /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(ScrollArea, {
68
- maxHeight: "min(24rem, 50dvh)",
69
- lockAxis: "x",
70
- viewportProps: {
71
- "data-control-ui": "activity",
72
- "data-control-family": "activity",
73
- "data-slot": "content-viewport"
74
- },
75
- children: /* @__PURE__ */ jsxs("div", {
76
- "data-control-ui": "chat-thought",
77
- "data-control-family": "chat-layout",
78
- "data-slot": "details",
79
- className: "min-w-0 px-1 pb-2 pt-1",
80
- children: [skinAdornment("chat-thought", "details", {}), details]
81
- })
82
- }) })]
83
- });
84
- }
85
- return /* @__PURE__ */ jsxs(Activity, {
86
- state: "success",
87
- defaultOpen,
88
- "data-control-ui": "chat-thought",
89
- "data-control-family": "chat-layout",
90
- "data-chat-layout-kind": "thought",
91
- "data-slot": "root",
92
- className: cn("self-start", className),
93
- style,
94
- ...props,
95
- children: [/* @__PURE__ */ jsx(ActivityTrigger, {
96
- "data-control-ui": "chat-thought",
97
- "data-control-family": "chat-layout",
98
- "data-slot": "trigger",
99
- children: /* @__PURE__ */ jsx(ActivityTitle, {
100
- "data-control-ui": "chat-thought",
101
- "data-control-family": "chat-layout",
102
- "data-slot": "title",
103
- children
104
- })
105
- }), /* @__PURE__ */ jsxs(ActivityContent, {
106
- "data-control-ui": "chat-thought",
107
- "data-control-family": "chat-layout",
108
- "data-slot": "details",
109
- children: [skinAdornment("chat-thought", "details", {}), details]
110
- })]
111
- });
112
- }
113
58
  //#endregion
114
- export { ChatLayout, ChatThought, ChatThread, ChatTurn };
59
+ export { ChatLayout, ChatThread, ChatTurn };
@@ -2,30 +2,29 @@ import { ChatMessageKnobStyle } from "./knob-contracts/chat-message-knobs.js";
2
2
  import { ChatMessageProps } from "./hooks/use-chat-message.js";
3
3
  import { CSSProperties, ComponentProps } from "react";
4
4
  //#region src/chat-message.d.ts
5
- declare function ChatMessage({ from, state, density, className, children, ...props }: ChatMessageProps): import("react").JSX.Element;
6
- type ChatMessageRowProps = ComponentProps<"div"> & {
5
+ export declare function ChatMessage({ from, state, density, className, children, ...props }: ChatMessageProps): import("react").JSX.Element;
6
+ export type ChatMessageRowProps = ComponentProps<"div"> & {
7
7
  style?: CSSProperties & ChatMessageKnobStyle;
8
8
  };
9
- declare function ChatMessageRow({ className, children, ...props }: ChatMessageRowProps): import("react").JSX.Element;
10
- type ChatMessageAvatarProps = Omit<ComponentProps<"div">, "style"> & {
9
+ export declare function ChatMessageRow({ className, children, ...props }: ChatMessageRowProps): import("react").JSX.Element;
10
+ export type ChatMessageAvatarProps = Omit<ComponentProps<"div">, "style"> & {
11
11
  style?: CSSProperties & ChatMessageKnobStyle;
12
12
  };
13
- declare function ChatMessageAvatar({ className, ...props }: ChatMessageAvatarProps): import("react").JSX.Element;
14
- type ChatMessageBodyProps = ComponentProps<"div"> & {
13
+ export declare function ChatMessageAvatar({ className, ...props }: ChatMessageAvatarProps): import("react").JSX.Element;
14
+ export type ChatMessageBodyProps = ComponentProps<"div"> & {
15
15
  style?: CSSProperties & ChatMessageKnobStyle;
16
16
  };
17
- declare function ChatMessageBody({ className, ...props }: ChatMessageBodyProps): import("react").JSX.Element;
18
- type ChatMessageHeaderProps = Omit<ComponentProps<"div">, "style"> & {
17
+ export declare function ChatMessageBody({ className, ...props }: ChatMessageBodyProps): import("react").JSX.Element;
18
+ export type ChatMessageHeaderProps = Omit<ComponentProps<"div">, "style"> & {
19
19
  style?: CSSProperties & ChatMessageKnobStyle;
20
20
  };
21
- declare function ChatMessageHeader({ className, ...props }: ChatMessageHeaderProps): import("react").JSX.Element;
22
- type ChatMessageContentProps = Omit<ComponentProps<"div">, "style"> & {
21
+ export declare function ChatMessageHeader({ className, ...props }: ChatMessageHeaderProps): import("react").JSX.Element;
22
+ export type ChatMessageContentProps = Omit<ComponentProps<"div">, "style"> & {
23
23
  style?: CSSProperties & ChatMessageKnobStyle;
24
24
  };
25
- declare function ChatMessageContent({ className, ...props }: ChatMessageContentProps): import("react").JSX.Element;
26
- type ChatMessageActionsProps = Omit<ComponentProps<"div">, "style"> & {
25
+ export declare function ChatMessageContent({ className, ...props }: ChatMessageContentProps): import("react").JSX.Element;
26
+ export type ChatMessageActionsProps = Omit<ComponentProps<"div">, "style"> & {
27
27
  style?: CSSProperties & ChatMessageKnobStyle;
28
28
  };
29
- declare function ChatMessageActions({ className, ...props }: ChatMessageActionsProps): import("react").JSX.Element;
30
- //#endregion
31
- export { ChatMessage, ChatMessageActions, ChatMessageActionsProps, ChatMessageAvatar, ChatMessageAvatarProps, ChatMessageBody, ChatMessageBodyProps, ChatMessageContent, ChatMessageContentProps, ChatMessageHeader, ChatMessageHeaderProps, ChatMessageRow, ChatMessageRowProps };
29
+ export declare function ChatMessageActions({ className, ...props }: ChatMessageActionsProps): import("react").JSX.Element;
30
+ //#endregion
@@ -1,15 +1,15 @@
1
1
  import { ReactNode } from "react";
2
2
  //#region src/context-model.d.ts
3
- type ContextSegmentKind = "system" | "tool" | "message" | "source" | "reasoning" | "cache" | "other";
4
- type ContextStatus = "normal" | "over-limit" | "unavailable";
5
- type ContextSegment = {
3
+ export type ContextSegmentKind = "system" | "tool" | "message" | "source" | "reasoning" | "cache" | "other";
4
+ export type ContextStatus = "normal" | "over-limit" | "unavailable";
5
+ export type ContextSegment = {
6
6
  id: string;
7
7
  label: string;
8
8
  tokens: number;
9
9
  kind?: ContextSegmentKind;
10
10
  description?: ReactNode;
11
11
  };
12
- type ContextModelSegment = {
12
+ export type ContextModelSegment = {
13
13
  segment: ContextSegment;
14
14
  kind: ContextSegmentKind;
15
15
  tokens: number;
@@ -17,7 +17,7 @@ type ContextModelSegment = {
17
17
  width: number;
18
18
  ratio: number | null;
19
19
  };
20
- type ContextModel = {
20
+ export type ContextModel = {
21
21
  segments: readonly ContextModelSegment[];
22
22
  usedTokens: number;
23
23
  maxTokens: number | null;
@@ -28,6 +28,5 @@ type ContextModel = {
28
28
  limitPosition: number | null;
29
29
  status: ContextStatus;
30
30
  };
31
- declare function deriveContextModel(segments: readonly ContextSegment[], maxTokens?: number | null): ContextModel;
32
- //#endregion
33
- export { ContextModel, ContextModelSegment, ContextSegment, ContextSegmentKind, ContextStatus, deriveContextModel };
31
+ export declare function deriveContextModel(segments: readonly ContextSegment[], maxTokens?: number | null): ContextModel;
32
+ //#endregion
package/dist/context.d.ts CHANGED
@@ -7,7 +7,7 @@ import { ContextKnobStyle } from "./knob-contracts/context-knobs.js";
7
7
  import { PopoverContent, PopoverDescription, PopoverTitle } from "./ui/popover.js";
8
8
  import { CSSProperties, ComponentProps, ReactNode } from "react";
9
9
  //#region src/context.d.ts
10
- type ContextProps = Omit<ComponentProps<"div">, "children"> & {
10
+ export type ContextProps = Omit<ComponentProps<"div">, "children"> & {
11
11
  segments: readonly ContextSegment[];
12
12
  maxTokens?: number | null;
13
13
  model?: string;
@@ -22,26 +22,25 @@ type ContextProps = Omit<ComponentProps<"div">, "children"> & {
22
22
  type ContextStyleProps<Props, Style> = Omit<Props, "style"> & {
23
23
  style?: CSSProperties & Style;
24
24
  };
25
- declare function Context({ segments, maxTokens, model: modelName, locale, open, defaultOpen, onOpenChange, className, children, ...props }: ContextProps): import("react").JSX.Element;
26
- type ContextTriggerProps = ContextStyleProps<ComponentProps<typeof Button>, ButtonKnobStyle & ContextKnobStyle>;
27
- declare function ContextTrigger({ "aria-label": ariaLabel, variant, size, className, children, ...props }: ContextTriggerProps): import("react").JSX.Element;
28
- type ContextContentProps = ContextStyleProps<ComponentProps<typeof PopoverContent>, PopupKnobStyle & ContextKnobStyle>;
29
- declare function ContextContent({ "aria-label": ariaLabel, side, align, sideOffset, collisionPadding, padding, className, children, ...props }: ContextContentProps): import("react").JSX.Element;
30
- type ContextHeaderProps = ComponentProps<"div"> & {
25
+ export declare function Context({ segments, maxTokens, model: modelName, locale, open, defaultOpen, onOpenChange, className, children, ...props }: ContextProps): import("react").JSX.Element;
26
+ export type ContextTriggerProps = ContextStyleProps<ComponentProps<typeof Button>, ButtonKnobStyle & ContextKnobStyle>;
27
+ export declare function ContextTrigger({ "aria-label": ariaLabel, variant, size, className, children, ...props }: ContextTriggerProps): import("react").JSX.Element;
28
+ export type ContextContentProps = ContextStyleProps<ComponentProps<typeof PopoverContent>, PopupKnobStyle & ContextKnobStyle>;
29
+ export declare function ContextContent({ "aria-label": ariaLabel, side, align, sideOffset, collisionPadding, padding, className, children, ...props }: ContextContentProps): import("react").JSX.Element;
30
+ export type ContextHeaderProps = ComponentProps<"div"> & {
31
31
  style?: CSSProperties & ContextKnobStyle;
32
32
  };
33
- declare function ContextHeader({ className, children, ...props }: ContextHeaderProps): import("react").JSX.Element;
34
- type ContextTitleProps = ContextStyleProps<ComponentProps<typeof PopoverTitle>, ContextKnobStyle>;
35
- declare function ContextTitle({ className, children, ...props }: ContextTitleProps): import("react").JSX.Element;
36
- type ContextDescriptionProps = ContextStyleProps<ComponentProps<typeof PopoverDescription>, ContextKnobStyle>;
37
- declare function ContextDescription({ className, children, ...props }: ContextDescriptionProps): import("react").JSX.Element;
38
- type ContextSummaryProps = ContextStyleProps<ComponentProps<"div">, ContextKnobStyle>;
39
- declare function ContextSummary({ className, children, ...props }: ContextSummaryProps): import("react").JSX.Element;
40
- type ContextGraphProps = ContextStyleProps<Omit<ComponentProps<"svg">, "children">, ContextKnobStyle>;
41
- declare function ContextGraph({ className, ...props }: ContextGraphProps): import("react").JSX.Element;
42
- type ContextLegendProps = ContextStyleProps<ComponentProps<"ul">, ContextKnobStyle>;
43
- declare function ContextLegend({ className, children, ...props }: ContextLegendProps): import("react").JSX.Element;
44
- type ContextCloseProps = ComponentProps<typeof Button>;
45
- declare function ContextClose({ variant, size, iconOnly, "aria-label": ariaLabel, className, children, ...props }: ContextCloseProps): import("react").JSX.Element;
46
- //#endregion
47
- export { Context, ContextClose, ContextCloseProps, ContextContent, ContextContentProps, ContextDescription, ContextDescriptionProps, ContextGraph, ContextGraphProps, ContextHeader, ContextHeaderProps, ContextLegend, ContextLegendProps, ContextProps, ContextSummary, ContextSummaryProps, ContextTitle, ContextTitleProps, ContextTrigger, ContextTriggerProps };
33
+ export declare function ContextHeader({ className, children, ...props }: ContextHeaderProps): import("react").JSX.Element;
34
+ export type ContextTitleProps = ContextStyleProps<ComponentProps<typeof PopoverTitle>, ContextKnobStyle>;
35
+ export declare function ContextTitle({ className, children, ...props }: ContextTitleProps): import("react").JSX.Element;
36
+ export type ContextDescriptionProps = ContextStyleProps<ComponentProps<typeof PopoverDescription>, ContextKnobStyle>;
37
+ export declare function ContextDescription({ className, children, ...props }: ContextDescriptionProps): import("react").JSX.Element;
38
+ export type ContextSummaryProps = ContextStyleProps<ComponentProps<"div">, ContextKnobStyle>;
39
+ export declare function ContextSummary({ className, children, ...props }: ContextSummaryProps): import("react").JSX.Element;
40
+ export type ContextGraphProps = ContextStyleProps<Omit<ComponentProps<"svg">, "children">, ContextKnobStyle>;
41
+ export declare function ContextGraph({ className, ...props }: ContextGraphProps): import("react").JSX.Element;
42
+ export type ContextLegendProps = ContextStyleProps<ComponentProps<"ul">, ContextKnobStyle>;
43
+ export declare function ContextLegend({ className, children, ...props }: ContextLegendProps): import("react").JSX.Element;
44
+ export type ContextCloseProps = ComponentProps<typeof Button>;
45
+ export declare function ContextClose({ variant, size, iconOnly, "aria-label": ariaLabel, className, children, ...props }: ContextCloseProps): import("react").JSX.Element;
46
+ //#endregion
@@ -1,19 +1,19 @@
1
1
  import { ComponentProps, ReactElement } from "react";
2
2
  //#region src/control-props.d.ts
3
- type FormSubmitEvent = Parameters<NonNullable<ComponentProps<"form">["onSubmit"]>>[0];
4
- type ControlledChoice<TValue extends string = string> = {
3
+ export type FormSubmitEvent = Parameters<NonNullable<ComponentProps<"form">["onSubmit"]>>[0];
4
+ export type ControlledChoice<TValue extends string = string> = {
5
5
  value?: TValue;
6
6
  defaultValue?: NoInfer<TValue>;
7
7
  onValueChange?: (value: TValue) => void;
8
8
  };
9
- type ControlledMultiChoice<TValue extends string = string> = {
9
+ export type ControlledMultiChoice<TValue extends string = string> = {
10
10
  value?: TValue[];
11
11
  defaultValue?: NoInfer<TValue>[];
12
12
  onValueChange?: (value: TValue[]) => void;
13
13
  };
14
- type RenderProp<Props, State extends Record<string, unknown> = Record<string, unknown>> = ReactElement | ((props: Props, state: State) => ReactElement<unknown>);
15
- type OpenChangeReason = "trigger-hover" | "trigger-focus" | "trigger-press" | "outside-press" | "escape-key" | "close-watcher" | "close-press" | "focus-out" | "list-navigation" | "item-press" | "sibling-open" | "cancel-open" | "input-change" | "input-clear" | "input-press" | "clear-press" | "chip-remove-press" | "imperative-action" | "swipe" | "none";
16
- type OpenChangeEventDetails = {
14
+ export type RenderProp<Props, State extends Record<string, unknown> = Record<string, unknown>> = ReactElement | ((props: Props, state: State) => ReactElement<unknown>);
15
+ export type OpenChangeReason = "trigger-hover" | "trigger-focus" | "trigger-press" | "outside-press" | "escape-key" | "close-watcher" | "close-press" | "focus-out" | "list-navigation" | "item-press" | "sibling-open" | "cancel-open" | "input-change" | "input-clear" | "input-press" | "clear-press" | "chip-remove-press" | "imperative-action" | "swipe" | "none";
16
+ export type OpenChangeEventDetails = {
17
17
  reason: OpenChangeReason;
18
18
  event: Event;
19
19
  cancel: () => void;
@@ -22,8 +22,7 @@ type OpenChangeEventDetails = {
22
22
  isPropagationAllowed: boolean;
23
23
  trigger: Element | undefined;
24
24
  };
25
- type SelectionIndicator = "none" | "slide";
26
- type HoverIndicator = "none" | "hover";
27
- declare const SIDEBAR_COOKIE_NAME = "sidebar_state";
28
- //#endregion
29
- export { ControlledChoice, ControlledMultiChoice, FormSubmitEvent, HoverIndicator, OpenChangeEventDetails, OpenChangeReason, RenderProp, SIDEBAR_COOKIE_NAME, SelectionIndicator };
25
+ export type SelectionIndicator = "none" | "slide";
26
+ export type HoverIndicator = "none" | "hover";
27
+ export declare const SIDEBAR_COOKIE_NAME = "sidebar_state";
28
+ //#endregion
@@ -1,8 +1,7 @@
1
1
  //#region src/control-variants.d.ts
2
- type ControlSize = "xs" | "sm" | "md" | "lg";
3
- declare const controlVariants: readonly ["solid", "surface", "ghost", "quiet"];
4
- type ControlVariant = (typeof controlVariants)[number];
5
- declare const controlTones: readonly ["neutral", "primary", "danger"];
6
- type ControlTone = (typeof controlTones)[number];
7
- //#endregion
8
- export { ControlSize, ControlTone, ControlVariant, controlTones, controlVariants };
2
+ export type ControlSize = "xs" | "sm" | "md" | "lg";
3
+ export declare const controlVariants: readonly ["solid", "surface", "ghost", "quiet"];
4
+ export type ControlVariant = (typeof controlVariants)[number];
5
+ export declare const controlTones: readonly ["neutral", "primary", "danger"];
6
+ export type ControlTone = (typeof controlTones)[number];
7
+ //#endregion
@@ -1,10 +1,9 @@
1
1
  //#region src/dynamic-notification-glass.d.ts
2
- type DynamicNotificationGlassOptions = {
2
+ export type DynamicNotificationGlassOptions = {
3
3
  /** Aurora strength 0..1 (default 1). */
4
4
  intensity?: number;
5
5
  /** devicePixelRatio clamp (default 2) — island is small, 2x is visually lossless. */
6
6
  maxDpr?: number;
7
7
  };
8
- declare function createDynamicNotificationGlass(canvas: HTMLCanvasElement, options?: DynamicNotificationGlassOptions): () => void;
9
- //#endregion
10
- export { DynamicNotificationGlassOptions, createDynamicNotificationGlass };
8
+ export declare function createDynamicNotificationGlass(canvas: HTMLCanvasElement, options?: DynamicNotificationGlassOptions): () => void;
9
+ //#endregion
@@ -1,5 +1,5 @@
1
1
  //#region src/dynamic-notification-liquid.d.ts
2
- type DynamicNotificationLiquidOptions = {
2
+ export type DynamicNotificationLiquidOptions = {
3
3
  /** Virtual lens depth (default 0.85) applied to size-derived inner edge profile. */
4
4
  refraction?: number;
5
5
  /** Chromatic aberration (default 0) — optional RGB separation; Apple does not expose it as material property. */
@@ -19,6 +19,5 @@ type DynamicNotificationLiquidOptions = {
19
19
  /** devicePixelRatio clamp (default 2). */
20
20
  maxDpr?: number;
21
21
  };
22
- declare function createDynamicNotificationLiquid(canvas: HTMLCanvasElement, options?: DynamicNotificationLiquidOptions): () => void;
23
- //#endregion
24
- export { DynamicNotificationLiquidOptions, createDynamicNotificationLiquid };
22
+ export declare function createDynamicNotificationLiquid(canvas: HTMLCanvasElement, options?: DynamicNotificationLiquidOptions): () => void;
23
+ //#endregion
@@ -1,4 +1,3 @@
1
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 };
2
+ export 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,8 +4,8 @@ import { DynamicNotificationKnobStyle } from "./knob-contracts/dynamic-notificat
4
4
  import { DynamicNotificationProps, DynamicNotificationVariant } from "./hooks/use-dynamic-notification.js";
5
5
  import { CSSProperties, ComponentProps } from "react";
6
6
  //#region src/dynamic-notification.d.ts
7
- type DynamicNotificationState = "collapsed" | "thinking" | "expanded";
8
- declare function useDynamicNotificationContext(): {
7
+ export type DynamicNotificationState = "collapsed" | "thinking" | "expanded";
8
+ export declare function useDynamicNotificationContext(): {
9
9
  open: boolean;
10
10
  disabled: boolean;
11
11
  setOpen: (nextOpen: boolean, reason: OpenChangeReason, event: Event, trigger?: Element) => void;
@@ -20,55 +20,54 @@ declare function useDynamicNotificationContext(): {
20
20
  variant: DynamicNotificationVariant;
21
21
  contentId: string;
22
22
  };
23
- declare function DynamicNotification({ open, defaultOpen, onOpenChange, loading, replyValue, defaultReplyValue, onReplyValueChange, onReply, variant, disabled, className, children, ...props }: DynamicNotificationProps): import("react").JSX.Element;
24
- type DynamicNotificationIslandProps = ComponentProps<"section"> & {
23
+ export declare function DynamicNotification({ open, defaultOpen, onOpenChange, loading, replyValue, defaultReplyValue, onReplyValueChange, onReply, variant, disabled, className, children, ...props }: DynamicNotificationProps): import("react").JSX.Element;
24
+ export type DynamicNotificationIslandProps = ComponentProps<"section"> & {
25
25
  style?: CSSProperties & DynamicNotificationKnobStyle;
26
26
  };
27
- declare function DynamicNotificationIsland({ className, onKeyDown, ...props }: DynamicNotificationIslandProps): import("react").JSX.Element;
28
- type DynamicNotificationGlassProps = ComponentProps<"canvas"> & {
27
+ export declare function DynamicNotificationIsland({ className, onKeyDown, ...props }: DynamicNotificationIslandProps): import("react").JSX.Element;
28
+ export type DynamicNotificationGlassProps = ComponentProps<"canvas"> & {
29
29
  style?: CSSProperties & DynamicNotificationKnobStyle;
30
30
  };
31
31
  /** Optional upgrade for variant="glass" — CSS fallback stays underneath. */
32
- declare function DynamicNotificationGlass({ className, ...props }: DynamicNotificationGlassProps): import("react").JSX.Element;
33
- type DynamicNotificationLiquidProps = ComponentProps<"canvas"> & {
32
+ export declare function DynamicNotificationGlass({ className, ...props }: DynamicNotificationGlassProps): import("react").JSX.Element;
33
+ export type DynamicNotificationLiquidProps = ComponentProps<"canvas"> & {
34
34
  style?: CSSProperties & DynamicNotificationKnobStyle;
35
35
  };
36
36
  /** WebGL transmits nearest scene through surface while keeping distortion concentrated at its edge. */
37
- declare function DynamicNotificationLiquid({ className, ...props }: DynamicNotificationLiquidProps): import("react").JSX.Element;
38
- type DynamicNotificationPillProps = ComponentProps<"button"> & {
37
+ export declare function DynamicNotificationLiquid({ className, ...props }: DynamicNotificationLiquidProps): import("react").JSX.Element;
38
+ export type DynamicNotificationPillProps = ComponentProps<"button"> & {
39
39
  style?: CSSProperties & DynamicNotificationKnobStyle;
40
40
  };
41
- declare function DynamicNotificationPill({ className, children, onClick, ...props }: DynamicNotificationPillProps): import("react").JSX.Element;
42
- type DynamicNotificationIndicatorProps = ComponentProps<"span"> & {
41
+ export declare function DynamicNotificationPill({ className, children, onClick, ...props }: DynamicNotificationPillProps): import("react").JSX.Element;
42
+ export type DynamicNotificationIndicatorProps = ComponentProps<"span"> & {
43
43
  style?: CSSProperties & DynamicNotificationKnobStyle;
44
44
  };
45
45
  /** Breathing orb marking assistant activity; dynamic-notification.css animates it. */
46
- declare function DynamicNotificationIndicator({ className, ...props }: DynamicNotificationIndicatorProps): import("react").JSX.Element;
47
- type DynamicNotificationContentProps = ComponentProps<"div"> & {
46
+ export declare function DynamicNotificationIndicator({ className, ...props }: DynamicNotificationIndicatorProps): import("react").JSX.Element;
47
+ export type DynamicNotificationContentProps = ComponentProps<"div"> & {
48
48
  style?: CSSProperties & DynamicNotificationKnobStyle;
49
49
  };
50
- declare function DynamicNotificationContent({ className, id, ...props }: DynamicNotificationContentProps): import("react").JSX.Element;
51
- type DynamicNotificationTitleProps = ComponentProps<"div"> & {
50
+ export declare function DynamicNotificationContent({ className, id, ...props }: DynamicNotificationContentProps): import("react").JSX.Element;
51
+ export type DynamicNotificationTitleProps = ComponentProps<"div"> & {
52
52
  style?: CSSProperties & DynamicNotificationKnobStyle;
53
53
  };
54
- declare function DynamicNotificationTitle({ className, ...props }: DynamicNotificationTitleProps): import("react").JSX.Element;
55
- type DynamicNotificationMessageProps = Omit<ComponentProps<"p">, "children"> & {
54
+ export declare function DynamicNotificationTitle({ className, ...props }: DynamicNotificationTitleProps): import("react").JSX.Element;
55
+ export type DynamicNotificationMessageProps = Omit<ComponentProps<"p">, "children"> & {
56
56
  children: string;
57
57
  } & {
58
58
  style?: CSSProperties & DynamicNotificationKnobStyle;
59
59
  };
60
- declare function DynamicNotificationMessage({ className, children, ...props }: DynamicNotificationMessageProps): import("react").JSX.Element;
61
- type DynamicNotificationReplyProps = ComponentProps<"form"> & {
60
+ export declare function DynamicNotificationMessage({ className, children, ...props }: DynamicNotificationMessageProps): import("react").JSX.Element;
61
+ export type DynamicNotificationReplyProps = ComponentProps<"form"> & {
62
62
  style?: CSSProperties & DynamicNotificationKnobStyle;
63
63
  };
64
- declare function DynamicNotificationReply({ className, onSubmit, ...props }: DynamicNotificationReplyProps): import("react").JSX.Element;
65
- type DynamicNotificationReplyInputProps = ComponentProps<"input"> & {
64
+ export declare function DynamicNotificationReply({ className, onSubmit, ...props }: DynamicNotificationReplyProps): import("react").JSX.Element;
65
+ export type DynamicNotificationReplyInputProps = ComponentProps<"input"> & {
66
66
  style?: CSSProperties & DynamicNotificationKnobStyle;
67
67
  };
68
- declare function DynamicNotificationReplyInput({ className, onChange, disabled, ...props }: DynamicNotificationReplyInputProps): import("react").JSX.Element;
69
- type DynamicNotificationReplySubmitProps = ComponentProps<typeof Button>;
70
- declare function DynamicNotificationReplySubmit({ className, disabled, children, ...props }: DynamicNotificationReplySubmitProps): import("react").JSX.Element;
71
- type DynamicNotificationCloseProps = ComponentProps<typeof Button>;
72
- declare function DynamicNotificationClose({ className, children, onClick, ...props }: DynamicNotificationCloseProps): import("react").JSX.Element;
73
- //#endregion
74
- export { DynamicNotification, DynamicNotificationClose, DynamicNotificationCloseProps, DynamicNotificationContent, DynamicNotificationContentProps, DynamicNotificationGlass, DynamicNotificationGlassProps, DynamicNotificationIndicator, DynamicNotificationIndicatorProps, DynamicNotificationIsland, DynamicNotificationIslandProps, DynamicNotificationLiquid, DynamicNotificationLiquidProps, DynamicNotificationMessage, DynamicNotificationMessageProps, DynamicNotificationPill, DynamicNotificationPillProps, DynamicNotificationReply, DynamicNotificationReplyInput, DynamicNotificationReplyInputProps, DynamicNotificationReplyProps, DynamicNotificationReplySubmit, DynamicNotificationReplySubmitProps, DynamicNotificationState, DynamicNotificationTitle, DynamicNotificationTitleProps, useDynamicNotificationContext };
68
+ export declare function DynamicNotificationReplyInput({ className, onChange, disabled, ...props }: DynamicNotificationReplyInputProps): import("react").JSX.Element;
69
+ export type DynamicNotificationReplySubmitProps = ComponentProps<typeof Button>;
70
+ 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;
73
+ //#endregion
@@ -2,7 +2,7 @@ import { EmailTheme } from "./theme.js";
2
2
  import { ReactNode } from "react";
3
3
  import { ButtonProps, HeadingProps, LinkProps, TextProps } from "react-email";
4
4
  //#region src/email/email.d.ts
5
- declare function EmailLayout({ theme, preview, children, head, lang, dir }: {
5
+ export declare function EmailLayout({ theme, preview, children, head, lang, dir }: {
6
6
  theme: EmailTheme;
7
7
  preview: string;
8
8
  children: ReactNode;
@@ -16,13 +16,12 @@ declare const headingClasses: {
16
16
  h3: string;
17
17
  h4: string;
18
18
  };
19
- declare function EmailHeading({ as, className, ...props }: Omit<HeadingProps, "as"> & {
19
+ export declare function EmailHeading({ as, className, ...props }: Omit<HeadingProps, "as"> & {
20
20
  as?: keyof typeof headingClasses;
21
21
  }): import("react").JSX.Element;
22
- declare function EmailText({ tone, className, style, ...props }: TextProps & {
22
+ export declare function EmailText({ tone, className, style, ...props }: TextProps & {
23
23
  tone?: "default" | "muted";
24
24
  }): import("react").JSX.Element;
25
- declare function EmailButton({ className, ...props }: ButtonProps): import("react").JSX.Element;
26
- declare function EmailLink({ className, ...props }: LinkProps): import("react").JSX.Element;
27
- //#endregion
28
- export { EmailButton, EmailHeading, EmailLayout, EmailLink, EmailText };
25
+ export declare function EmailButton({ className, ...props }: ButtonProps): import("react").JSX.Element;
26
+ export declare function EmailLink({ className, ...props }: LinkProps): import("react").JSX.Element;
27
+ //#endregion
@@ -6,11 +6,20 @@ function tailwindTheme(theme) {
6
6
  presets: [pixelBasedPreset],
7
7
  theme: { extend: {
8
8
  colors: theme.colors,
9
+ borderRadius: theme.radii,
10
+ minHeight: { control: theme.button.height },
11
+ padding: {
12
+ "control-x": theme.button.paddingInline,
13
+ "control-y": theme.button.paddingBlock
14
+ },
9
15
  fontFamily: {
10
16
  body: theme.fonts.body,
11
17
  display: theme.fonts.display
12
18
  },
13
- fontSize: Object.fromEntries(Object.entries(theme.text).map(([name, { fontSize, ...options }]) => [name, [fontSize, options]]))
19
+ fontSize: {
20
+ ...Object.fromEntries(Object.entries(theme.text).map(([name, { fontSize, ...options }]) => [name, [fontSize, options]])),
21
+ control: [theme.button.fontSize, { lineHeight: theme.button.lineHeight }]
22
+ }
14
23
  } }
15
24
  };
16
25
  }
@@ -23,7 +32,7 @@ function EmailLayout({ theme, preview, children, head, lang = "en", dir = "ltr"
23
32
  children: [/* @__PURE__ */ jsx(Head, { children: head }), /* @__PURE__ */ jsxs(Body, {
24
33
  className: "m-0 bg-background p-4 font-body text-body text-foreground",
25
34
  children: [/* @__PURE__ */ jsx(Preview, { children: preview }), /* @__PURE__ */ jsx(Container, {
26
- className: "mx-auto w-full max-w-[600px] bg-card p-6 text-card-foreground",
35
+ className: "mx-auto w-full max-w-[600px] rounded-panel bg-card p-6 text-card-foreground",
27
36
  children
28
37
  })]
29
38
  })]
@@ -57,7 +66,7 @@ function EmailText({ tone = "default", className = "", style, ...props }) {
57
66
  function EmailButton({ className = "", ...props }) {
58
67
  return /* @__PURE__ */ jsx(Button, {
59
68
  ...props,
60
- className: `box-border bg-primary px-5 py-3 text-center font-body text-body font-semibold text-primary-foreground no-underline ${className}`
69
+ className: `box-border min-h-control rounded-control bg-primary px-control-x py-control-y text-center font-body text-control font-medium text-primary-foreground no-underline ${className}`
61
70
  });
62
71
  }
63
72
  function EmailLink({ className = "", ...props }) {
@@ -0,0 +1,3 @@
1
+ //#region src/email/length.d.ts
2
+ export declare function emailLengthPixels(name: string, value: string, rootFontSize: number, allowZero?: boolean): number;
3
+ //#endregion
@@ -0,0 +1,34 @@
1
+ //#region src/email/length.ts
2
+ function parseLengthQuantity(value, rootFontSize) {
3
+ const match = /^(-?\d*\.?\d+)(px|rem)?$/.exec(value.trim());
4
+ if (!match) return null;
5
+ return {
6
+ amount: Number(match[1]) * (match[2] === "rem" ? rootFontSize : 1),
7
+ unit: match[2] ? "px" : ""
8
+ };
9
+ }
10
+ function calculateLengthExpression(expression, rootFontSize) {
11
+ const match = /^\s*(-?\d*\.?\d+(?:px|rem)?)\s*([+*/-])\s*(-?\d*\.?\d+(?:px|rem)?)\s*$/.exec(expression);
12
+ if (!match) return null;
13
+ const left = parseLengthQuantity(match[1], rootFontSize);
14
+ const right = parseLengthQuantity(match[3], rootFontSize);
15
+ if (!left || !right) return null;
16
+ const operator = match[2];
17
+ if ((operator === "+" || operator === "-") && left.unit === right.unit) return `${left.amount + (operator === "+" ? right.amount : -right.amount)}${left.unit}`;
18
+ if (operator === "*" && !(left.unit && right.unit)) return `${left.amount * right.amount}${left.unit || right.unit}`;
19
+ if (operator === "/" && !right.unit && right.amount !== 0) return `${left.amount / right.amount}${left.unit}`;
20
+ return null;
21
+ }
22
+ function emailLengthPixels(name, value, rootFontSize, allowZero = false) {
23
+ let resolved = value;
24
+ for (let depth = 0; depth < 16 && resolved.includes("calc("); depth++) {
25
+ const simplified = resolved.replace(/calc\(([^()]*)\)/g, (original, expression) => calculateLengthExpression(expression, rootFontSize) ?? original);
26
+ if (simplified === resolved) break;
27
+ resolved = simplified;
28
+ }
29
+ const result = parseLengthQuantity(resolved, rootFontSize);
30
+ if (!(result && (result.unit === "px" || result.amount === 0) && Number.isFinite(result.amount) && (allowZero ? result.amount >= 0 : result.amount > 0))) throw new Error(`Email theme: ${name} must resolve to a ${allowZero ? "non-negative" : "positive"} px/rem length, received ${value}.`);
31
+ return result.amount;
32
+ }
33
+ //#endregion
34
+ export { emailLengthPixels };