@moldable-ai/ui 0.2.19 → 0.2.21

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 (464) hide show
  1. package/dist/catalog/catalog-coverage.d.ts +15 -0
  2. package/dist/catalog/catalog-coverage.d.ts.map +1 -0
  3. package/dist/catalog/catalog-coverage.js +44 -0
  4. package/dist/catalog/catalog-manifest.d.ts +6 -0
  5. package/dist/catalog/catalog-manifest.d.ts.map +1 -0
  6. package/dist/catalog/catalog-manifest.js +117 -0
  7. package/dist/catalog/catalog-types.d.ts +64 -0
  8. package/dist/catalog/catalog-types.d.ts.map +1 -0
  9. package/dist/catalog/catalog-types.js +20 -0
  10. package/dist/catalog/component-catalog.d.ts +14 -0
  11. package/dist/catalog/component-catalog.d.ts.map +1 -0
  12. package/dist/catalog/component-catalog.js +49 -0
  13. package/dist/catalog/core-catalog-exclusions.d.ts +8 -0
  14. package/dist/catalog/core-catalog-exclusions.d.ts.map +1 -0
  15. package/dist/catalog/core-catalog-exclusions.js +151 -0
  16. package/dist/catalog/core-catalog.d.ts +2 -0
  17. package/dist/catalog/core-catalog.d.ts.map +1 -0
  18. package/dist/catalog/core-catalog.js +19 -0
  19. package/dist/catalog/core-collection-stories.d.ts +3 -0
  20. package/dist/catalog/core-collection-stories.d.ts.map +1 -0
  21. package/dist/catalog/core-collection-stories.js +42 -0
  22. package/dist/catalog/core-control-stories.d.ts +3 -0
  23. package/dist/catalog/core-control-stories.d.ts.map +1 -0
  24. package/dist/catalog/core-control-stories.js +94 -0
  25. package/dist/catalog/core-feedback-stories.d.ts +3 -0
  26. package/dist/catalog/core-feedback-stories.d.ts.map +1 -0
  27. package/dist/catalog/core-feedback-stories.js +50 -0
  28. package/dist/catalog/core-foundation-stories.d.ts +3 -0
  29. package/dist/catalog/core-foundation-stories.d.ts.map +1 -0
  30. package/dist/catalog/core-foundation-stories.js +53 -0
  31. package/dist/catalog/core-navigation-stories.d.ts +3 -0
  32. package/dist/catalog/core-navigation-stories.d.ts.map +1 -0
  33. package/dist/catalog/core-navigation-stories.js +25 -0
  34. package/dist/catalog/core-overlay-stories.d.ts +3 -0
  35. package/dist/catalog/core-overlay-stories.d.ts.map +1 -0
  36. package/dist/catalog/core-overlay-stories.js +20 -0
  37. package/dist/catalog/index.d.ts +7 -0
  38. package/dist/catalog/index.d.ts.map +1 -0
  39. package/dist/catalog/index.js +6 -0
  40. package/dist/components/app-error-boundary.d.ts +1 -0
  41. package/dist/components/app-error-boundary.d.ts.map +1 -1
  42. package/dist/components/app-error-boundary.js +13 -0
  43. package/dist/components/chat/chat-image-lightbox.d.ts +9 -0
  44. package/dist/components/chat/chat-image-lightbox.d.ts.map +1 -0
  45. package/dist/components/chat/chat-image-lightbox.js +9 -0
  46. package/dist/components/chat/chat-message.d.ts +19 -1
  47. package/dist/components/chat/chat-message.d.ts.map +1 -1
  48. package/dist/components/chat/chat-message.js +66 -16
  49. package/dist/components/chat/chat-messages.d.ts +5 -2
  50. package/dist/components/chat/chat-messages.d.ts.map +1 -1
  51. package/dist/components/chat/chat-messages.js +61 -6
  52. package/dist/components/chat/chat-panel.d.ts +49 -6
  53. package/dist/components/chat/chat-panel.d.ts.map +1 -1
  54. package/dist/components/chat/chat-panel.js +196 -163
  55. package/dist/components/chat/conversation-history.d.ts +39 -5
  56. package/dist/components/chat/conversation-history.d.ts.map +1 -1
  57. package/dist/components/chat/conversation-history.js +192 -26
  58. package/dist/components/chat/index.d.ts +2 -2
  59. package/dist/components/chat/index.d.ts.map +1 -1
  60. package/dist/components/chat/index.js +1 -1
  61. package/dist/components/chat/tool-handlers.d.ts.map +1 -1
  62. package/dist/components/chat/tool-handlers.js +40 -2
  63. package/dist/components/chat/vertical-scroll-fade.d.ts +6 -0
  64. package/dist/components/chat/vertical-scroll-fade.d.ts.map +1 -0
  65. package/dist/components/chat/vertical-scroll-fade.js +12 -0
  66. package/dist/components/native-capabilities/bluetooth-panel-helpers.d.ts +9 -0
  67. package/dist/components/native-capabilities/bluetooth-panel-helpers.d.ts.map +1 -0
  68. package/dist/components/native-capabilities/bluetooth-panel-helpers.js +37 -0
  69. package/dist/components/native-capabilities/bluetooth-panel.d.ts +56 -0
  70. package/dist/components/native-capabilities/bluetooth-panel.d.ts.map +1 -0
  71. package/dist/components/native-capabilities/bluetooth-panel.js +470 -0
  72. package/dist/components/native-capabilities/camera-preview.d.ts +39 -0
  73. package/dist/components/native-capabilities/camera-preview.d.ts.map +1 -0
  74. package/dist/components/native-capabilities/camera-preview.js +228 -0
  75. package/dist/components/native-capabilities/capability-badge.d.ts +23 -0
  76. package/dist/components/native-capabilities/capability-badge.d.ts.map +1 -0
  77. package/dist/components/native-capabilities/capability-badge.js +39 -0
  78. package/dist/components/native-capabilities/capability-matrix.d.ts +14 -0
  79. package/dist/components/native-capabilities/capability-matrix.d.ts.map +1 -0
  80. package/dist/components/native-capabilities/capability-matrix.js +97 -0
  81. package/dist/components/native-capabilities/clipboard-button.d.ts +26 -0
  82. package/dist/components/native-capabilities/clipboard-button.d.ts.map +1 -0
  83. package/dist/components/native-capabilities/clipboard-button.js +99 -0
  84. package/dist/components/native-capabilities/device-io-controls.d.ts +4 -0
  85. package/dist/components/native-capabilities/device-io-controls.d.ts.map +1 -0
  86. package/dist/components/native-capabilities/device-io-controls.js +28 -0
  87. package/dist/components/native-capabilities/device-list.d.ts +20 -0
  88. package/dist/components/native-capabilities/device-list.d.ts.map +1 -0
  89. package/dist/components/native-capabilities/device-list.js +14 -0
  90. package/dist/components/native-capabilities/display-map.d.ts +23 -0
  91. package/dist/components/native-capabilities/display-map.d.ts.map +1 -0
  92. package/dist/components/native-capabilities/display-map.js +114 -0
  93. package/dist/components/native-capabilities/haptic-button.d.ts +26 -0
  94. package/dist/components/native-capabilities/haptic-button.d.ts.map +1 -0
  95. package/dist/components/native-capabilities/haptic-button.js +94 -0
  96. package/dist/components/native-capabilities/hid-panel.d.ts +40 -0
  97. package/dist/components/native-capabilities/hid-panel.d.ts.map +1 -0
  98. package/dist/components/native-capabilities/hid-panel.js +373 -0
  99. package/dist/components/native-capabilities/index.d.ts +27 -0
  100. package/dist/components/native-capabilities/index.d.ts.map +1 -0
  101. package/dist/components/native-capabilities/index.js +26 -0
  102. package/dist/components/native-capabilities/live-indicator.d.ts +15 -0
  103. package/dist/components/native-capabilities/live-indicator.d.ts.map +1 -0
  104. package/dist/components/native-capabilities/live-indicator.js +26 -0
  105. package/dist/components/native-capabilities/local-auth-button.d.ts +33 -0
  106. package/dist/components/native-capabilities/local-auth-button.d.ts.map +1 -0
  107. package/dist/components/native-capabilities/local-auth-button.js +115 -0
  108. package/dist/components/native-capabilities/location-panel.d.ts +29 -0
  109. package/dist/components/native-capabilities/location-panel.d.ts.map +1 -0
  110. package/dist/components/native-capabilities/location-panel.js +146 -0
  111. package/dist/components/native-capabilities/microphone-meter.d.ts +35 -0
  112. package/dist/components/native-capabilities/microphone-meter.d.ts.map +1 -0
  113. package/dist/components/native-capabilities/microphone-meter.js +244 -0
  114. package/dist/components/native-capabilities/midi-monitor.d.ts +54 -0
  115. package/dist/components/native-capabilities/midi-monitor.d.ts.map +1 -0
  116. package/dist/components/native-capabilities/midi-monitor.js +534 -0
  117. package/dist/components/native-capabilities/native-capability-panel.d.ts +11 -0
  118. package/dist/components/native-capabilities/native-capability-panel.d.ts.map +1 -0
  119. package/dist/components/native-capabilities/native-capability-panel.js +28 -0
  120. package/dist/components/native-capabilities/notification-panel.d.ts +24 -0
  121. package/dist/components/native-capabilities/notification-panel.d.ts.map +1 -0
  122. package/dist/components/native-capabilities/notification-panel.js +124 -0
  123. package/dist/components/native-capabilities/power-blocker-controller.d.ts +19 -0
  124. package/dist/components/native-capabilities/power-blocker-controller.d.ts.map +1 -0
  125. package/dist/components/native-capabilities/power-blocker-controller.js +83 -0
  126. package/dist/components/native-capabilities/power-panel.d.ts +67 -0
  127. package/dist/components/native-capabilities/power-panel.d.ts.map +1 -0
  128. package/dist/components/native-capabilities/power-panel.js +309 -0
  129. package/dist/components/native-capabilities/readout.d.ts +10 -0
  130. package/dist/components/native-capabilities/readout.d.ts.map +1 -0
  131. package/dist/components/native-capabilities/readout.js +11 -0
  132. package/dist/components/native-capabilities/screen-share-preview.d.ts +36 -0
  133. package/dist/components/native-capabilities/screen-share-preview.d.ts.map +1 -0
  134. package/dist/components/native-capabilities/screen-share-preview.js +191 -0
  135. package/dist/components/native-capabilities/secure-storage-panel.d.ts +36 -0
  136. package/dist/components/native-capabilities/secure-storage-panel.d.ts.map +1 -0
  137. package/dist/components/native-capabilities/secure-storage-panel.js +193 -0
  138. package/dist/components/native-capabilities/serial-console.d.ts +64 -0
  139. package/dist/components/native-capabilities/serial-console.d.ts.map +1 -0
  140. package/dist/components/native-capabilities/serial-console.js +399 -0
  141. package/dist/components/native-capabilities/shortcut-recorder.d.ts +35 -0
  142. package/dist/components/native-capabilities/shortcut-recorder.d.ts.map +1 -0
  143. package/dist/components/native-capabilities/shortcut-recorder.js +217 -0
  144. package/dist/components/native-capabilities/stream-log.d.ts +35 -0
  145. package/dist/components/native-capabilities/stream-log.d.ts.map +1 -0
  146. package/dist/components/native-capabilities/stream-log.js +65 -0
  147. package/dist/components/native-capabilities/system-audio-monitor.d.ts +34 -0
  148. package/dist/components/native-capabilities/system-audio-monitor.d.ts.map +1 -0
  149. package/dist/components/native-capabilities/system-audio-monitor.js +275 -0
  150. package/dist/components/native-capabilities/usb-panel.d.ts +54 -0
  151. package/dist/components/native-capabilities/usb-panel.d.ts.map +1 -0
  152. package/dist/components/native-capabilities/usb-panel.js +363 -0
  153. package/dist/components/native-capabilities/use-capability.d.ts +20 -0
  154. package/dist/components/native-capabilities/use-capability.d.ts.map +1 -0
  155. package/dist/components/native-capabilities/use-capability.js +61 -0
  156. package/dist/components/ui/alert-dialog.d.ts +7 -3
  157. package/dist/components/ui/alert-dialog.d.ts.map +1 -1
  158. package/dist/components/ui/alert-dialog.js +9 -5
  159. package/dist/components/ui/alert.d.ts +19 -3
  160. package/dist/components/ui/alert.d.ts.map +1 -1
  161. package/dist/components/ui/alert.js +25 -8
  162. package/dist/components/ui/app-frame.d.ts +28 -0
  163. package/dist/components/ui/app-frame.d.ts.map +1 -0
  164. package/dist/components/ui/app-frame.js +95 -0
  165. package/dist/components/ui/button-group.d.ts +1 -1
  166. package/dist/components/ui/button.js +1 -1
  167. package/dist/components/ui/collapsible.d.ts +9 -1
  168. package/dist/components/ui/collapsible.d.ts.map +1 -1
  169. package/dist/components/ui/collapsible.js +13 -2
  170. package/dist/components/ui/collection-navigation.d.ts +8 -0
  171. package/dist/components/ui/collection-navigation.d.ts.map +1 -0
  172. package/dist/components/ui/collection-navigation.js +19 -0
  173. package/dist/components/ui/color-well.d.ts +13 -0
  174. package/dist/components/ui/color-well.d.ts.map +1 -0
  175. package/dist/components/ui/color-well.js +30 -0
  176. package/dist/components/ui/command.d.ts +5 -1
  177. package/dist/components/ui/command.d.ts.map +1 -1
  178. package/dist/components/ui/command.js +13 -1
  179. package/dist/components/ui/confirm-dialog.d.ts +19 -0
  180. package/dist/components/ui/confirm-dialog.d.ts.map +1 -0
  181. package/dist/components/ui/confirm-dialog.js +45 -0
  182. package/dist/components/ui/date-field.d.ts +19 -0
  183. package/dist/components/ui/date-field.d.ts.map +1 -0
  184. package/dist/components/ui/date-field.js +54 -0
  185. package/dist/components/ui/date-picker.d.ts +24 -0
  186. package/dist/components/ui/date-picker.d.ts.map +1 -0
  187. package/dist/components/ui/date-picker.js +92 -0
  188. package/dist/components/ui/dialog.d.ts +4 -2
  189. package/dist/components/ui/dialog.d.ts.map +1 -1
  190. package/dist/components/ui/dialog.js +8 -5
  191. package/dist/components/ui/edge-fade.d.ts +11 -0
  192. package/dist/components/ui/edge-fade.d.ts.map +1 -0
  193. package/dist/components/ui/edge-fade.js +41 -0
  194. package/dist/components/ui/empty.d.ts +7 -2
  195. package/dist/components/ui/empty.d.ts.map +1 -1
  196. package/dist/components/ui/empty.js +20 -7
  197. package/dist/components/ui/field.d.ts +1 -1
  198. package/dist/components/ui/grid.d.ts +24 -0
  199. package/dist/components/ui/grid.d.ts.map +1 -0
  200. package/dist/components/ui/grid.js +258 -0
  201. package/dist/components/ui/icon-button.d.ts +15 -0
  202. package/dist/components/ui/icon-button.d.ts.map +1 -0
  203. package/dist/components/ui/icon-button.js +15 -0
  204. package/dist/components/ui/index.d.ts +23 -0
  205. package/dist/components/ui/index.d.ts.map +1 -1
  206. package/dist/components/ui/index.js +23 -0
  207. package/dist/components/ui/input-group.d.ts +1 -1
  208. package/dist/components/ui/inspector.d.ts +15 -0
  209. package/dist/components/ui/inspector.d.ts.map +1 -0
  210. package/dist/components/ui/inspector.js +26 -0
  211. package/dist/components/ui/kbd.d.ts +1 -1
  212. package/dist/components/ui/list.d.ts +28 -0
  213. package/dist/components/ui/list.d.ts.map +1 -0
  214. package/dist/components/ui/list.js +235 -0
  215. package/dist/components/ui/material.d.ts +34 -0
  216. package/dist/components/ui/material.d.ts.map +1 -0
  217. package/dist/components/ui/material.js +34 -0
  218. package/dist/components/ui/message-scroller-controller.d.ts +162 -0
  219. package/dist/components/ui/message-scroller-controller.d.ts.map +1 -0
  220. package/dist/components/ui/message-scroller-controller.js +888 -0
  221. package/dist/components/ui/message-scroller-layout-stability.d.ts +33 -0
  222. package/dist/components/ui/message-scroller-layout-stability.d.ts.map +1 -0
  223. package/dist/components/ui/message-scroller-layout-stability.js +153 -0
  224. package/dist/components/ui/message-scroller-policy.d.ts +74 -0
  225. package/dist/components/ui/message-scroller-policy.d.ts.map +1 -0
  226. package/dist/components/ui/message-scroller-policy.js +129 -0
  227. package/dist/components/ui/message-scroller-primitive.d.ts +55 -0
  228. package/dist/components/ui/message-scroller-primitive.d.ts.map +1 -0
  229. package/dist/components/ui/message-scroller-primitive.js +226 -0
  230. package/dist/components/ui/message-scroller.d.ts +11 -0
  231. package/dist/components/ui/message-scroller.d.ts.map +1 -0
  232. package/dist/components/ui/message-scroller.js +25 -0
  233. package/dist/components/ui/navigation-button-group.d.ts +16 -0
  234. package/dist/components/ui/navigation-button-group.d.ts.map +1 -0
  235. package/dist/components/ui/navigation-button-group.js +9 -0
  236. package/dist/components/ui/notification-dot.d.ts +4 -0
  237. package/dist/components/ui/notification-dot.d.ts.map +1 -0
  238. package/dist/components/ui/notification-dot.js +7 -0
  239. package/dist/components/ui/number-input.d.ts +16 -0
  240. package/dist/components/ui/number-input.d.ts.map +1 -0
  241. package/dist/components/ui/number-input.js +56 -0
  242. package/dist/components/ui/panel.d.ts +18 -0
  243. package/dist/components/ui/panel.d.ts.map +1 -0
  244. package/dist/components/ui/panel.js +40 -0
  245. package/dist/components/ui/popover.d.ts +9 -2
  246. package/dist/components/ui/popover.d.ts.map +1 -1
  247. package/dist/components/ui/popover.js +14 -4
  248. package/dist/components/ui/scroll-area.d.ts +8 -2
  249. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  250. package/dist/components/ui/scroll-area.js +6 -3
  251. package/dist/components/ui/search-field.d.ts +19 -0
  252. package/dist/components/ui/search-field.d.ts.map +1 -0
  253. package/dist/components/ui/search-field.js +64 -0
  254. package/dist/components/ui/segmented-control.d.ts +21 -0
  255. package/dist/components/ui/segmented-control.d.ts.map +1 -0
  256. package/dist/components/ui/segmented-control.js +62 -0
  257. package/dist/components/ui/sheet.d.ts +4 -2
  258. package/dist/components/ui/sheet.d.ts.map +1 -1
  259. package/dist/components/ui/sheet.js +12 -9
  260. package/dist/components/ui/sidebar.js +1 -1
  261. package/dist/components/ui/sonner.d.ts +4 -3
  262. package/dist/components/ui/sonner.d.ts.map +1 -1
  263. package/dist/components/ui/sonner.js +7 -6
  264. package/dist/components/ui/split-view.d.ts +11 -0
  265. package/dist/components/ui/split-view.d.ts.map +1 -0
  266. package/dist/components/ui/split-view.js +13 -0
  267. package/dist/components/ui/status.d.ts +13 -0
  268. package/dist/components/ui/status.d.ts.map +1 -0
  269. package/dist/components/ui/status.js +36 -0
  270. package/dist/components/ui/table.d.ts +11 -2
  271. package/dist/components/ui/table.d.ts.map +1 -1
  272. package/dist/components/ui/table.js +33 -6
  273. package/dist/components/ui/text.d.ts +17 -0
  274. package/dist/components/ui/text.d.ts.map +1 -0
  275. package/dist/components/ui/text.js +55 -0
  276. package/dist/components/ui/toggle.d.ts +12 -4
  277. package/dist/components/ui/toggle.d.ts.map +1 -1
  278. package/dist/components/ui/toggle.js +13 -2
  279. package/dist/components/ui/toolbar.d.ts +27 -0
  280. package/dist/components/ui/toolbar.d.ts.map +1 -0
  281. package/dist/components/ui/toolbar.js +71 -0
  282. package/dist/components/ui/tooltip.d.ts +8 -3
  283. package/dist/components/ui/tooltip.d.ts.map +1 -1
  284. package/dist/components/ui/tooltip.js +11 -6
  285. package/dist/index.d.ts +2 -2
  286. package/dist/index.d.ts.map +1 -1
  287. package/dist/index.js +4 -4
  288. package/dist/lib/frame-lifecycle.d.ts +29 -0
  289. package/dist/lib/frame-lifecycle.d.ts.map +1 -1
  290. package/dist/lib/frame-lifecycle.js +85 -0
  291. package/dist/lib/native-capabilities/access.d.ts +13 -0
  292. package/dist/lib/native-capabilities/access.d.ts.map +1 -0
  293. package/dist/lib/native-capabilities/access.js +53 -0
  294. package/dist/lib/native-capabilities/bluetooth-access.d.ts +14 -0
  295. package/dist/lib/native-capabilities/bluetooth-access.d.ts.map +1 -0
  296. package/dist/lib/native-capabilities/bluetooth-access.js +43 -0
  297. package/dist/lib/native-capabilities/bluetooth-connection.d.ts +19 -0
  298. package/dist/lib/native-capabilities/bluetooth-connection.d.ts.map +1 -0
  299. package/dist/lib/native-capabilities/bluetooth-connection.js +88 -0
  300. package/dist/lib/native-capabilities/bluetooth-gatt.d.ts +7 -0
  301. package/dist/lib/native-capabilities/bluetooth-gatt.d.ts.map +1 -0
  302. package/dist/lib/native-capabilities/bluetooth-gatt.js +77 -0
  303. package/dist/lib/native-capabilities/bluetooth-internal.d.ts +10 -0
  304. package/dist/lib/native-capabilities/bluetooth-internal.d.ts.map +1 -0
  305. package/dist/lib/native-capabilities/bluetooth-internal.js +105 -0
  306. package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts +33 -0
  307. package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts.map +1 -0
  308. package/dist/lib/native-capabilities/bluetooth-native-fallback.js +214 -0
  309. package/dist/lib/native-capabilities/bluetooth-types.d.ts +85 -0
  310. package/dist/lib/native-capabilities/bluetooth-types.d.ts.map +1 -0
  311. package/dist/lib/native-capabilities/bluetooth-types.js +2 -0
  312. package/dist/lib/native-capabilities/bluetooth.d.ts +7 -0
  313. package/dist/lib/native-capabilities/bluetooth.d.ts.map +1 -0
  314. package/dist/lib/native-capabilities/bluetooth.js +4 -0
  315. package/dist/lib/native-capabilities/bridge.d.ts +23 -0
  316. package/dist/lib/native-capabilities/bridge.d.ts.map +1 -0
  317. package/dist/lib/native-capabilities/bridge.js +266 -0
  318. package/dist/lib/native-capabilities/capabilities.d.ts +7 -0
  319. package/dist/lib/native-capabilities/capabilities.d.ts.map +1 -0
  320. package/dist/lib/native-capabilities/capabilities.js +95 -0
  321. package/dist/lib/native-capabilities/clipboard.d.ts +11 -0
  322. package/dist/lib/native-capabilities/clipboard.d.ts.map +1 -0
  323. package/dist/lib/native-capabilities/clipboard.js +58 -0
  324. package/dist/lib/native-capabilities/device-io-errors.d.ts +11 -0
  325. package/dist/lib/native-capabilities/device-io-errors.d.ts.map +1 -0
  326. package/dist/lib/native-capabilities/device-io-errors.js +82 -0
  327. package/dist/lib/native-capabilities/displays.d.ts +38 -0
  328. package/dist/lib/native-capabilities/displays.d.ts.map +1 -0
  329. package/dist/lib/native-capabilities/displays.js +12 -0
  330. package/dist/lib/native-capabilities/global-shortcuts.d.ts +86 -0
  331. package/dist/lib/native-capabilities/global-shortcuts.d.ts.map +1 -0
  332. package/dist/lib/native-capabilities/global-shortcuts.js +351 -0
  333. package/dist/lib/native-capabilities/haptics.d.ts +25 -0
  334. package/dist/lib/native-capabilities/haptics.d.ts.map +1 -0
  335. package/dist/lib/native-capabilities/haptics.js +18 -0
  336. package/dist/lib/native-capabilities/hid-native.d.ts +26 -0
  337. package/dist/lib/native-capabilities/hid-native.d.ts.map +1 -0
  338. package/dist/lib/native-capabilities/hid-native.js +229 -0
  339. package/dist/lib/native-capabilities/hid.d.ts +52 -0
  340. package/dist/lib/native-capabilities/hid.d.ts.map +1 -0
  341. package/dist/lib/native-capabilities/hid.js +163 -0
  342. package/dist/lib/native-capabilities/index.d.ts +40 -0
  343. package/dist/lib/native-capabilities/index.d.ts.map +1 -0
  344. package/dist/lib/native-capabilities/index.js +21 -0
  345. package/dist/lib/native-capabilities/local-authentication.d.ts +32 -0
  346. package/dist/lib/native-capabilities/local-authentication.d.ts.map +1 -0
  347. package/dist/lib/native-capabilities/local-authentication.js +46 -0
  348. package/dist/lib/native-capabilities/location.d.ts +49 -0
  349. package/dist/lib/native-capabilities/location.d.ts.map +1 -0
  350. package/dist/lib/native-capabilities/location.js +114 -0
  351. package/dist/lib/native-capabilities/media-permissions.d.ts +28 -0
  352. package/dist/lib/native-capabilities/media-permissions.d.ts.map +1 -0
  353. package/dist/lib/native-capabilities/media-permissions.js +37 -0
  354. package/dist/lib/native-capabilities/media.d.ts +17 -0
  355. package/dist/lib/native-capabilities/media.d.ts.map +1 -0
  356. package/dist/lib/native-capabilities/media.js +104 -0
  357. package/dist/lib/native-capabilities/midi-access.d.ts +13 -0
  358. package/dist/lib/native-capabilities/midi-access.d.ts.map +1 -0
  359. package/dist/lib/native-capabilities/midi-access.js +68 -0
  360. package/dist/lib/native-capabilities/midi-internal.d.ts +12 -0
  361. package/dist/lib/native-capabilities/midi-internal.d.ts.map +1 -0
  362. package/dist/lib/native-capabilities/midi-internal.js +88 -0
  363. package/dist/lib/native-capabilities/midi-native-fallback.d.ts +27 -0
  364. package/dist/lib/native-capabilities/midi-native-fallback.d.ts.map +1 -0
  365. package/dist/lib/native-capabilities/midi-native-fallback.js +127 -0
  366. package/dist/lib/native-capabilities/midi-ports.d.ts +6 -0
  367. package/dist/lib/native-capabilities/midi-ports.d.ts.map +1 -0
  368. package/dist/lib/native-capabilities/midi-ports.js +115 -0
  369. package/dist/lib/native-capabilities/midi-types.d.ts +25 -0
  370. package/dist/lib/native-capabilities/midi-types.d.ts.map +1 -0
  371. package/dist/lib/native-capabilities/midi-types.js +1 -0
  372. package/dist/lib/native-capabilities/midi.d.ts +6 -0
  373. package/dist/lib/native-capabilities/midi.d.ts.map +1 -0
  374. package/dist/lib/native-capabilities/midi.js +3 -0
  375. package/dist/lib/native-capabilities/native-device-io.d.ts +28 -0
  376. package/dist/lib/native-capabilities/native-device-io.d.ts.map +1 -0
  377. package/dist/lib/native-capabilities/native-device-io.js +91 -0
  378. package/dist/lib/native-capabilities/native-device-lifecycle.d.ts +13 -0
  379. package/dist/lib/native-capabilities/native-device-lifecycle.d.ts.map +1 -0
  380. package/dist/lib/native-capabilities/native-device-lifecycle.js +40 -0
  381. package/dist/lib/native-capabilities/notifications.d.ts +38 -0
  382. package/dist/lib/native-capabilities/notifications.d.ts.map +1 -0
  383. package/dist/lib/native-capabilities/notifications.js +50 -0
  384. package/dist/lib/native-capabilities/power-session.d.ts +113 -0
  385. package/dist/lib/native-capabilities/power-session.d.ts.map +1 -0
  386. package/dist/lib/native-capabilities/power-session.js +264 -0
  387. package/dist/lib/native-capabilities/secure-storage.d.ts +36 -0
  388. package/dist/lib/native-capabilities/secure-storage.d.ts.map +1 -0
  389. package/dist/lib/native-capabilities/secure-storage.js +64 -0
  390. package/dist/lib/native-capabilities/serial-native.d.ts +23 -0
  391. package/dist/lib/native-capabilities/serial-native.d.ts.map +1 -0
  392. package/dist/lib/native-capabilities/serial-native.js +181 -0
  393. package/dist/lib/native-capabilities/serial.d.ts +76 -0
  394. package/dist/lib/native-capabilities/serial.d.ts.map +1 -0
  395. package/dist/lib/native-capabilities/serial.js +215 -0
  396. package/dist/lib/native-capabilities/system-audio.d.ts +127 -0
  397. package/dist/lib/native-capabilities/system-audio.d.ts.map +1 -0
  398. package/dist/lib/native-capabilities/system-audio.js +330 -0
  399. package/dist/lib/native-capabilities/types.d.ts +62 -0
  400. package/dist/lib/native-capabilities/types.d.ts.map +1 -0
  401. package/dist/lib/native-capabilities/types.js +27 -0
  402. package/dist/lib/native-capabilities/usb-native.d.ts +39 -0
  403. package/dist/lib/native-capabilities/usb-native.d.ts.map +1 -0
  404. package/dist/lib/native-capabilities/usb-native.js +217 -0
  405. package/dist/lib/native-capabilities/usb.d.ts +85 -0
  406. package/dist/lib/native-capabilities/usb.d.ts.map +1 -0
  407. package/dist/lib/native-capabilities/usb.js +225 -0
  408. package/dist/lib/theme.d.ts.map +1 -1
  409. package/dist/lib/theme.js +2 -1
  410. package/docs/README.md +39 -0
  411. package/docs/accessibility.md +32 -0
  412. package/docs/adaptive-materials.md +79 -0
  413. package/docs/app-anatomy.md +74 -0
  414. package/docs/component-catalog.md +82 -0
  415. package/docs/component-guide-template.md +37 -0
  416. package/docs/design-tokens.md +185 -0
  417. package/docs/foundations.md +58 -0
  418. package/docs/native-integration.md +33 -0
  419. package/docs/standalone-app-windows.md +136 -0
  420. package/package.json +8 -3
  421. package/src/components/ui/alert-dialog.md +31 -0
  422. package/src/components/ui/alert.md +77 -0
  423. package/src/components/ui/app-frame.md +38 -0
  424. package/src/components/ui/badge.md +57 -0
  425. package/src/components/ui/button.md +76 -0
  426. package/src/components/ui/collapsible.md +52 -0
  427. package/src/components/ui/color-well.md +11 -0
  428. package/src/components/ui/combobox.md +42 -0
  429. package/src/components/ui/command.md +54 -0
  430. package/src/components/ui/date-field.md +32 -0
  431. package/src/components/ui/date-picker.md +55 -0
  432. package/src/components/ui/dialog.md +40 -0
  433. package/src/components/ui/edge-fade.md +7 -0
  434. package/src/components/ui/empty.md +87 -0
  435. package/src/components/ui/field.md +77 -0
  436. package/src/components/ui/grid.md +109 -0
  437. package/src/components/ui/icon-button.md +36 -0
  438. package/src/components/ui/inspector.md +11 -0
  439. package/src/components/ui/item.md +87 -0
  440. package/src/components/ui/list.md +140 -0
  441. package/src/components/ui/material.md +51 -0
  442. package/src/components/ui/navigation-button-group.md +46 -0
  443. package/src/components/ui/notification-dot.md +7 -0
  444. package/src/components/ui/number-input.md +19 -0
  445. package/src/components/ui/panel.md +11 -0
  446. package/src/components/ui/popover.md +31 -0
  447. package/src/components/ui/resizable.md +66 -0
  448. package/src/components/ui/scroll-area.md +72 -0
  449. package/src/components/ui/search-field.md +33 -0
  450. package/src/components/ui/segmented-control.md +36 -0
  451. package/src/components/ui/sheet.md +30 -0
  452. package/src/components/ui/sidebar.md +113 -0
  453. package/src/components/ui/sonner.md +37 -0
  454. package/src/components/ui/split-view.md +15 -0
  455. package/src/components/ui/status.md +12 -0
  456. package/src/components/ui/table.md +37 -0
  457. package/src/components/ui/tabs.md +66 -0
  458. package/src/components/ui/text.md +17 -0
  459. package/src/components/ui/toggle-button.md +48 -0
  460. package/src/components/ui/toggle-group.md +80 -0
  461. package/src/components/ui/toggle.md +73 -0
  462. package/src/components/ui/toolbar.md +26 -0
  463. package/src/components/ui/tooltip.md +31 -0
  464. package/src/styles/index.css +704 -3
@@ -0,0 +1,470 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Binary, Bluetooth } from 'lucide-react';
4
+ import { useCallback, useEffect, useRef, useState } from 'react';
5
+ import { NativeCapabilityBridgeError, connectMoldableBluetoothDevice, isMoldableBluetoothSupported, observeMoldableBluetoothNotifications, readMoldableBluetoothValue, requestMoldableBluetoothWithFallback, writeMoldableBluetoothValue, } from '../../lib/native-capabilities';
6
+ import { Button } from '../ui/button';
7
+ import { Input } from '../ui/input';
8
+ import { Spinner } from '../ui/spinner';
9
+ import { cleanupBluetoothSubscriptions, parseBluetoothHexBytes, } from './bluetooth-panel-helpers';
10
+ import { CapabilityBadge } from './capability-badge';
11
+ import { DeviceList, DeviceListEmpty, DeviceListItem } from './device-list';
12
+ import { LiveIndicator } from './live-indicator';
13
+ import { NativeCapabilityPanel, NativeCapabilityPanelAction, NativeCapabilityPanelContent, NativeCapabilityPanelHeader, NativeCapabilityPanelIcon, NativeCapabilityPanelTitle, } from './native-capability-panel';
14
+ import { StreamLog, useStreamLog } from './stream-log';
15
+ const HEX_DUMP_MAX_BYTES = 32;
16
+ const BLUETOOTH_BASE_UUID_SUFFIX = '-0000-1000-8000-00805f9b34fb';
17
+ function toError(cause) {
18
+ return cause instanceof Error ? cause : new Error(String(cause));
19
+ }
20
+ function isDismissedChooser(cause) {
21
+ return (cause instanceof NativeCapabilityBridgeError &&
22
+ (cause.code === 'cancelled' || cause.code === 'aborted'));
23
+ }
24
+ function asBytes(data) {
25
+ return data instanceof ArrayBuffer
26
+ ? new Uint8Array(data)
27
+ : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
28
+ }
29
+ function viewBytes(view) {
30
+ return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
31
+ }
32
+ function formatHexDump(bytes) {
33
+ if (bytes.byteLength === 0)
34
+ return '(empty)';
35
+ const shown = Array.from(bytes.subarray(0, HEX_DUMP_MAX_BYTES))
36
+ .map((byte) => byte.toString(16).padStart(2, '0').toUpperCase())
37
+ .join(' ');
38
+ const hidden = bytes.byteLength - HEX_DUMP_MAX_BYTES;
39
+ return hidden > 0 ? `${shown} +${hidden} more` : shown;
40
+ }
41
+ /** `0x2A19` for SIG-assigned UUIDs, middle-truncated hex for vendor ones. */
42
+ function shortUuid(uuid) {
43
+ const value = uuid.toLowerCase();
44
+ if (value.startsWith('0000') && value.endsWith(BLUETOOTH_BASE_UUID_SUFFIX)) {
45
+ return `0x${value.slice(4, 8).toUpperCase()}`;
46
+ }
47
+ return value.length > 13 ? `${value.slice(0, 8)}…${value.slice(-4)}` : value;
48
+ }
49
+ function middleTruncate(uuid) {
50
+ return uuid.length > 22 ? `${uuid.slice(0, 13)}…${uuid.slice(-8)}` : uuid;
51
+ }
52
+ function characteristicKey(characteristic) {
53
+ return `${characteristic.serviceUuid}/${characteristic.uuid}`;
54
+ }
55
+ /** Web Bluetooth exposes `properties`; the structural type keeps it optional. */
56
+ function describeProperties(characteristic) {
57
+ const flags = characteristic
58
+ .properties;
59
+ if (!flags)
60
+ return [];
61
+ const names = [];
62
+ if (flags.read)
63
+ names.push('read');
64
+ if (flags.write || flags.writeWithoutResponse)
65
+ names.push('write');
66
+ if (flags.notify)
67
+ names.push('notify');
68
+ if (flags.indicate)
69
+ names.push('indicate');
70
+ return names;
71
+ }
72
+ function requireWebCharacteristic(characteristic) {
73
+ if (!characteristic.characteristic) {
74
+ throw new Error('This characteristic has no Web Bluetooth handle.');
75
+ }
76
+ return characteristic.characteristic;
77
+ }
78
+ function observeGattDisconnect(transport, listener) {
79
+ if (transport.kind === 'web-bluetooth') {
80
+ transport.device.addEventListener('gattserverdisconnected', listener);
81
+ return () => transport.device.removeEventListener('gattserverdisconnected', listener);
82
+ }
83
+ transport.device.addEventListener('gattserverdisconnected', listener);
84
+ return () => transport.device.removeEventListener('gattserverdisconnected', listener);
85
+ }
86
+ async function discoverWebServices(connection, serviceUuid) {
87
+ const services = serviceUuid
88
+ ? [await connection.getPrimaryService(serviceUuid)]
89
+ : await connection.server.getPrimaryServices();
90
+ return Promise.all(services.map(async (service) => {
91
+ const characteristics = await service
92
+ .getCharacteristics()
93
+ .catch(() => []);
94
+ return {
95
+ uuid: service.uuid,
96
+ characteristics: characteristics.map((characteristic) => ({
97
+ serviceUuid: service.uuid,
98
+ uuid: characteristic.uuid,
99
+ properties: describeProperties(characteristic),
100
+ characteristic,
101
+ })),
102
+ };
103
+ }));
104
+ }
105
+ /**
106
+ * Bluetooth LE state machine behind `BluetoothPanel`. Handles both transports
107
+ * returned by `requestMoldableBluetoothWithFallback`: Web Bluetooth (GATT
108
+ * connection + service discovery) and the desktop bridge (UUID-addressed I/O
109
+ * on an already-connected device).
110
+ */
111
+ export function useMoldableBluetooth(options = {}) {
112
+ const [status, setStatus] = useState('idle');
113
+ const [device, setDevice] = useState(null);
114
+ const [connection, setConnection] = useState(null);
115
+ const [services, setServices] = useState([]);
116
+ const [subscribedUuids, setSubscribedUuids] = useState([]);
117
+ const [disconnecting, setDisconnecting] = useState(false);
118
+ const [error, setError] = useState(null);
119
+ const { entries, append, clear } = useStreamLog();
120
+ const generationRef = useRef(0);
121
+ const transportRef = useRef(null);
122
+ const connectionRef = useRef(null);
123
+ const requestedServiceRef = useRef(undefined);
124
+ const subscriptionsRef = useRef(new Map());
125
+ const detachDeviceRef = useRef(null);
126
+ const disconnectingRef = useRef(false);
127
+ const unmountedRef = useRef(false);
128
+ const onValueRef = useRef(options.onValue);
129
+ onValueRef.current = options.onValue;
130
+ const reset = useCallback(async (bestEffort = false) => {
131
+ generationRef.current++;
132
+ const wasDisconnecting = disconnectingRef.current;
133
+ disconnectingRef.current = true;
134
+ try {
135
+ try {
136
+ await cleanupBluetoothSubscriptions(subscriptionsRef.current);
137
+ }
138
+ catch (cause) {
139
+ if (!unmountedRef.current) {
140
+ setSubscribedUuids([...subscriptionsRef.current.keys()]);
141
+ }
142
+ if (!bestEffort)
143
+ throw cause;
144
+ }
145
+ const transport = transportRef.current;
146
+ try {
147
+ if (transport?.kind === 'desktop-bridge') {
148
+ await transport.device.disconnect();
149
+ }
150
+ else {
151
+ connectionRef.current?.disconnect();
152
+ }
153
+ }
154
+ catch (cause) {
155
+ if (!bestEffort)
156
+ throw cause;
157
+ }
158
+ detachDeviceRef.current?.();
159
+ detachDeviceRef.current = null;
160
+ transportRef.current = null;
161
+ connectionRef.current = null;
162
+ requestedServiceRef.current = undefined;
163
+ subscriptionsRef.current.clear();
164
+ if (!unmountedRef.current) {
165
+ setSubscribedUuids([]);
166
+ setDevice(null);
167
+ setConnection(null);
168
+ setServices([]);
169
+ }
170
+ }
171
+ finally {
172
+ disconnectingRef.current = wasDisconnecting;
173
+ }
174
+ }, []);
175
+ const disconnect = useCallback(async () => {
176
+ setDisconnecting(true);
177
+ setError(null);
178
+ try {
179
+ await reset();
180
+ setStatus('idle');
181
+ }
182
+ catch (cause) {
183
+ setError(toError(cause));
184
+ }
185
+ finally {
186
+ setDisconnecting(false);
187
+ }
188
+ }, [reset]);
189
+ const handleDisconnected = useCallback(() => {
190
+ if (disconnectingRef.current)
191
+ return;
192
+ void reset(true).then(() => {
193
+ if (unmountedRef.current)
194
+ return;
195
+ setStatus('idle');
196
+ append({ direction: 'info', data: 'Device disconnected' });
197
+ });
198
+ }, [append, reset]);
199
+ const handleDisconnectedRef = useRef(handleDisconnected);
200
+ handleDisconnectedRef.current = handleDisconnected;
201
+ const appendValue = useCallback((characteristic, value) => {
202
+ append({
203
+ direction: 'in',
204
+ data: `${shortUuid(characteristic.uuid)} ${formatHexDump(viewBytes(value))}`,
205
+ });
206
+ onValueRef.current?.(characteristic, value);
207
+ }, [append]);
208
+ const connect = useCallback(async () => {
209
+ const transport = transportRef.current;
210
+ if (!transport)
211
+ return;
212
+ const generation = generationRef.current;
213
+ setStatus('connecting');
214
+ setError(null);
215
+ try {
216
+ let discovered;
217
+ if (transport.kind === 'web-bluetooth') {
218
+ const nextConnection = await connectMoldableBluetoothDevice(transport.device);
219
+ if (generationRef.current !== generation) {
220
+ nextConnection.disconnect();
221
+ return;
222
+ }
223
+ connectionRef.current = nextConnection;
224
+ setConnection(nextConnection);
225
+ discovered = await discoverWebServices(nextConnection, requestedServiceRef.current);
226
+ }
227
+ else {
228
+ discovered = (await transport.device.getServices()).map((service) => ({
229
+ uuid: service.uuid,
230
+ characteristics: service.characteristicUuids.map((uuid) => ({
231
+ serviceUuid: service.uuid,
232
+ uuid,
233
+ properties: [],
234
+ characteristic: null,
235
+ })),
236
+ }));
237
+ }
238
+ if (generationRef.current !== generation)
239
+ return;
240
+ setServices(discovered);
241
+ setStatus('connected');
242
+ }
243
+ catch (cause) {
244
+ if (generationRef.current !== generation)
245
+ return;
246
+ setError(toError(cause));
247
+ setStatus('error');
248
+ }
249
+ }, []);
250
+ const request = useCallback(async (serviceUuid) => {
251
+ setError(null);
252
+ try {
253
+ await reset();
254
+ const generation = generationRef.current;
255
+ const trimmed = serviceUuid?.trim() || undefined;
256
+ requestedServiceRef.current = trimmed;
257
+ setStatus('requesting');
258
+ if (!trimmed && !isMoldableBluetoothSupported()) {
259
+ throw new Error('The desktop Bluetooth chooser needs a service UUID to scan.');
260
+ }
261
+ const transport = await requestMoldableBluetoothWithFallback(trimmed
262
+ ? {
263
+ filters: [{ services: [trimmed] }],
264
+ optionalServices: [trimmed],
265
+ }
266
+ : { acceptAllDevices: true });
267
+ if (generationRef.current !== generation) {
268
+ if (transport.kind === 'desktop-bridge') {
269
+ await transport.device.disconnect().catch(() => undefined);
270
+ }
271
+ else {
272
+ transport.device.gatt?.disconnect();
273
+ }
274
+ return;
275
+ }
276
+ transportRef.current = transport;
277
+ setDevice(transport.device);
278
+ detachDeviceRef.current = observeGattDisconnect(transport, () => {
279
+ handleDisconnectedRef.current();
280
+ });
281
+ await connect();
282
+ }
283
+ catch (cause) {
284
+ if (isDismissedChooser(cause)) {
285
+ setStatus('idle');
286
+ return;
287
+ }
288
+ if (unmountedRef.current)
289
+ return;
290
+ setError(toError(cause));
291
+ setStatus(transportRef.current ? 'connected' : 'error');
292
+ }
293
+ }, [connect, reset]);
294
+ const read = useCallback(async (characteristic) => {
295
+ const transport = transportRef.current;
296
+ if (!transport)
297
+ return;
298
+ const generation = generationRef.current;
299
+ setError(null);
300
+ try {
301
+ const value = transport.kind === 'desktop-bridge'
302
+ ? await transport.device.read(characteristic.serviceUuid, characteristic.uuid)
303
+ : await readMoldableBluetoothValue(requireWebCharacteristic(characteristic));
304
+ if (generationRef.current !== generation)
305
+ return;
306
+ appendValue(characteristic, value);
307
+ }
308
+ catch (cause) {
309
+ if (generationRef.current !== generation)
310
+ return;
311
+ setError(toError(cause));
312
+ }
313
+ }, [appendValue]);
314
+ const subscribe = useCallback(async (characteristic) => {
315
+ const transport = transportRef.current;
316
+ const key = characteristicKey(characteristic);
317
+ if (!transport || subscriptionsRef.current.has(key))
318
+ return;
319
+ const generation = generationRef.current;
320
+ setError(null);
321
+ try {
322
+ let stop;
323
+ if (transport.kind === 'desktop-bridge') {
324
+ stop = await transport.device.observe(characteristic.serviceUuid, characteristic.uuid, (value) => appendValue(characteristic, value));
325
+ }
326
+ else {
327
+ const target = requireWebCharacteristic(characteristic);
328
+ stop = await observeMoldableBluetoothNotifications(target, () => {
329
+ if (target.value)
330
+ appendValue(characteristic, target.value);
331
+ });
332
+ }
333
+ if (generationRef.current !== generation) {
334
+ await stop().catch(() => undefined);
335
+ return;
336
+ }
337
+ subscriptionsRef.current.set(key, stop);
338
+ setSubscribedUuids((previous) => previous.includes(key) ? previous : [...previous, key]);
339
+ }
340
+ catch (cause) {
341
+ if (generationRef.current !== generation)
342
+ return;
343
+ setError(toError(cause));
344
+ }
345
+ }, [appendValue]);
346
+ const unsubscribe = useCallback(async (characteristic) => {
347
+ const key = characteristicKey(characteristic);
348
+ const stop = subscriptionsRef.current.get(key);
349
+ if (!stop)
350
+ return;
351
+ setError(null);
352
+ try {
353
+ await stop();
354
+ if (subscriptionsRef.current.get(key) !== stop)
355
+ return;
356
+ subscriptionsRef.current.delete(key);
357
+ setSubscribedUuids((previous) => previous.filter((value) => value !== key));
358
+ }
359
+ catch (cause) {
360
+ setError(toError(cause));
361
+ }
362
+ }, []);
363
+ const write = useCallback(async (characteristic, bytes) => {
364
+ const transport = transportRef.current;
365
+ if (!transport)
366
+ return;
367
+ const generation = generationRef.current;
368
+ setError(null);
369
+ try {
370
+ if (transport.kind === 'desktop-bridge') {
371
+ await transport.device.write(characteristic.serviceUuid, characteristic.uuid, bytes);
372
+ }
373
+ else {
374
+ await writeMoldableBluetoothValue(requireWebCharacteristic(characteristic), bytes, 'automatic');
375
+ }
376
+ if (generationRef.current !== generation)
377
+ return;
378
+ append({
379
+ direction: 'out',
380
+ data: `${shortUuid(characteristic.uuid)} ${formatHexDump(asBytes(bytes))}`,
381
+ });
382
+ }
383
+ catch (cause) {
384
+ if (generationRef.current !== generation)
385
+ return;
386
+ setError(toError(cause));
387
+ }
388
+ }, [append]);
389
+ const writeHex = useCallback(async (characteristic, value) => {
390
+ try {
391
+ await write(characteristic, parseBluetoothHexBytes(value));
392
+ }
393
+ catch (cause) {
394
+ setError(toError(cause));
395
+ }
396
+ }, [write]);
397
+ useEffect(() => {
398
+ unmountedRef.current = false;
399
+ return () => {
400
+ unmountedRef.current = true;
401
+ void reset(true);
402
+ };
403
+ }, [reset]);
404
+ return {
405
+ status,
406
+ device,
407
+ connection,
408
+ disconnecting,
409
+ services,
410
+ subscribedUuids,
411
+ error,
412
+ entries,
413
+ request,
414
+ connect,
415
+ disconnect,
416
+ read,
417
+ subscribe,
418
+ unsubscribe,
419
+ write,
420
+ writeHex,
421
+ clearEntries: clear,
422
+ };
423
+ }
424
+ /**
425
+ * Bluetooth LE panel: scan (optionally scoped to a service UUID), connect,
426
+ * browse discovered characteristics, and read, write, or subscribe to values
427
+ * with a live hex log.
428
+ */
429
+ function BluetoothPanel({ className, serviceUuid, onValue, ...props }) {
430
+ const bluetooth = useMoldableBluetooth({ onValue });
431
+ const [uuidInput, setUuidInput] = useState(serviceUuid ?? '');
432
+ const [writeValues, setWriteValues] = useState({});
433
+ const connected = bluetooth.status === 'connected';
434
+ const busy = bluetooth.status === 'requesting' || bluetooth.status === 'connecting';
435
+ const deviceName = bluetooth.device?.name || 'BLE device';
436
+ return (_jsxs(NativeCapabilityPanel, { "data-slot": "bluetooth-panel", "data-status": bluetooth.status, className: className, ...props, children: [_jsxs(NativeCapabilityPanelHeader, { children: [_jsx(NativeCapabilityPanelIcon, { children: _jsx(Bluetooth, {}) }), _jsx(NativeCapabilityPanelTitle, { children: "Bluetooth LE" }), _jsx(CapabilityBadge, { capability: "bluetooth" }), _jsx(NativeCapabilityPanelAction, { children: connected ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground inline-flex max-w-40 items-center rounded-full border px-2 py-0.5 text-[11px] font-medium", children: _jsx("span", { className: "truncate", children: deviceName }) }), _jsx(LiveIndicator, {}), _jsxs(Button, { size: "sm", variant: "outline", disabled: bluetooth.disconnecting, onClick: () => void bluetooth.disconnect(), children: [bluetooth.disconnecting ? _jsx(Spinner, {}) : null, bluetooth.disconnecting ? 'Disconnecting…' : 'Disconnect'] })] })) : (_jsxs(_Fragment, { children: [_jsx(Input, { value: uuidInput, onChange: (event) => setUuidInput(event.target.value), onKeyDown: (event) => {
437
+ if (event.key === 'Enter' && !busy) {
438
+ void bluetooth.request(uuidInput);
439
+ }
440
+ }, placeholder: "Service UUID (optional)", "aria-label": "Service UUID", disabled: busy, className: "h-8 w-44 font-mono text-xs md:text-xs" }), _jsxs(Button, { size: "sm", disabled: busy, onClick: () => void bluetooth.request(uuidInput), children: [busy ? _jsx(Spinner, {}) : null, bluetooth.status === 'requesting'
441
+ ? 'Scanning…'
442
+ : bluetooth.status === 'connecting'
443
+ ? 'Connecting…'
444
+ : 'Scan'] })] })) })] }), _jsx(NativeCapabilityPanelContent, { children: connected ? (_jsxs("div", { className: "animate-in fade-in space-y-4 duration-300 motion-reduce:animate-none", children: [bluetooth.services.length === 0 ? (_jsx(DeviceList, { children: _jsx(DeviceListEmpty, { icon: _jsx(Bluetooth, {}), children: "No GATT services discovered" }) })) : (bluetooth.services.map((service) => (_jsxs("section", { "data-slot": "bluetooth-service", className: "space-y-1.5", children: [_jsx("div", { className: "text-muted-foreground font-mono text-[10px] font-medium uppercase tracking-wider", children: middleTruncate(service.uuid) }), _jsx(DeviceList, { children: service.characteristics.length === 0 ? (_jsx(DeviceListEmpty, { children: "No characteristics" })) : (service.characteristics.map((characteristic) => {
445
+ const key = characteristicKey(characteristic);
446
+ const subscribed = bluetooth.subscribedUuids.includes(key);
447
+ const unknown = characteristic.properties.length === 0;
448
+ const canRead = unknown || characteristic.properties.includes('read');
449
+ const canWrite = unknown || characteristic.properties.includes('write');
450
+ const canNotify = unknown ||
451
+ characteristic.properties.includes('notify') ||
452
+ characteristic.properties.includes('indicate');
453
+ return (_jsx(DeviceListItem, { icon: _jsx(Binary, {}), name: _jsx("span", { className: "font-mono", children: shortUuid(characteristic.uuid) }), description: unknown
454
+ ? undefined
455
+ : characteristic.properties.join(' · '), action: _jsxs(_Fragment, { children: [canWrite ? (_jsxs(_Fragment, { children: [_jsx(Input, { value: writeValues[key] ?? '', onChange: (event) => setWriteValues((previous) => ({
456
+ ...previous,
457
+ [key]: event.target.value,
458
+ })), onKeyDown: (event) => {
459
+ if (event.key === 'Enter') {
460
+ void bluetooth.writeHex(characteristic, writeValues[key] ?? '');
461
+ }
462
+ }, placeholder: "01 A0 FF", "aria-label": `Hex value for ${shortUuid(characteristic.uuid)}`, className: "h-7 w-24 font-mono text-xs md:text-xs" }), _jsx(Button, { variant: "ghost", size: "xs", onClick: () => void bluetooth.writeHex(characteristic, writeValues[key] ?? ''), children: "Write" })] })) : null, canRead ? (_jsx(Button, { variant: "ghost", size: "xs", onClick: () => void bluetooth.read(characteristic), children: "Read" })) : null, canNotify ? (_jsx(Button, { variant: "outline", size: "xs", onClick: () => void (subscribed
463
+ ? bluetooth.unsubscribe(characteristic)
464
+ : bluetooth.subscribe(characteristic)), children: subscribed ? 'Stop' : 'Notify' })) : null] }) }, key));
465
+ })) })] }, service.uuid)))), bluetooth.error ? (_jsx("p", { className: "text-status-error text-xs", children: bluetooth.error.message })) : null, _jsx(StreamLog, { entries: bluetooth.entries, maxHeight: 200, emptyLabel: "Waiting for characteristic data" })] })) : (_jsx("div", { className: "animate-in fade-in flex flex-col items-center gap-3 py-6 text-center duration-300 motion-reduce:animate-none", children: busy ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { className: "text-muted-foreground" }), _jsx("p", { className: "text-muted-foreground text-xs", children: bluetooth.status === 'requesting'
466
+ ? 'Waiting for the device chooser…'
467
+ : 'Connecting to device…' })] })) : bluetooth.status === 'error' ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm font-medium", children: "Bluetooth request failed" }), _jsx("p", { className: "text-muted-foreground max-w-64 text-xs", children: bluetooth.error?.message ??
468
+ 'The Bluetooth request could not complete.' })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-muted-foreground bg-background shadow-xs flex size-10 items-center justify-center rounded-lg border [&_svg]:size-5", children: _jsx(Bluetooth, {}) }), _jsx("p", { className: "text-sm font-medium", children: "Not connected" }), _jsx("p", { className: "text-muted-foreground text-xs", children: "Scan for a nearby BLE device." })] })) })) })] }));
469
+ }
470
+ export { BluetoothPanel };
@@ -0,0 +1,39 @@
1
+ import * as React from 'react';
2
+ export type MoldableCameraStatus = 'idle' | 'starting' | 'live' | 'muted' | 'denied' | 'error';
3
+ export interface UseMoldableCameraOptions {
4
+ /** Extra video constraints merged under the selected device. */
5
+ constraints?: MediaTrackConstraints;
6
+ onStreamChange?: (stream: MediaStream | null) => void;
7
+ }
8
+ /**
9
+ * Camera state machine behind `CameraPreview`. Use directly to build custom
10
+ * camera UI on the same permission/device/stream handling.
11
+ */
12
+ export declare function useMoldableCamera(options?: UseMoldableCameraOptions): {
13
+ status: MoldableCameraStatus;
14
+ stream: MediaStream | null;
15
+ devices: MediaDeviceInfo[];
16
+ deviceId: string | null;
17
+ error: Error | null;
18
+ start: (nextDeviceId?: string) => Promise<void>;
19
+ stop: () => void;
20
+ selectDevice: (id: string) => void;
21
+ refreshDevices: () => Promise<void>;
22
+ };
23
+ export interface CameraPreviewProps extends React.ComponentProps<'div'> {
24
+ constraints?: MediaTrackConstraints;
25
+ /** Mirror the preview horizontally (natural for user-facing cameras). */
26
+ mirrored?: boolean;
27
+ /** Start the camera on mount. */
28
+ autoStart?: boolean;
29
+ /** When set, shows a shutter button and delivers PNG snapshots. */
30
+ onSnapshot?: (blob: Blob) => void;
31
+ onStreamChange?: (stream: MediaStream | null) => void;
32
+ }
33
+ /**
34
+ * Full-bleed live camera surface: black media well, hover scrim controls,
35
+ * device switching, permission and error states, optional snapshots.
36
+ */
37
+ declare function CameraPreview({ className, constraints, mirrored, autoStart, onSnapshot, onStreamChange, ...props }: CameraPreviewProps): import("react/jsx-runtime").JSX.Element;
38
+ export { CameraPreview };
39
+ //# sourceMappingURL=camera-preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camera-preview.d.ts","sourceRoot":"","sources":["../../../src/components/native-capabilities/camera-preview.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAsB9B,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,UAAU,GACV,MAAM,GACN,OAAO,GACP,QAAQ,GACR,OAAO,CAAA;AAEX,MAAM,WAAW,wBAAwB;IACvC,gEAAgE;IAChE,WAAW,CAAC,EAAE,qBAAqB,CAAA;IACnC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;CACtD;AAuBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B;;;;;;2BA+C9C,MAAM;;uBA2EvB,MAAM;;EA2Bd;AAED,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACrE,WAAW,CAAC,EAAE,qBAAqB,CAAA;IACnC,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,mEAAmE;IACnE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACjC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;CACtD;AAED;;;GAGG;AACH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,WAAW,EACX,QAAe,EACf,SAAiB,EACjB,UAAU,EACV,cAAc,EACd,GAAG,KAAK,EACT,EAAE,kBAAkB,2CA+LpB;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}