@moldable-ai/ui 0.2.18 → 0.2.20

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 (587) hide show
  1. package/dist/catalog/catalog-manifest.d.ts +6 -0
  2. package/dist/catalog/catalog-manifest.d.ts.map +1 -0
  3. package/dist/catalog/catalog-manifest.js +105 -0
  4. package/dist/catalog/catalog-types.d.ts +54 -0
  5. package/dist/catalog/catalog-types.d.ts.map +1 -0
  6. package/dist/catalog/catalog-types.js +14 -0
  7. package/dist/catalog/component-catalog.d.ts +14 -0
  8. package/dist/catalog/component-catalog.d.ts.map +1 -0
  9. package/dist/catalog/component-catalog.js +39 -0
  10. package/dist/catalog/core-catalog.d.ts +6 -0
  11. package/dist/catalog/core-catalog.d.ts.map +1 -0
  12. package/dist/catalog/core-catalog.js +105 -0
  13. package/dist/catalog/index.d.ts +5 -0
  14. package/dist/catalog/index.d.ts.map +1 -0
  15. package/dist/catalog/index.js +4 -0
  16. package/dist/components/app-error-boundary.d.ts +1 -0
  17. package/dist/components/app-error-boundary.d.ts.map +1 -1
  18. package/dist/components/app-error-boundary.js +13 -0
  19. package/dist/components/chat/chat-image-lightbox.d.ts +9 -0
  20. package/dist/components/chat/chat-image-lightbox.d.ts.map +1 -0
  21. package/dist/components/chat/chat-image-lightbox.js +9 -0
  22. package/dist/components/chat/chat-message.d.ts +19 -1
  23. package/dist/components/chat/chat-message.d.ts.map +1 -1
  24. package/dist/components/chat/chat-message.js +66 -16
  25. package/dist/components/chat/chat-messages.d.ts +5 -2
  26. package/dist/components/chat/chat-messages.d.ts.map +1 -1
  27. package/dist/components/chat/chat-messages.js +61 -6
  28. package/dist/components/chat/chat-panel.d.ts +67 -17
  29. package/dist/components/chat/chat-panel.d.ts.map +1 -1
  30. package/dist/components/chat/chat-panel.js +250 -159
  31. package/dist/components/chat/conversation-history.d.ts +39 -5
  32. package/dist/components/chat/conversation-history.d.ts.map +1 -1
  33. package/dist/components/chat/conversation-history.js +192 -26
  34. package/dist/components/chat/index.d.ts +3 -2
  35. package/dist/components/chat/index.d.ts.map +1 -1
  36. package/dist/components/chat/index.js +3 -2
  37. package/dist/components/chat/model-effort-power-effects.d.ts +7 -0
  38. package/dist/components/chat/model-effort-power-effects.d.ts.map +1 -0
  39. package/dist/components/chat/model-effort-power-effects.js +54 -0
  40. package/dist/components/chat/model-effort-selector.d.ts +26 -0
  41. package/dist/components/chat/model-effort-selector.d.ts.map +1 -0
  42. package/dist/components/chat/model-effort-selector.js +179 -0
  43. package/dist/components/chat/model-effort-ultra-effects.d.ts +5 -0
  44. package/dist/components/chat/model-effort-ultra-effects.d.ts.map +1 -0
  45. package/dist/components/chat/model-effort-ultra-effects.js +56 -0
  46. package/dist/components/chat/tool-handlers.d.ts.map +1 -1
  47. package/dist/components/chat/tool-handlers.js +40 -2
  48. package/dist/components/chat/vertical-scroll-fade.d.ts +6 -0
  49. package/dist/components/chat/vertical-scroll-fade.d.ts.map +1 -0
  50. package/dist/components/chat/vertical-scroll-fade.js +12 -0
  51. package/dist/components/hardware/bluetooth-panel-helpers.d.ts +9 -0
  52. package/dist/components/hardware/bluetooth-panel-helpers.d.ts.map +1 -0
  53. package/dist/components/hardware/bluetooth-panel-helpers.js +37 -0
  54. package/dist/components/hardware/bluetooth-panel.d.ts +56 -0
  55. package/dist/components/hardware/bluetooth-panel.d.ts.map +1 -0
  56. package/dist/components/hardware/bluetooth-panel.js +470 -0
  57. package/dist/components/hardware/camera-preview.d.ts +39 -0
  58. package/dist/components/hardware/camera-preview.d.ts.map +1 -0
  59. package/dist/components/hardware/camera-preview.js +228 -0
  60. package/dist/components/hardware/capability-badge.d.ts +23 -0
  61. package/dist/components/hardware/capability-badge.d.ts.map +1 -0
  62. package/dist/components/hardware/capability-badge.js +39 -0
  63. package/dist/components/hardware/capability-matrix.d.ts +14 -0
  64. package/dist/components/hardware/capability-matrix.d.ts.map +1 -0
  65. package/dist/components/hardware/capability-matrix.js +97 -0
  66. package/dist/components/hardware/clipboard-button.d.ts +26 -0
  67. package/dist/components/hardware/clipboard-button.d.ts.map +1 -0
  68. package/dist/components/hardware/clipboard-button.js +114 -0
  69. package/dist/components/hardware/device-io-controls.d.ts +4 -0
  70. package/dist/components/hardware/device-io-controls.d.ts.map +1 -0
  71. package/dist/components/hardware/device-io-controls.js +28 -0
  72. package/dist/components/hardware/device-list.d.ts +20 -0
  73. package/dist/components/hardware/device-list.d.ts.map +1 -0
  74. package/dist/components/hardware/device-list.js +14 -0
  75. package/dist/components/hardware/display-map.d.ts +23 -0
  76. package/dist/components/hardware/display-map.d.ts.map +1 -0
  77. package/dist/components/hardware/display-map.js +114 -0
  78. package/dist/components/hardware/haptic-button.d.ts +26 -0
  79. package/dist/components/hardware/haptic-button.d.ts.map +1 -0
  80. package/dist/components/hardware/haptic-button.js +94 -0
  81. package/dist/components/hardware/hardware-panel.d.ts +11 -0
  82. package/dist/components/hardware/hardware-panel.d.ts.map +1 -0
  83. package/dist/components/hardware/hardware-panel.js +28 -0
  84. package/dist/components/hardware/hid-panel.d.ts +40 -0
  85. package/dist/components/hardware/hid-panel.d.ts.map +1 -0
  86. package/dist/components/hardware/hid-panel.js +373 -0
  87. package/dist/components/hardware/index.d.ts +27 -0
  88. package/dist/components/hardware/index.d.ts.map +1 -0
  89. package/dist/components/hardware/index.js +26 -0
  90. package/dist/components/hardware/live-indicator.d.ts +15 -0
  91. package/dist/components/hardware/live-indicator.d.ts.map +1 -0
  92. package/dist/components/hardware/live-indicator.js +26 -0
  93. package/dist/components/hardware/local-auth-button.d.ts +33 -0
  94. package/dist/components/hardware/local-auth-button.d.ts.map +1 -0
  95. package/dist/components/hardware/local-auth-button.js +115 -0
  96. package/dist/components/hardware/location-panel.d.ts +29 -0
  97. package/dist/components/hardware/location-panel.d.ts.map +1 -0
  98. package/dist/components/hardware/location-panel.js +154 -0
  99. package/dist/components/hardware/microphone-meter.d.ts +35 -0
  100. package/dist/components/hardware/microphone-meter.d.ts.map +1 -0
  101. package/dist/components/hardware/microphone-meter.js +244 -0
  102. package/dist/components/hardware/midi-monitor.d.ts +54 -0
  103. package/dist/components/hardware/midi-monitor.d.ts.map +1 -0
  104. package/dist/components/hardware/midi-monitor.js +534 -0
  105. package/dist/components/hardware/notification-panel.d.ts +24 -0
  106. package/dist/components/hardware/notification-panel.d.ts.map +1 -0
  107. package/dist/components/hardware/notification-panel.js +124 -0
  108. package/dist/components/hardware/power-blocker-controller.d.ts +19 -0
  109. package/dist/components/hardware/power-blocker-controller.d.ts.map +1 -0
  110. package/dist/components/hardware/power-blocker-controller.js +83 -0
  111. package/dist/components/hardware/power-panel.d.ts +67 -0
  112. package/dist/components/hardware/power-panel.d.ts.map +1 -0
  113. package/dist/components/hardware/power-panel.js +309 -0
  114. package/dist/components/hardware/readout.d.ts +10 -0
  115. package/dist/components/hardware/readout.d.ts.map +1 -0
  116. package/dist/components/hardware/readout.js +11 -0
  117. package/dist/components/hardware/screen-share-preview.d.ts +36 -0
  118. package/dist/components/hardware/screen-share-preview.d.ts.map +1 -0
  119. package/dist/components/hardware/screen-share-preview.js +191 -0
  120. package/dist/components/hardware/secure-storage-panel.d.ts +36 -0
  121. package/dist/components/hardware/secure-storage-panel.d.ts.map +1 -0
  122. package/dist/components/hardware/secure-storage-panel.js +193 -0
  123. package/dist/components/hardware/serial-console.d.ts +64 -0
  124. package/dist/components/hardware/serial-console.d.ts.map +1 -0
  125. package/dist/components/hardware/serial-console.js +399 -0
  126. package/dist/components/hardware/shortcut-recorder.d.ts +35 -0
  127. package/dist/components/hardware/shortcut-recorder.d.ts.map +1 -0
  128. package/dist/components/hardware/shortcut-recorder.js +217 -0
  129. package/dist/components/hardware/stream-log.d.ts +35 -0
  130. package/dist/components/hardware/stream-log.d.ts.map +1 -0
  131. package/dist/components/hardware/stream-log.js +65 -0
  132. package/dist/components/hardware/system-audio-monitor.d.ts +34 -0
  133. package/dist/components/hardware/system-audio-monitor.d.ts.map +1 -0
  134. package/dist/components/hardware/system-audio-monitor.js +275 -0
  135. package/dist/components/hardware/usb-panel.d.ts +54 -0
  136. package/dist/components/hardware/usb-panel.d.ts.map +1 -0
  137. package/dist/components/hardware/usb-panel.js +363 -0
  138. package/dist/components/hardware/use-capability.d.ts +20 -0
  139. package/dist/components/hardware/use-capability.d.ts.map +1 -0
  140. package/dist/components/hardware/use-capability.js +61 -0
  141. package/dist/components/native-capabilities/bluetooth-panel-helpers.d.ts +9 -0
  142. package/dist/components/native-capabilities/bluetooth-panel-helpers.d.ts.map +1 -0
  143. package/dist/components/native-capabilities/bluetooth-panel-helpers.js +37 -0
  144. package/dist/components/native-capabilities/bluetooth-panel.d.ts +56 -0
  145. package/dist/components/native-capabilities/bluetooth-panel.d.ts.map +1 -0
  146. package/dist/components/native-capabilities/bluetooth-panel.js +470 -0
  147. package/dist/components/native-capabilities/camera-preview.d.ts +39 -0
  148. package/dist/components/native-capabilities/camera-preview.d.ts.map +1 -0
  149. package/dist/components/native-capabilities/camera-preview.js +228 -0
  150. package/dist/components/native-capabilities/capability-badge.d.ts +23 -0
  151. package/dist/components/native-capabilities/capability-badge.d.ts.map +1 -0
  152. package/dist/components/native-capabilities/capability-badge.js +39 -0
  153. package/dist/components/native-capabilities/capability-matrix.d.ts +14 -0
  154. package/dist/components/native-capabilities/capability-matrix.d.ts.map +1 -0
  155. package/dist/components/native-capabilities/capability-matrix.js +97 -0
  156. package/dist/components/native-capabilities/clipboard-button.d.ts +26 -0
  157. package/dist/components/native-capabilities/clipboard-button.d.ts.map +1 -0
  158. package/dist/components/native-capabilities/clipboard-button.js +99 -0
  159. package/dist/components/native-capabilities/device-io-controls.d.ts +4 -0
  160. package/dist/components/native-capabilities/device-io-controls.d.ts.map +1 -0
  161. package/dist/components/native-capabilities/device-io-controls.js +28 -0
  162. package/dist/components/native-capabilities/device-list.d.ts +20 -0
  163. package/dist/components/native-capabilities/device-list.d.ts.map +1 -0
  164. package/dist/components/native-capabilities/device-list.js +14 -0
  165. package/dist/components/native-capabilities/display-map.d.ts +23 -0
  166. package/dist/components/native-capabilities/display-map.d.ts.map +1 -0
  167. package/dist/components/native-capabilities/display-map.js +114 -0
  168. package/dist/components/native-capabilities/haptic-button.d.ts +26 -0
  169. package/dist/components/native-capabilities/haptic-button.d.ts.map +1 -0
  170. package/dist/components/native-capabilities/haptic-button.js +94 -0
  171. package/dist/components/native-capabilities/hid-panel.d.ts +40 -0
  172. package/dist/components/native-capabilities/hid-panel.d.ts.map +1 -0
  173. package/dist/components/native-capabilities/hid-panel.js +373 -0
  174. package/dist/components/native-capabilities/index.d.ts +27 -0
  175. package/dist/components/native-capabilities/index.d.ts.map +1 -0
  176. package/dist/components/native-capabilities/index.js +26 -0
  177. package/dist/components/native-capabilities/live-indicator.d.ts +15 -0
  178. package/dist/components/native-capabilities/live-indicator.d.ts.map +1 -0
  179. package/dist/components/native-capabilities/live-indicator.js +26 -0
  180. package/dist/components/native-capabilities/local-auth-button.d.ts +33 -0
  181. package/dist/components/native-capabilities/local-auth-button.d.ts.map +1 -0
  182. package/dist/components/native-capabilities/local-auth-button.js +115 -0
  183. package/dist/components/native-capabilities/location-panel.d.ts +29 -0
  184. package/dist/components/native-capabilities/location-panel.d.ts.map +1 -0
  185. package/dist/components/native-capabilities/location-panel.js +146 -0
  186. package/dist/components/native-capabilities/microphone-meter.d.ts +35 -0
  187. package/dist/components/native-capabilities/microphone-meter.d.ts.map +1 -0
  188. package/dist/components/native-capabilities/microphone-meter.js +244 -0
  189. package/dist/components/native-capabilities/midi-monitor.d.ts +54 -0
  190. package/dist/components/native-capabilities/midi-monitor.d.ts.map +1 -0
  191. package/dist/components/native-capabilities/midi-monitor.js +534 -0
  192. package/dist/components/native-capabilities/native-capability-panel.d.ts +11 -0
  193. package/dist/components/native-capabilities/native-capability-panel.d.ts.map +1 -0
  194. package/dist/components/native-capabilities/native-capability-panel.js +28 -0
  195. package/dist/components/native-capabilities/notification-panel.d.ts +24 -0
  196. package/dist/components/native-capabilities/notification-panel.d.ts.map +1 -0
  197. package/dist/components/native-capabilities/notification-panel.js +124 -0
  198. package/dist/components/native-capabilities/power-blocker-controller.d.ts +19 -0
  199. package/dist/components/native-capabilities/power-blocker-controller.d.ts.map +1 -0
  200. package/dist/components/native-capabilities/power-blocker-controller.js +83 -0
  201. package/dist/components/native-capabilities/power-panel.d.ts +67 -0
  202. package/dist/components/native-capabilities/power-panel.d.ts.map +1 -0
  203. package/dist/components/native-capabilities/power-panel.js +309 -0
  204. package/dist/components/native-capabilities/readout.d.ts +10 -0
  205. package/dist/components/native-capabilities/readout.d.ts.map +1 -0
  206. package/dist/components/native-capabilities/readout.js +11 -0
  207. package/dist/components/native-capabilities/screen-share-preview.d.ts +36 -0
  208. package/dist/components/native-capabilities/screen-share-preview.d.ts.map +1 -0
  209. package/dist/components/native-capabilities/screen-share-preview.js +191 -0
  210. package/dist/components/native-capabilities/secure-storage-panel.d.ts +36 -0
  211. package/dist/components/native-capabilities/secure-storage-panel.d.ts.map +1 -0
  212. package/dist/components/native-capabilities/secure-storage-panel.js +193 -0
  213. package/dist/components/native-capabilities/serial-console.d.ts +64 -0
  214. package/dist/components/native-capabilities/serial-console.d.ts.map +1 -0
  215. package/dist/components/native-capabilities/serial-console.js +399 -0
  216. package/dist/components/native-capabilities/shortcut-recorder.d.ts +35 -0
  217. package/dist/components/native-capabilities/shortcut-recorder.d.ts.map +1 -0
  218. package/dist/components/native-capabilities/shortcut-recorder.js +217 -0
  219. package/dist/components/native-capabilities/stream-log.d.ts +35 -0
  220. package/dist/components/native-capabilities/stream-log.d.ts.map +1 -0
  221. package/dist/components/native-capabilities/stream-log.js +65 -0
  222. package/dist/components/native-capabilities/system-audio-monitor.d.ts +34 -0
  223. package/dist/components/native-capabilities/system-audio-monitor.d.ts.map +1 -0
  224. package/dist/components/native-capabilities/system-audio-monitor.js +275 -0
  225. package/dist/components/native-capabilities/usb-panel.d.ts +54 -0
  226. package/dist/components/native-capabilities/usb-panel.d.ts.map +1 -0
  227. package/dist/components/native-capabilities/usb-panel.js +363 -0
  228. package/dist/components/native-capabilities/use-capability.d.ts +20 -0
  229. package/dist/components/native-capabilities/use-capability.d.ts.map +1 -0
  230. package/dist/components/native-capabilities/use-capability.js +61 -0
  231. package/dist/components/ui/app-frame.d.ts +22 -0
  232. package/dist/components/ui/app-frame.d.ts.map +1 -0
  233. package/dist/components/ui/app-frame.js +56 -0
  234. package/dist/components/ui/button-group.d.ts +1 -1
  235. package/dist/components/ui/button.js +1 -1
  236. package/dist/components/ui/color-well.d.ts +13 -0
  237. package/dist/components/ui/color-well.d.ts.map +1 -0
  238. package/dist/components/ui/color-well.js +30 -0
  239. package/dist/components/ui/date-field.d.ts +19 -0
  240. package/dist/components/ui/date-field.d.ts.map +1 -0
  241. package/dist/components/ui/date-field.js +54 -0
  242. package/dist/components/ui/edge-fade.d.ts +11 -0
  243. package/dist/components/ui/edge-fade.d.ts.map +1 -0
  244. package/dist/components/ui/edge-fade.js +41 -0
  245. package/dist/components/ui/empty.js +1 -1
  246. package/dist/components/ui/field.d.ts +1 -1
  247. package/dist/components/ui/grid.d.ts +24 -0
  248. package/dist/components/ui/grid.d.ts.map +1 -0
  249. package/dist/components/ui/grid.js +234 -0
  250. package/dist/components/ui/icon-button.d.ts +15 -0
  251. package/dist/components/ui/icon-button.d.ts.map +1 -0
  252. package/dist/components/ui/icon-button.js +15 -0
  253. package/dist/components/ui/index.d.ts +19 -0
  254. package/dist/components/ui/index.d.ts.map +1 -1
  255. package/dist/components/ui/index.js +19 -0
  256. package/dist/components/ui/inspector.d.ts +15 -0
  257. package/dist/components/ui/inspector.d.ts.map +1 -0
  258. package/dist/components/ui/inspector.js +26 -0
  259. package/dist/components/ui/kbd.d.ts +1 -1
  260. package/dist/components/ui/list.d.ts +24 -0
  261. package/dist/components/ui/list.d.ts.map +1 -0
  262. package/dist/components/ui/list.js +224 -0
  263. package/dist/components/ui/message-scroller-layout-stability.d.ts +33 -0
  264. package/dist/components/ui/message-scroller-layout-stability.d.ts.map +1 -0
  265. package/dist/components/ui/message-scroller-layout-stability.js +153 -0
  266. package/dist/components/ui/message-scroller.d.ts +11 -0
  267. package/dist/components/ui/message-scroller.d.ts.map +1 -0
  268. package/dist/components/ui/message-scroller.js +37 -0
  269. package/dist/components/ui/notification-dot.d.ts +4 -0
  270. package/dist/components/ui/notification-dot.d.ts.map +1 -0
  271. package/dist/components/ui/notification-dot.js +7 -0
  272. package/dist/components/ui/number-input.d.ts +16 -0
  273. package/dist/components/ui/number-input.d.ts.map +1 -0
  274. package/dist/components/ui/number-input.js +56 -0
  275. package/dist/components/ui/panel.d.ts +18 -0
  276. package/dist/components/ui/panel.d.ts.map +1 -0
  277. package/dist/components/ui/panel.js +40 -0
  278. package/dist/components/ui/popover.js +1 -1
  279. package/dist/components/ui/search-field.d.ts +19 -0
  280. package/dist/components/ui/search-field.d.ts.map +1 -0
  281. package/dist/components/ui/search-field.js +64 -0
  282. package/dist/components/ui/segmented-control.d.ts +21 -0
  283. package/dist/components/ui/segmented-control.d.ts.map +1 -0
  284. package/dist/components/ui/segmented-control.js +61 -0
  285. package/dist/components/ui/sidebar.js +1 -1
  286. package/dist/components/ui/slider.d.ts +4 -1
  287. package/dist/components/ui/slider.d.ts.map +1 -1
  288. package/dist/components/ui/slider.js +2 -2
  289. package/dist/components/ui/sonner.d.ts +4 -3
  290. package/dist/components/ui/sonner.d.ts.map +1 -1
  291. package/dist/components/ui/sonner.js +7 -6
  292. package/dist/components/ui/split-view.d.ts +11 -0
  293. package/dist/components/ui/split-view.d.ts.map +1 -0
  294. package/dist/components/ui/split-view.js +13 -0
  295. package/dist/components/ui/status.d.ts +13 -0
  296. package/dist/components/ui/status.d.ts.map +1 -0
  297. package/dist/components/ui/status.js +36 -0
  298. package/dist/components/ui/table.d.ts +11 -2
  299. package/dist/components/ui/table.d.ts.map +1 -1
  300. package/dist/components/ui/table.js +28 -6
  301. package/dist/components/ui/text.d.ts +17 -0
  302. package/dist/components/ui/text.d.ts.map +1 -0
  303. package/dist/components/ui/text.js +55 -0
  304. package/dist/components/ui/toggle.js +1 -1
  305. package/dist/components/ui/toolbar.d.ts +20 -0
  306. package/dist/components/ui/toolbar.d.ts.map +1 -0
  307. package/dist/components/ui/toolbar.js +52 -0
  308. package/dist/index.d.ts +2 -0
  309. package/dist/index.d.ts.map +1 -1
  310. package/dist/index.js +4 -0
  311. package/dist/lib/frame-lifecycle.d.ts +28 -0
  312. package/dist/lib/frame-lifecycle.d.ts.map +1 -1
  313. package/dist/lib/frame-lifecycle.js +84 -0
  314. package/dist/lib/native-capabilities/access.d.ts +13 -0
  315. package/dist/lib/native-capabilities/access.d.ts.map +1 -0
  316. package/dist/lib/native-capabilities/access.js +53 -0
  317. package/dist/lib/native-capabilities/bluetooth-access.d.ts +14 -0
  318. package/dist/lib/native-capabilities/bluetooth-access.d.ts.map +1 -0
  319. package/dist/lib/native-capabilities/bluetooth-access.js +43 -0
  320. package/dist/lib/native-capabilities/bluetooth-connection.d.ts +19 -0
  321. package/dist/lib/native-capabilities/bluetooth-connection.d.ts.map +1 -0
  322. package/dist/lib/native-capabilities/bluetooth-connection.js +88 -0
  323. package/dist/lib/native-capabilities/bluetooth-gatt.d.ts +7 -0
  324. package/dist/lib/native-capabilities/bluetooth-gatt.d.ts.map +1 -0
  325. package/dist/lib/native-capabilities/bluetooth-gatt.js +77 -0
  326. package/dist/lib/native-capabilities/bluetooth-internal.d.ts +10 -0
  327. package/dist/lib/native-capabilities/bluetooth-internal.d.ts.map +1 -0
  328. package/dist/lib/native-capabilities/bluetooth-internal.js +105 -0
  329. package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts +33 -0
  330. package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts.map +1 -0
  331. package/dist/lib/native-capabilities/bluetooth-native-fallback.js +214 -0
  332. package/dist/lib/native-capabilities/bluetooth-types.d.ts +85 -0
  333. package/dist/lib/native-capabilities/bluetooth-types.d.ts.map +1 -0
  334. package/dist/lib/native-capabilities/bluetooth-types.js +2 -0
  335. package/dist/lib/native-capabilities/bluetooth.d.ts +7 -0
  336. package/dist/lib/native-capabilities/bluetooth.d.ts.map +1 -0
  337. package/dist/lib/native-capabilities/bluetooth.js +4 -0
  338. package/dist/lib/native-capabilities/bridge.d.ts +23 -0
  339. package/dist/lib/native-capabilities/bridge.d.ts.map +1 -0
  340. package/dist/lib/native-capabilities/bridge.js +266 -0
  341. package/dist/lib/native-capabilities/capabilities.d.ts +7 -0
  342. package/dist/lib/native-capabilities/capabilities.d.ts.map +1 -0
  343. package/dist/lib/native-capabilities/capabilities.js +95 -0
  344. package/dist/lib/native-capabilities/clipboard.d.ts +11 -0
  345. package/dist/lib/native-capabilities/clipboard.d.ts.map +1 -0
  346. package/dist/lib/native-capabilities/clipboard.js +58 -0
  347. package/dist/lib/native-capabilities/device-io-errors.d.ts +11 -0
  348. package/dist/lib/native-capabilities/device-io-errors.d.ts.map +1 -0
  349. package/dist/lib/native-capabilities/device-io-errors.js +82 -0
  350. package/dist/lib/native-capabilities/displays.d.ts +38 -0
  351. package/dist/lib/native-capabilities/displays.d.ts.map +1 -0
  352. package/dist/lib/native-capabilities/displays.js +12 -0
  353. package/dist/lib/native-capabilities/global-shortcuts.d.ts +86 -0
  354. package/dist/lib/native-capabilities/global-shortcuts.d.ts.map +1 -0
  355. package/dist/lib/native-capabilities/global-shortcuts.js +351 -0
  356. package/dist/lib/native-capabilities/haptics.d.ts +25 -0
  357. package/dist/lib/native-capabilities/haptics.d.ts.map +1 -0
  358. package/dist/lib/native-capabilities/haptics.js +18 -0
  359. package/dist/lib/native-capabilities/hid-native.d.ts +26 -0
  360. package/dist/lib/native-capabilities/hid-native.d.ts.map +1 -0
  361. package/dist/lib/native-capabilities/hid-native.js +229 -0
  362. package/dist/lib/native-capabilities/hid.d.ts +52 -0
  363. package/dist/lib/native-capabilities/hid.d.ts.map +1 -0
  364. package/dist/lib/native-capabilities/hid.js +163 -0
  365. package/dist/lib/native-capabilities/index.d.ts +40 -0
  366. package/dist/lib/native-capabilities/index.d.ts.map +1 -0
  367. package/dist/lib/native-capabilities/index.js +21 -0
  368. package/dist/lib/native-capabilities/local-authentication.d.ts +32 -0
  369. package/dist/lib/native-capabilities/local-authentication.d.ts.map +1 -0
  370. package/dist/lib/native-capabilities/local-authentication.js +46 -0
  371. package/dist/lib/native-capabilities/location.d.ts +49 -0
  372. package/dist/lib/native-capabilities/location.d.ts.map +1 -0
  373. package/dist/lib/native-capabilities/location.js +114 -0
  374. package/dist/lib/native-capabilities/media-permissions.d.ts +28 -0
  375. package/dist/lib/native-capabilities/media-permissions.d.ts.map +1 -0
  376. package/dist/lib/native-capabilities/media-permissions.js +37 -0
  377. package/dist/lib/native-capabilities/media.d.ts +17 -0
  378. package/dist/lib/native-capabilities/media.d.ts.map +1 -0
  379. package/dist/lib/native-capabilities/media.js +104 -0
  380. package/dist/lib/native-capabilities/midi-access.d.ts +13 -0
  381. package/dist/lib/native-capabilities/midi-access.d.ts.map +1 -0
  382. package/dist/lib/native-capabilities/midi-access.js +68 -0
  383. package/dist/lib/native-capabilities/midi-internal.d.ts +12 -0
  384. package/dist/lib/native-capabilities/midi-internal.d.ts.map +1 -0
  385. package/dist/lib/native-capabilities/midi-internal.js +88 -0
  386. package/dist/lib/native-capabilities/midi-native-fallback.d.ts +27 -0
  387. package/dist/lib/native-capabilities/midi-native-fallback.d.ts.map +1 -0
  388. package/dist/lib/native-capabilities/midi-native-fallback.js +127 -0
  389. package/dist/lib/native-capabilities/midi-ports.d.ts +6 -0
  390. package/dist/lib/native-capabilities/midi-ports.d.ts.map +1 -0
  391. package/dist/lib/native-capabilities/midi-ports.js +115 -0
  392. package/dist/lib/native-capabilities/midi-types.d.ts +25 -0
  393. package/dist/lib/native-capabilities/midi-types.d.ts.map +1 -0
  394. package/dist/lib/native-capabilities/midi-types.js +1 -0
  395. package/dist/lib/native-capabilities/midi.d.ts +6 -0
  396. package/dist/lib/native-capabilities/midi.d.ts.map +1 -0
  397. package/dist/lib/native-capabilities/midi.js +3 -0
  398. package/dist/lib/native-capabilities/native-device-io.d.ts +28 -0
  399. package/dist/lib/native-capabilities/native-device-io.d.ts.map +1 -0
  400. package/dist/lib/native-capabilities/native-device-io.js +91 -0
  401. package/dist/lib/native-capabilities/native-device-lifecycle.d.ts +13 -0
  402. package/dist/lib/native-capabilities/native-device-lifecycle.d.ts.map +1 -0
  403. package/dist/lib/native-capabilities/native-device-lifecycle.js +40 -0
  404. package/dist/lib/native-capabilities/notifications.d.ts +38 -0
  405. package/dist/lib/native-capabilities/notifications.d.ts.map +1 -0
  406. package/dist/lib/native-capabilities/notifications.js +50 -0
  407. package/dist/lib/native-capabilities/power-session.d.ts +113 -0
  408. package/dist/lib/native-capabilities/power-session.d.ts.map +1 -0
  409. package/dist/lib/native-capabilities/power-session.js +264 -0
  410. package/dist/lib/native-capabilities/secure-storage.d.ts +36 -0
  411. package/dist/lib/native-capabilities/secure-storage.d.ts.map +1 -0
  412. package/dist/lib/native-capabilities/secure-storage.js +64 -0
  413. package/dist/lib/native-capabilities/serial-native.d.ts +23 -0
  414. package/dist/lib/native-capabilities/serial-native.d.ts.map +1 -0
  415. package/dist/lib/native-capabilities/serial-native.js +181 -0
  416. package/dist/lib/native-capabilities/serial.d.ts +76 -0
  417. package/dist/lib/native-capabilities/serial.d.ts.map +1 -0
  418. package/dist/lib/native-capabilities/serial.js +215 -0
  419. package/dist/lib/native-capabilities/system-audio.d.ts +127 -0
  420. package/dist/lib/native-capabilities/system-audio.d.ts.map +1 -0
  421. package/dist/lib/native-capabilities/system-audio.js +330 -0
  422. package/dist/lib/native-capabilities/types.d.ts +62 -0
  423. package/dist/lib/native-capabilities/types.d.ts.map +1 -0
  424. package/dist/lib/native-capabilities/types.js +27 -0
  425. package/dist/lib/native-capabilities/usb-native.d.ts +39 -0
  426. package/dist/lib/native-capabilities/usb-native.d.ts.map +1 -0
  427. package/dist/lib/native-capabilities/usb-native.js +217 -0
  428. package/dist/lib/native-capabilities/usb.d.ts +85 -0
  429. package/dist/lib/native-capabilities/usb.d.ts.map +1 -0
  430. package/dist/lib/native-capabilities/usb.js +225 -0
  431. package/dist/lib/native-hardware/bluetooth-access.d.ts +14 -0
  432. package/dist/lib/native-hardware/bluetooth-access.d.ts.map +1 -0
  433. package/dist/lib/native-hardware/bluetooth-access.js +40 -0
  434. package/dist/lib/native-hardware/bluetooth-connection.d.ts +19 -0
  435. package/dist/lib/native-hardware/bluetooth-connection.d.ts.map +1 -0
  436. package/dist/lib/native-hardware/bluetooth-connection.js +88 -0
  437. package/dist/lib/native-hardware/bluetooth-gatt.d.ts +7 -0
  438. package/dist/lib/native-hardware/bluetooth-gatt.d.ts.map +1 -0
  439. package/dist/lib/native-hardware/bluetooth-gatt.js +77 -0
  440. package/dist/lib/native-hardware/bluetooth-internal.d.ts +10 -0
  441. package/dist/lib/native-hardware/bluetooth-internal.d.ts.map +1 -0
  442. package/dist/lib/native-hardware/bluetooth-internal.js +105 -0
  443. package/dist/lib/native-hardware/bluetooth-native-fallback.d.ts +33 -0
  444. package/dist/lib/native-hardware/bluetooth-native-fallback.d.ts.map +1 -0
  445. package/dist/lib/native-hardware/bluetooth-native-fallback.js +214 -0
  446. package/dist/lib/native-hardware/bluetooth-types.d.ts +85 -0
  447. package/dist/lib/native-hardware/bluetooth-types.d.ts.map +1 -0
  448. package/dist/lib/native-hardware/bluetooth-types.js +2 -0
  449. package/dist/lib/native-hardware/bluetooth.d.ts +7 -0
  450. package/dist/lib/native-hardware/bluetooth.d.ts.map +1 -0
  451. package/dist/lib/native-hardware/bluetooth.js +4 -0
  452. package/dist/lib/native-hardware/bridge.d.ts +23 -0
  453. package/dist/lib/native-hardware/bridge.d.ts.map +1 -0
  454. package/dist/lib/native-hardware/bridge.js +266 -0
  455. package/dist/lib/native-hardware/capabilities.d.ts +7 -0
  456. package/dist/lib/native-hardware/capabilities.d.ts.map +1 -0
  457. package/dist/lib/native-hardware/capabilities.js +95 -0
  458. package/dist/lib/native-hardware/clipboard.d.ts +11 -0
  459. package/dist/lib/native-hardware/clipboard.d.ts.map +1 -0
  460. package/dist/lib/native-hardware/clipboard.js +55 -0
  461. package/dist/lib/native-hardware/device-io-errors.d.ts +11 -0
  462. package/dist/lib/native-hardware/device-io-errors.d.ts.map +1 -0
  463. package/dist/lib/native-hardware/device-io-errors.js +82 -0
  464. package/dist/lib/native-hardware/displays.d.ts +38 -0
  465. package/dist/lib/native-hardware/displays.d.ts.map +1 -0
  466. package/dist/lib/native-hardware/displays.js +12 -0
  467. package/dist/lib/native-hardware/global-shortcuts.d.ts +86 -0
  468. package/dist/lib/native-hardware/global-shortcuts.d.ts.map +1 -0
  469. package/dist/lib/native-hardware/global-shortcuts.js +351 -0
  470. package/dist/lib/native-hardware/haptics.d.ts +25 -0
  471. package/dist/lib/native-hardware/haptics.d.ts.map +1 -0
  472. package/dist/lib/native-hardware/haptics.js +18 -0
  473. package/dist/lib/native-hardware/hid-native.d.ts +26 -0
  474. package/dist/lib/native-hardware/hid-native.d.ts.map +1 -0
  475. package/dist/lib/native-hardware/hid-native.js +229 -0
  476. package/dist/lib/native-hardware/hid.d.ts +52 -0
  477. package/dist/lib/native-hardware/hid.d.ts.map +1 -0
  478. package/dist/lib/native-hardware/hid.js +160 -0
  479. package/dist/lib/native-hardware/index.d.ts +38 -0
  480. package/dist/lib/native-hardware/index.d.ts.map +1 -0
  481. package/dist/lib/native-hardware/index.js +20 -0
  482. package/dist/lib/native-hardware/local-authentication.d.ts +32 -0
  483. package/dist/lib/native-hardware/local-authentication.d.ts.map +1 -0
  484. package/dist/lib/native-hardware/local-authentication.js +46 -0
  485. package/dist/lib/native-hardware/location.d.ts +49 -0
  486. package/dist/lib/native-hardware/location.d.ts.map +1 -0
  487. package/dist/lib/native-hardware/location.js +114 -0
  488. package/dist/lib/native-hardware/media-permissions.d.ts +28 -0
  489. package/dist/lib/native-hardware/media-permissions.d.ts.map +1 -0
  490. package/dist/lib/native-hardware/media-permissions.js +37 -0
  491. package/dist/lib/native-hardware/media.d.ts +17 -0
  492. package/dist/lib/native-hardware/media.d.ts.map +1 -0
  493. package/dist/lib/native-hardware/media.js +99 -0
  494. package/dist/lib/native-hardware/midi-access.d.ts +13 -0
  495. package/dist/lib/native-hardware/midi-access.d.ts.map +1 -0
  496. package/dist/lib/native-hardware/midi-access.js +66 -0
  497. package/dist/lib/native-hardware/midi-internal.d.ts +12 -0
  498. package/dist/lib/native-hardware/midi-internal.d.ts.map +1 -0
  499. package/dist/lib/native-hardware/midi-internal.js +88 -0
  500. package/dist/lib/native-hardware/midi-native-fallback.d.ts +27 -0
  501. package/dist/lib/native-hardware/midi-native-fallback.d.ts.map +1 -0
  502. package/dist/lib/native-hardware/midi-native-fallback.js +127 -0
  503. package/dist/lib/native-hardware/midi-ports.d.ts +6 -0
  504. package/dist/lib/native-hardware/midi-ports.d.ts.map +1 -0
  505. package/dist/lib/native-hardware/midi-ports.js +115 -0
  506. package/dist/lib/native-hardware/midi-types.d.ts +25 -0
  507. package/dist/lib/native-hardware/midi-types.d.ts.map +1 -0
  508. package/dist/lib/native-hardware/midi-types.js +1 -0
  509. package/dist/lib/native-hardware/midi.d.ts +6 -0
  510. package/dist/lib/native-hardware/midi.d.ts.map +1 -0
  511. package/dist/lib/native-hardware/midi.js +3 -0
  512. package/dist/lib/native-hardware/native-device-io.d.ts +28 -0
  513. package/dist/lib/native-hardware/native-device-io.d.ts.map +1 -0
  514. package/dist/lib/native-hardware/native-device-io.js +91 -0
  515. package/dist/lib/native-hardware/native-device-lifecycle.d.ts +13 -0
  516. package/dist/lib/native-hardware/native-device-lifecycle.d.ts.map +1 -0
  517. package/dist/lib/native-hardware/native-device-lifecycle.js +40 -0
  518. package/dist/lib/native-hardware/notifications.d.ts +38 -0
  519. package/dist/lib/native-hardware/notifications.d.ts.map +1 -0
  520. package/dist/lib/native-hardware/notifications.js +50 -0
  521. package/dist/lib/native-hardware/power-session.d.ts +113 -0
  522. package/dist/lib/native-hardware/power-session.d.ts.map +1 -0
  523. package/dist/lib/native-hardware/power-session.js +264 -0
  524. package/dist/lib/native-hardware/secure-storage.d.ts +36 -0
  525. package/dist/lib/native-hardware/secure-storage.d.ts.map +1 -0
  526. package/dist/lib/native-hardware/secure-storage.js +64 -0
  527. package/dist/lib/native-hardware/serial-native.d.ts +23 -0
  528. package/dist/lib/native-hardware/serial-native.d.ts.map +1 -0
  529. package/dist/lib/native-hardware/serial-native.js +181 -0
  530. package/dist/lib/native-hardware/serial.d.ts +76 -0
  531. package/dist/lib/native-hardware/serial.d.ts.map +1 -0
  532. package/dist/lib/native-hardware/serial.js +212 -0
  533. package/dist/lib/native-hardware/system-audio.d.ts +127 -0
  534. package/dist/lib/native-hardware/system-audio.d.ts.map +1 -0
  535. package/dist/lib/native-hardware/system-audio.js +330 -0
  536. package/dist/lib/native-hardware/types.d.ts +62 -0
  537. package/dist/lib/native-hardware/types.d.ts.map +1 -0
  538. package/dist/lib/native-hardware/types.js +27 -0
  539. package/dist/lib/native-hardware/usb-native.d.ts +39 -0
  540. package/dist/lib/native-hardware/usb-native.d.ts.map +1 -0
  541. package/dist/lib/native-hardware/usb-native.js +217 -0
  542. package/dist/lib/native-hardware/usb.d.ts +85 -0
  543. package/dist/lib/native-hardware/usb.d.ts.map +1 -0
  544. package/dist/lib/native-hardware/usb.js +222 -0
  545. package/docs/README.md +37 -0
  546. package/docs/accessibility.md +32 -0
  547. package/docs/app-anatomy.md +72 -0
  548. package/docs/component-catalog.md +59 -0
  549. package/docs/component-guide-template.md +37 -0
  550. package/docs/design-tokens.md +172 -0
  551. package/docs/foundations.md +56 -0
  552. package/docs/native-integration.md +33 -0
  553. package/docs/standalone-app-windows.md +128 -0
  554. package/package.json +9 -3
  555. package/src/components/ui/alert.md +55 -0
  556. package/src/components/ui/app-frame.md +33 -0
  557. package/src/components/ui/badge.md +57 -0
  558. package/src/components/ui/button.md +76 -0
  559. package/src/components/ui/color-well.md +11 -0
  560. package/src/components/ui/combobox.md +43 -0
  561. package/src/components/ui/date-field.md +32 -0
  562. package/src/components/ui/edge-fade.md +7 -0
  563. package/src/components/ui/empty.md +82 -0
  564. package/src/components/ui/field.md +77 -0
  565. package/src/components/ui/grid.md +105 -0
  566. package/src/components/ui/icon-button.md +36 -0
  567. package/src/components/ui/inspector.md +11 -0
  568. package/src/components/ui/item.md +87 -0
  569. package/src/components/ui/list.md +107 -0
  570. package/src/components/ui/notification-dot.md +7 -0
  571. package/src/components/ui/number-input.md +19 -0
  572. package/src/components/ui/panel.md +11 -0
  573. package/src/components/ui/resizable.md +66 -0
  574. package/src/components/ui/scroll-area.md +68 -0
  575. package/src/components/ui/search-field.md +33 -0
  576. package/src/components/ui/segmented-control.md +39 -0
  577. package/src/components/ui/sidebar.md +113 -0
  578. package/src/components/ui/sonner.md +37 -0
  579. package/src/components/ui/split-view.md +15 -0
  580. package/src/components/ui/status.md +12 -0
  581. package/src/components/ui/table.md +35 -0
  582. package/src/components/ui/tabs.md +66 -0
  583. package/src/components/ui/text.md +17 -0
  584. package/src/components/ui/toggle-group.md +80 -0
  585. package/src/components/ui/toggle.md +73 -0
  586. package/src/components/ui/toolbar.md +21 -0
  587. package/src/styles/index.css +868 -3
@@ -0,0 +1,363 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { RefreshCw, RotateCcw, Trash2, Usb } from 'lucide-react';
4
+ import { useCallback, useEffect, useRef, useState } from 'react';
5
+ import { NativeCapabilityBridgeError, clearMoldableUsbHalt, closeMoldableUsbDevice, forgetMoldableUsbDevice, getMoldableUsbDevices, openMoldableUsbDevice, readMoldableUsbControlTransfer, readMoldableUsbEndpoint, requestMoldableUsbDevice, resetMoldableUsbDevice, writeMoldableUsbControlTransfer, writeMoldableUsbEndpoint, } from '../../lib/native-capabilities';
6
+ import { Button } from '../ui/button';
7
+ import { Input } from '../ui/input';
8
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../ui/select';
9
+ import { Spinner } from '../ui/spinner';
10
+ import { CapabilityBadge } from './capability-badge';
11
+ import { formatHexBytes, parseHexBytes, parseIntegerInput, } from './device-io-controls';
12
+ import { DeviceList, DeviceListEmpty, DeviceListItem } from './device-list';
13
+ import { NativeCapabilityPanel, NativeCapabilityPanelAction, NativeCapabilityPanelContent, NativeCapabilityPanelFooter, NativeCapabilityPanelHeader, NativeCapabilityPanelIcon, NativeCapabilityPanelTitle, } from './native-capability-panel';
14
+ import { Readout, ReadoutItem } from './readout';
15
+ function toError(cause) {
16
+ return cause instanceof Error ? cause : new Error(String(cause));
17
+ }
18
+ function formatHexId(value) {
19
+ return `0x${value.toString(16).padStart(4, '0')}`;
20
+ }
21
+ function usbDeviceDescriptionId(device) {
22
+ return [
23
+ device.vendorId,
24
+ device.productId,
25
+ device.serialNumber ?? '',
26
+ device.productName ?? '',
27
+ ].join(':');
28
+ }
29
+ /**
30
+ * USB state machine behind `UsbDevicePanel`: granted-device enumeration,
31
+ * chooser requests, minimal-claim open/close tracking. Use directly to build
32
+ * custom USB UI on the same best-effort error handling.
33
+ */
34
+ export function useMoldableUsb(options = {}) {
35
+ const [devices, setDevices] = useState([]);
36
+ const [status, setStatus] = useState('idle');
37
+ const [error, setError] = useState(null);
38
+ const [openDeviceIds, setOpenDeviceIds] = useState([]);
39
+ const [nativeDeviceChoices, setNativeDeviceChoices] = useState([]);
40
+ const openDevicesRef = useRef(new Map());
41
+ const idsRef = useRef(new WeakMap());
42
+ const idCounterRef = useRef(0);
43
+ const pendingSelectionRef = useRef(null);
44
+ const generationRef = useRef(0);
45
+ const unmountedRef = useRef(false);
46
+ const optionsRef = useRef(options);
47
+ optionsRef.current = options;
48
+ const deviceId = useCallback((device) => {
49
+ let id = idsRef.current.get(device);
50
+ if (!id) {
51
+ id = `usb-${++idCounterRef.current}`;
52
+ idsRef.current.set(device, id);
53
+ }
54
+ return id;
55
+ }, []);
56
+ const refresh = useCallback(async () => {
57
+ const generation = ++generationRef.current;
58
+ setStatus('loading');
59
+ setError(null);
60
+ try {
61
+ const known = await getMoldableUsbDevices();
62
+ if (generationRef.current !== generation)
63
+ return;
64
+ setDevices((previous) => [
65
+ ...known,
66
+ ...previous.filter((device) => openDevicesRef.current.has(deviceId(device)) &&
67
+ !known.includes(device)),
68
+ ]);
69
+ setStatus('idle');
70
+ }
71
+ catch (cause) {
72
+ if (generationRef.current !== generation)
73
+ return;
74
+ if (cause instanceof NativeCapabilityBridgeError &&
75
+ cause.code === 'unsupported') {
76
+ // No WebUSB enumeration here (native fallback runtime). Devices
77
+ // granted through `request` stay listed; this is not an error.
78
+ setStatus('idle');
79
+ return;
80
+ }
81
+ setError(toError(cause));
82
+ setStatus('error');
83
+ }
84
+ }, [deviceId]);
85
+ const handleDisconnect = useCallback((device) => {
86
+ if (unmountedRef.current)
87
+ return;
88
+ const id = deviceId(device);
89
+ const record = openDevicesRef.current.get(id);
90
+ if (record) {
91
+ device.removeEventListener('disconnect', record.onDisconnect);
92
+ }
93
+ openDevicesRef.current.delete(id);
94
+ setOpenDeviceIds((previous) => previous.filter((existing) => existing !== id));
95
+ setDevices((previous) => previous.filter((existing) => existing !== device));
96
+ }, [deviceId]);
97
+ const chooseNativeDevice = useCallback((devices) => new Promise((resolve, reject) => {
98
+ pendingSelectionRef.current = { devices, resolve, reject };
99
+ setNativeDeviceChoices(devices);
100
+ }), []);
101
+ const selectNativeDevice = useCallback((device) => {
102
+ const pending = pendingSelectionRef.current;
103
+ if (!pending || !pending.devices.includes(device))
104
+ return;
105
+ pendingSelectionRef.current = null;
106
+ setNativeDeviceChoices([]);
107
+ pending.resolve(device);
108
+ }, []);
109
+ const cancelNativeSelection = useCallback(() => {
110
+ const pending = pendingSelectionRef.current;
111
+ if (!pending)
112
+ return;
113
+ pendingSelectionRef.current = null;
114
+ setNativeDeviceChoices([]);
115
+ pending.reject(new NativeCapabilityBridgeError({
116
+ code: 'cancelled',
117
+ message: 'USB device selection was cancelled.',
118
+ retryable: true,
119
+ }));
120
+ }, []);
121
+ const request = useCallback(async (filters) => {
122
+ const generation = ++generationRef.current;
123
+ setStatus('requesting');
124
+ setError(null);
125
+ try {
126
+ const device = await requestMoldableUsbDevice({
127
+ filters: filters ?? optionsRef.current.filters ?? [],
128
+ selectNativeDevice: optionsRef.current.selectNativeDevice ?? chooseNativeDevice,
129
+ });
130
+ if (generationRef.current !== generation)
131
+ return;
132
+ setDevices((previous) => previous.includes(device) ? previous : [...previous, device]);
133
+ setStatus('idle');
134
+ return device;
135
+ }
136
+ catch (cause) {
137
+ if (generationRef.current !== generation)
138
+ return;
139
+ if (cause instanceof NativeCapabilityBridgeError &&
140
+ (cause.code === 'cancelled' || cause.code === 'aborted')) {
141
+ // The user dismissed the chooser; that is not an error state.
142
+ setStatus('idle');
143
+ return;
144
+ }
145
+ setError(toError(cause));
146
+ setStatus('error');
147
+ }
148
+ }, [chooseNativeDevice]);
149
+ const open = useCallback(async (device) => {
150
+ const id = deviceId(device);
151
+ if (openDevicesRef.current.has(id))
152
+ return;
153
+ try {
154
+ await openMoldableUsbDevice(device, optionsRef.current.openOptions);
155
+ if (unmountedRef.current) {
156
+ void closeMoldableUsbDevice(device, optionsRef.current.openOptions?.claimInterfaces).catch(() => undefined);
157
+ return;
158
+ }
159
+ const onDisconnect = () => handleDisconnect(device);
160
+ device.addEventListener('disconnect', onDisconnect, { once: true });
161
+ openDevicesRef.current.set(id, {
162
+ device,
163
+ onDisconnect,
164
+ releaseInterfaces: optionsRef.current.openOptions?.claimInterfaces ?? [],
165
+ });
166
+ setOpenDeviceIds((previous) => previous.includes(id) ? previous : [...previous, id]);
167
+ setError(null);
168
+ setStatus('idle');
169
+ optionsRef.current.onDeviceOpen?.(device);
170
+ }
171
+ catch (cause) {
172
+ if (unmountedRef.current)
173
+ return;
174
+ setError(toError(cause));
175
+ setStatus('error');
176
+ }
177
+ }, [deviceId, handleDisconnect]);
178
+ const close = useCallback(async (device) => {
179
+ const id = deviceId(device);
180
+ const record = openDevicesRef.current.get(id);
181
+ try {
182
+ await closeMoldableUsbDevice(device, record?.releaseInterfaces);
183
+ if (record) {
184
+ device.removeEventListener('disconnect', record.onDisconnect);
185
+ }
186
+ openDevicesRef.current.delete(id);
187
+ setOpenDeviceIds((previous) => previous.filter((existing) => existing !== id));
188
+ setError(null);
189
+ setStatus('idle');
190
+ return true;
191
+ }
192
+ catch (cause) {
193
+ if (record)
194
+ record.releaseInterfaces = [];
195
+ if (unmountedRef.current)
196
+ return false;
197
+ setError(toError(cause));
198
+ setStatus('error');
199
+ return false;
200
+ }
201
+ }, [deviceId]);
202
+ const runOperation = useCallback(async (operation) => {
203
+ setError(null);
204
+ try {
205
+ const result = await operation();
206
+ if (!unmountedRef.current)
207
+ setStatus('idle');
208
+ return result;
209
+ }
210
+ catch (cause) {
211
+ if (!unmountedRef.current) {
212
+ setError(toError(cause));
213
+ setStatus('error');
214
+ }
215
+ throw cause;
216
+ }
217
+ }, []);
218
+ const forget = useCallback(async (device) => {
219
+ const id = deviceId(device);
220
+ if ((openDevicesRef.current.has(id) || device.opened) &&
221
+ !(await close(device))) {
222
+ return false;
223
+ }
224
+ try {
225
+ await runOperation(() => forgetMoldableUsbDevice(device));
226
+ if (unmountedRef.current)
227
+ return false;
228
+ setDevices((previous) => previous.filter((known) => known !== device));
229
+ return true;
230
+ }
231
+ catch {
232
+ return false;
233
+ }
234
+ }, [close, deviceId, runOperation]);
235
+ useEffect(() => {
236
+ unmountedRef.current = false;
237
+ void refresh();
238
+ const liveGeneration = generationRef;
239
+ const openDevices = openDevicesRef.current;
240
+ return () => {
241
+ unmountedRef.current = true;
242
+ liveGeneration.current++;
243
+ const pending = pendingSelectionRef.current;
244
+ pendingSelectionRef.current = null;
245
+ pending?.reject(new NativeCapabilityBridgeError({
246
+ code: 'aborted',
247
+ message: 'USB device selection was interrupted.',
248
+ retryable: true,
249
+ }));
250
+ const stillOpen = [...openDevices.values()];
251
+ openDevices.clear();
252
+ for (const { device, onDisconnect, releaseInterfaces } of stillOpen) {
253
+ device.removeEventListener('disconnect', onDisconnect);
254
+ void closeMoldableUsbDevice(device, releaseInterfaces).catch(() => undefined);
255
+ }
256
+ };
257
+ }, [refresh]);
258
+ return {
259
+ devices,
260
+ status,
261
+ error,
262
+ openDeviceIds,
263
+ nativeDeviceChoices,
264
+ deviceId,
265
+ refresh,
266
+ request,
267
+ selectNativeDevice,
268
+ cancelNativeSelection,
269
+ open,
270
+ close,
271
+ forget,
272
+ readEndpoint: (device, endpoint, length) => runOperation(() => readMoldableUsbEndpoint(device, endpoint, length)),
273
+ writeEndpoint: (device, endpoint, data) => runOperation(() => writeMoldableUsbEndpoint(device, endpoint, data)),
274
+ readControl: (device, setup, length) => runOperation(() => readMoldableUsbControlTransfer(device, setup, length)),
275
+ writeControl: (device, setup, data) => runOperation(() => writeMoldableUsbControlTransfer(device, setup, data)),
276
+ clearHalt: (device, direction, endpoint) => runOperation(() => clearMoldableUsbHalt(device, direction, endpoint)),
277
+ reset: (device) => runOperation(() => resetMoldableUsbDevice(device)),
278
+ };
279
+ }
280
+ function UsbDeviceControls({ device, usb }) {
281
+ const [endpoint, setEndpoint] = useState('1');
282
+ const [length, setLength] = useState('64');
283
+ const [payload, setPayload] = useState('');
284
+ const [requestType, setRequestType] = useState('vendor');
285
+ const [recipient, setRecipient] = useState('device');
286
+ const [request, setRequest] = useState('0');
287
+ const [value, setValue] = useState('0');
288
+ const [index, setIndex] = useState('0');
289
+ const [result, setResult] = useState('Ready');
290
+ const [busy, setBusy] = useState(false);
291
+ const run = async (operation) => {
292
+ setBusy(true);
293
+ try {
294
+ setResult(await operation());
295
+ }
296
+ catch (cause) {
297
+ setResult(toError(cause).message);
298
+ }
299
+ finally {
300
+ setBusy(false);
301
+ }
302
+ };
303
+ const endpointNumber = () => parseIntegerInput(endpoint, 'Endpoint', 1, 15);
304
+ const transferLength = () => parseIntegerInput(length, 'Length', 1, 65_535);
305
+ const setup = () => ({
306
+ requestType,
307
+ recipient,
308
+ request: parseIntegerInput(request, 'Request', 0, 255),
309
+ value: parseIntegerInput(value, 'Value', 0, 65_535),
310
+ index: parseIntegerInput(index, 'Index', 0, 65_535),
311
+ });
312
+ return (_jsxs("div", { "data-slot": "usb-device-controls", className: "bg-muted/30 mt-2 space-y-3 rounded-md border p-2.5", children: [_jsxs("div", { className: "grid gap-2 sm:grid-cols-3", children: [_jsx(Input, { "aria-label": "USB endpoint number", value: endpoint, onChange: (event) => setEndpoint(event.target.value), placeholder: "Endpoint", className: "h-8 font-mono text-xs" }), _jsx(Input, { "aria-label": "USB transfer length", value: length, onChange: (event) => setLength(event.target.value), placeholder: "Length", className: "h-8 font-mono text-xs" }), _jsx(Input, { "aria-label": "USB endpoint payload", value: payload, onChange: (event) => setPayload(event.target.value), placeholder: "Hex payload", className: "h-8 font-mono text-xs" })] }), _jsxs("div", { className: "flex flex-wrap gap-1.5", children: [_jsx(Button, { size: "xs", variant: "outline", disabled: busy, onClick: () => void run(async () => {
313
+ const transfer = await usb.readEndpoint(device, endpointNumber(), transferLength());
314
+ return `Endpoint IN · ${transfer.status} · ${formatHexBytes(transfer.data)}`;
315
+ }), children: "Endpoint IN" }), _jsx(Button, { size: "xs", variant: "outline", disabled: busy, onClick: () => void run(async () => {
316
+ const transfer = await usb.writeEndpoint(device, endpointNumber(), parseHexBytes(payload));
317
+ return `Endpoint OUT · ${transfer.status} · ${transfer.bytesWritten ?? 0} bytes`;
318
+ }), children: "Endpoint OUT" }), _jsx(Button, { size: "xs", variant: "ghost", disabled: busy, onClick: () => void run(async () => {
319
+ await usb.clearHalt(device, 'in', endpointNumber());
320
+ return 'IN halt cleared';
321
+ }), children: "Clear IN halt" }), _jsx(Button, { size: "xs", variant: "ghost", disabled: busy, onClick: () => void run(async () => {
322
+ await usb.clearHalt(device, 'out', endpointNumber());
323
+ return 'OUT halt cleared';
324
+ }), children: "Clear OUT halt" })] }), _jsxs("div", { className: "grid gap-2 sm:grid-cols-5", children: [_jsxs(Select, { value: requestType, onValueChange: (next) => setRequestType(next), children: [_jsx(SelectTrigger, { size: "sm", "aria-label": "USB control request type", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "standard", children: "Standard" }), _jsx(SelectItem, { value: "class", children: "Class" }), _jsx(SelectItem, { value: "vendor", children: "Vendor" })] })] }), _jsxs(Select, { value: recipient, onValueChange: (next) => setRecipient(next), children: [_jsx(SelectTrigger, { size: "sm", "aria-label": "USB control recipient", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "device", children: "Device" }), _jsx(SelectItem, { value: "interface", children: "Interface" }), _jsx(SelectItem, { value: "endpoint", children: "Endpoint" }), _jsx(SelectItem, { value: "other", children: "Other" })] })] }), [
325
+ ['Request', request, setRequest],
326
+ ['Value', value, setValue],
327
+ ['Index', index, setIndex],
328
+ ].map(([label, current, update]) => (_jsx(Input, { "aria-label": `USB control ${String(label).toLowerCase()}`, value: current, onChange: (event) => update(event.target.value), placeholder: label, className: "h-8 font-mono text-xs" }, label)))] }), _jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [_jsx(Button, { size: "xs", variant: "outline", disabled: busy, onClick: () => void run(async () => {
329
+ const transfer = await usb.readControl(device, setup(), transferLength());
330
+ return `Control IN · ${transfer.status} · ${formatHexBytes(transfer.data)}`;
331
+ }), children: "Control IN" }), _jsx(Button, { size: "xs", variant: "outline", disabled: busy, onClick: () => void run(async () => {
332
+ const transfer = await usb.writeControl(device, setup(), parseHexBytes(payload));
333
+ return `Control OUT · ${transfer.status} · ${transfer.bytesWritten ?? 0} bytes`;
334
+ }), children: "Control OUT" }), _jsxs(Button, { size: "xs", variant: "ghost", disabled: busy, onClick: () => void run(async () => {
335
+ await usb.reset(device);
336
+ return 'Device reset';
337
+ }), children: [_jsx(RotateCcw, {}), "Reset"] }), _jsx("span", { className: "text-muted-foreground ml-auto truncate font-mono text-[10px]", children: busy ? 'Working…' : result })] })] }));
338
+ }
339
+ /**
340
+ * USB device panel: request access, list granted devices, open/close each
341
+ * with minimal claims, and read out live device details while open.
342
+ */
343
+ function UsbDevicePanel({ className, filters, selectNativeDevice, openOptions, onDeviceOpen, ...props }) {
344
+ const usb = useMoldableUsb({
345
+ filters,
346
+ selectNativeDevice,
347
+ openOptions,
348
+ onDeviceOpen,
349
+ });
350
+ const requesting = usb.status === 'requesting';
351
+ const loading = usb.status === 'loading';
352
+ return (_jsxs(NativeCapabilityPanel, { "data-slot": "usb-device-panel", "data-status": usb.status, className: className, ...props, children: [_jsxs(NativeCapabilityPanelHeader, { children: [_jsx(NativeCapabilityPanelIcon, { children: _jsx(Usb, {}) }), _jsx(NativeCapabilityPanelTitle, { children: "USB" }), _jsx(CapabilityBadge, { capability: "usb" }), _jsxs(NativeCapabilityPanelAction, { children: [_jsxs(Button, { size: "sm", disabled: requesting, onClick: () => void usb.request(), children: [requesting ? _jsx(Spinner, {}) : _jsx(Usb, {}), requesting ? 'Requesting…' : 'Request device'] }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Refresh devices", disabled: loading || requesting, onClick: () => void usb.refresh(), children: _jsx(RefreshCw, { className: loading ? 'animate-spin motion-reduce:animate-none' : undefined }) })] })] }), _jsxs(NativeCapabilityPanelContent, { children: [usb.nativeDeviceChoices.length > 0 ? (_jsxs("div", { "data-slot": "usb-native-device-picker", className: "bg-muted/30 mb-4 space-y-2 rounded-lg border p-3", children: [_jsx("p", { className: "text-sm font-medium", children: "Choose a USB device" }), _jsx("p", { className: "text-muted-foreground text-xs", children: "More than one native device matched. Select the device explicitly." }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [usb.nativeDeviceChoices.map((device, index) => (_jsxs(Button, { size: "xs", variant: "outline", onClick: () => usb.selectNativeDevice(device), children: [device.productName || 'USB device', " \u00B7", ' ', formatHexId(device.vendorId), ":", formatHexId(device.productId)] }, `${usbDeviceDescriptionId(device)}:${index}`))), _jsx(Button, { size: "xs", variant: "ghost", onClick: usb.cancelNativeSelection, children: "Cancel" })] })] })) : null, _jsx(DeviceList, { children: usb.devices.length === 0 ? (_jsxs(DeviceListEmpty, { icon: _jsx(Usb, {}), children: [_jsx("span", { className: "font-medium", children: "No devices yet" }), _jsx("span", { className: "text-muted-foreground/70 text-xs", children: "Request access to a USB device to get started." })] })) : (usb.devices.map((device, index) => {
353
+ const id = usb.deviceId(device);
354
+ const open = usb.openDeviceIds.includes(id) || device.opened;
355
+ return (_jsx(DeviceListItem, { icon: _jsx(Usb, {}), name: device.productName || 'USB device', description: `${formatHexId(device.vendorId)}:${formatHexId(device.productId)}` +
356
+ (device.manufacturerName
357
+ ? ` · ${device.manufacturerName}`
358
+ : ''), connected: open, action: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Button, { size: "xs", variant: "outline", onClick: () => void (open ? usb.close(device) : usb.open(device)), children: open ? 'Close' : 'Open' }), _jsx(Button, { size: "icon-xs", variant: "ghost", "aria-label": `Forget ${device.productName || 'USB device'}`, onClick: () => void usb.forget(device), children: _jsx(Trash2, {}) })] }), children: open ? (_jsxs("div", { "data-slot": "usb-device-details", className: "animate-in fade-in slide-in-from-top-1 bg-muted/30 mt-2 rounded-md border p-2.5 duration-200 motion-reduce:animate-none", children: [_jsxs(Readout, { className: "gap-y-2 sm:grid-cols-4", children: [_jsx(ReadoutItem, { label: "Configuration", value: device.configuration?.configurationValue ?? null }), _jsx(ReadoutItem, { label: "Vendor ID", value: formatHexId(device.vendorId) }), _jsx(ReadoutItem, { label: "Product ID", value: formatHexId(device.productId) }), _jsx(ReadoutItem, { label: "Serial", value: device.serialNumber ?? null })] }), _jsx(UsbDeviceControls, { device: device, usb: usb })] })) : null }, `${id}:${index}`));
359
+ })) })] }), _jsxs(NativeCapabilityPanelFooter, { children: [usb.error ? (_jsx("span", { className: "text-status-error truncate", children: usb.error.message })) : (_jsx("span", { className: "truncate", children: usb.devices.length === 0
360
+ ? 'No devices authorized'
361
+ : `${usb.devices.length} device${usb.devices.length === 1 ? '' : 's'} known` })), _jsxs("span", { className: "ml-auto shrink-0 font-mono tabular-nums", children: [usb.openDeviceIds.length, " open"] })] })] }));
362
+ }
363
+ export { UsbDevicePanel };
@@ -0,0 +1,20 @@
1
+ import { type NativeCapabilityDescriptor, type NativeCapabilityId, type NativeCapabilityManifest } from '../../lib/native-capabilities';
2
+ export type MoldableCapabilityStatus = 'checking' | 'supported' | 'partial' | 'unsupported' | 'unavailable';
3
+ /**
4
+ * Loads the native capability manifest once per page and shares it across all
5
+ * hardware components. Pass `force` to bypass the cache (e.g. after a grant).
6
+ */
7
+ export declare function loadMoldableCapabilities(force?: boolean): Promise<NativeCapabilityManifest>;
8
+ export interface MoldableCapability {
9
+ status: MoldableCapabilityStatus;
10
+ descriptor: NativeCapabilityDescriptor | null;
11
+ manifest: NativeCapabilityManifest | null;
12
+ error: Error | null;
13
+ refresh: () => void;
14
+ }
15
+ /**
16
+ * Reads the support level for one native capability. `unavailable` means the
17
+ * manifest could not be loaded at all (typically: not running inside Moldable).
18
+ */
19
+ export declare function useMoldableCapability(id: NativeCapabilityId): MoldableCapability;
20
+ //# sourceMappingURL=use-capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-capability.d.ts","sourceRoot":"","sources":["../../../src/components/native-capabilities/use-capability.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAE9B,MAAM,+BAA+B,CAAA;AAEtC,MAAM,MAAM,wBAAwB,GAChC,UAAU,GACV,WAAW,GACX,SAAS,GACT,aAAa,GACb,aAAa,CAAA;AAIjB;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,UAAQ,GACZ,OAAO,CAAC,wBAAwB,CAAC,CAUnC;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,wBAAwB,CAAA;IAChC,UAAU,EAAE,0BAA0B,GAAG,IAAI,CAAA;IAC7C,QAAQ,EAAE,wBAAwB,GAAG,IAAI,CAAA;IACzC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,kBAAkB,GACrB,kBAAkB,CA4CpB"}
@@ -0,0 +1,61 @@
1
+ 'use client';
2
+ import { useCallback, useEffect, useRef, useState } from 'react';
3
+ import { getMoldableNativeCapabilities, } from '../../lib/native-capabilities';
4
+ let manifestPromise = null;
5
+ /**
6
+ * Loads the native capability manifest once per page and shares it across all
7
+ * hardware components. Pass `force` to bypass the cache (e.g. after a grant).
8
+ */
9
+ export function loadMoldableCapabilities(force = false) {
10
+ if (force || !manifestPromise) {
11
+ manifestPromise = getMoldableNativeCapabilities().catch((error) => {
12
+ manifestPromise = null;
13
+ throw error;
14
+ });
15
+ }
16
+ return manifestPromise;
17
+ }
18
+ /**
19
+ * Reads the support level for one native capability. `unavailable` means the
20
+ * manifest could not be loaded at all (typically: not running inside Moldable).
21
+ */
22
+ export function useMoldableCapability(id) {
23
+ const [manifest, setManifest] = useState(null);
24
+ const [error, setError] = useState(null);
25
+ const [checking, setChecking] = useState(true);
26
+ const generation = useRef(0);
27
+ const load = useCallback((force) => {
28
+ const current = ++generation.current;
29
+ setChecking(true);
30
+ setError(null);
31
+ loadMoldableCapabilities(force)
32
+ .then((value) => {
33
+ if (generation.current !== current)
34
+ return;
35
+ setManifest(value);
36
+ setChecking(false);
37
+ })
38
+ .catch((cause) => {
39
+ if (generation.current !== current)
40
+ return;
41
+ setManifest(null);
42
+ setError(cause instanceof Error ? cause : new Error(String(cause)));
43
+ setChecking(false);
44
+ });
45
+ }, []);
46
+ useEffect(() => {
47
+ load(false);
48
+ const liveGeneration = generation;
49
+ return () => {
50
+ liveGeneration.current++;
51
+ };
52
+ }, [load]);
53
+ const refresh = useCallback(() => load(true), [load]);
54
+ const descriptor = manifest ? manifest.capabilities[id] : null;
55
+ const status = checking
56
+ ? 'checking'
57
+ : descriptor
58
+ ? descriptor.support
59
+ : 'unavailable';
60
+ return { status, descriptor, manifest, error, refresh };
61
+ }
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ export type AppFrameMode = 'auto' | 'embedded' | 'window';
3
+ declare function resolveAppFrameMode(mode: AppFrameMode): Exclude<AppFrameMode, 'auto'>;
4
+ export interface AppFrameProps extends React.ComponentProps<'div'> {
5
+ /**
6
+ * `auto` detects whether the app is hosted in a frame. Set an explicit mode
7
+ * in catalogs, previews, and tests where the runtime environment is ambiguous.
8
+ */
9
+ mode?: AppFrameMode;
10
+ }
11
+ declare function AppFrame({ mode, className, style, ...props }: AppFrameProps): import("react/jsx-runtime").JSX.Element;
12
+ export type AppFrameTitlebarProps = React.ComponentPropsWithoutRef<'header'>;
13
+ declare function AppFrameTitlebar({ className, style, ...props }: AppFrameTitlebarProps): import("react/jsx-runtime").JSX.Element;
14
+ declare function AppFrameToolbar({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
15
+ export interface AppFrameContentProps extends React.ComponentPropsWithoutRef<'main'> {
16
+ scrollable?: boolean;
17
+ chatSafe?: boolean;
18
+ }
19
+ declare function AppFrameContent({ scrollable, chatSafe, className, style, ...props }: AppFrameContentProps): import("react/jsx-runtime").JSX.Element;
20
+ declare function AppFrameStatusbar({ className, style, ...props }: React.ComponentPropsWithoutRef<'footer'>): import("react/jsx-runtime").JSX.Element;
21
+ export { AppFrame, AppFrameContent, AppFrameStatusbar, AppFrameTitlebar, AppFrameToolbar, resolveAppFrameMode, };
22
+ //# sourceMappingURL=app-frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-frame.d.ts","sourceRoot":"","sources":["../../../src/components/ui/app-frame.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEzD,iBAAS,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAM9E;AAED,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAChE;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB;AAED,iBAAS,QAAQ,CAAC,EAChB,IAAa,EACb,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,aAAa,2CA+Bf;AAED,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAA;AAE5E,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,qBAAqB,2CAoBvB;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,2CAWvC;AAED,MAAM,WAAW,oBACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,iBAAS,eAAe,CAAC,EACvB,UAAiB,EACjB,QAAe,EACf,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAoBtB;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,2CAgB1C;AAED,OAAO,EACL,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,GACpB,CAAA"}
@@ -0,0 +1,56 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { cn } from '../../lib/utils';
5
+ function resolveAppFrameMode(mode) {
6
+ if (mode !== 'auto')
7
+ return mode;
8
+ if (typeof window === 'undefined')
9
+ return 'window';
10
+ const hostMode = document.documentElement.dataset.moldableDisplayMode;
11
+ if (hostMode === 'embedded' || hostMode === 'window')
12
+ return hostMode;
13
+ return window.parent === window ? 'window' : 'embedded';
14
+ }
15
+ function AppFrame({ mode = 'auto', className, style, ...props }) {
16
+ const [resolvedMode, setResolvedMode] = React.useState(() => resolveAppFrameMode(mode));
17
+ React.useEffect(() => {
18
+ setResolvedMode(resolveAppFrameMode(mode));
19
+ if (mode !== 'auto')
20
+ return;
21
+ const updateMode = () => setResolvedMode(resolveAppFrameMode('auto'));
22
+ window.addEventListener('moldable:host-context-change', updateMode);
23
+ return () => window.removeEventListener('moldable:host-context-change', updateMode);
24
+ }, [mode]);
25
+ return (_jsx("div", { "data-slot": "app-frame", "data-mode": resolvedMode, className: cn('bg-[var(--surface-canvas,var(--background))] text-foreground flex h-dvh min-h-0 min-w-0 flex-col overflow-hidden', className), style: {
26
+ paddingInlineStart: 'var(--window-safe-area-inline-start, 0px)',
27
+ paddingInlineEnd: 'var(--window-safe-area-inline-end, 0px)',
28
+ ...style,
29
+ }, ...props }));
30
+ }
31
+ function AppFrameTitlebar({ className, style, ...props }) {
32
+ return (_jsx("header", { "data-slot": "app-frame-titlebar", className: cn('border-border/70 bg-[var(--surface-toolbar,var(--background))] flex shrink-0 items-center gap-2 border-b', className), style: {
33
+ minHeight: 'max(var(--density-toolbar-height, 2.5rem), var(--window-drag-region-height, 0px))',
34
+ paddingInlineStart: 'max(var(--density-pane-padding, 0.75rem), var(--window-control-inset-inline-start, 0px))',
35
+ paddingInlineEnd: 'max(var(--density-pane-padding, 0.75rem), var(--window-control-inset-inline-end, 0px))',
36
+ ...style,
37
+ }, ...props }));
38
+ }
39
+ function AppFrameToolbar({ className, ...props }) {
40
+ return (_jsx("div", { "data-slot": "app-frame-toolbar", className: cn('flex min-h-9 min-w-0 flex-1 items-center gap-2 px-3 py-1.5', className), ...props }));
41
+ }
42
+ function AppFrameContent({ scrollable = true, chatSafe = true, className, style, ...props }) {
43
+ return (_jsx("main", { "data-slot": "app-frame-content", "data-scrollable": scrollable, "data-chat-safe": chatSafe, className: cn('min-h-0 min-w-0 flex-1', scrollable ? 'overflow-auto' : 'overflow-hidden', className), style: {
44
+ paddingBlockEnd: chatSafe
45
+ ? 'calc(var(--window-content-inset-bottom, 0px) + var(--chat-safe-padding, 0px))'
46
+ : 'var(--window-content-inset-bottom, 0px)',
47
+ ...style,
48
+ }, ...props }));
49
+ }
50
+ function AppFrameStatusbar({ className, style, ...props }) {
51
+ return (_jsx("footer", { "data-slot": "app-frame-statusbar", className: cn('border-border/70 bg-[var(--surface-toolbar,var(--background))] flex min-h-7 shrink-0 items-center gap-2 border-t px-3 py-1 text-xs text-muted-foreground', className), style: {
52
+ paddingBlockEnd: 'calc(var(--window-content-inset-bottom, 0px) + 0.25rem)',
53
+ ...style,
54
+ }, ...props }));
55
+ }
56
+ export { AppFrame, AppFrameContent, AppFrameStatusbar, AppFrameTitlebar, AppFrameToolbar, resolveAppFrameMode, };
@@ -1,7 +1,7 @@
1
1
  import { Separator } from './separator';
2
2
  import { type VariantProps } from 'class-variance-authority';
3
3
  declare const buttonGroupVariants: (props?: ({
4
- orientation?: "horizontal" | "vertical" | null | undefined;
4
+ orientation?: "vertical" | "horizontal" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>): import("react/jsx-runtime").JSX.Element;
7
7
  declare function ButtonGroupText({ className, asChild, ...props }: React.ComponentProps<'div'> & {
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Slot } from '@radix-ui/react-slot';
3
3
  import { cn } from '../../lib/utils';
4
4
  import { cva } from 'class-variance-authority';
5
- const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
5
+ const buttonVariants = cva("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
6
6
  variants: {
7
7
  variant: {
8
8
  default: 'bg-primary text-primary-foreground hover:bg-primary/90',
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ declare const colorWellVariants: (props?: ({
4
+ size?: "default" | "sm" | "lg" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export interface ColorWellProps extends Omit<React.ComponentProps<'input'>, 'onChange' | 'size' | 'type' | 'value'>, VariantProps<typeof colorWellVariants> {
7
+ value?: string | null;
8
+ onValueChange?: (value: string) => void;
9
+ readOnly?: boolean;
10
+ }
11
+ declare function ColorWell({ value, onValueChange, readOnly, size, className, 'aria-label': ariaLabel, disabled, ...props }: ColorWellProps): import("react/jsx-runtime").JSX.Element;
12
+ export { ColorWell, colorWellVariants };
13
+ //# sourceMappingURL=color-well.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-well.d.ts","sourceRoot":"","sources":["../../../src/components/ui/color-well.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAEjE,QAAA,MAAM,iBAAiB;;8EActB,CAAA;AAED,MAAM,WAAW,cACf,SAAQ,IAAI,CACR,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAC7B,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CACvC,EACD,YAAY,CAAC,OAAO,iBAAiB,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,aAAa,EACb,QAAgB,EAChB,IAAI,EACJ,SAAS,EACT,YAAY,EAAE,SAA0B,EACxC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,2CAkDhB;AAED,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,30 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from '../../lib/utils';
4
+ import { cva } from 'class-variance-authority';
5
+ const colorWellVariants = cva('border-border has-[:focus-visible]:ring-ring/50 relative inline-flex shrink-0 overflow-hidden rounded-md border shadow-xs outline-none has-[:focus-visible]:ring-[3px]', {
6
+ variants: {
7
+ size: {
8
+ sm: 'size-6',
9
+ default: 'size-8',
10
+ lg: 'size-10',
11
+ },
12
+ },
13
+ defaultVariants: {
14
+ size: 'default',
15
+ },
16
+ });
17
+ function ColorWell({ value, onValueChange, readOnly = false, size, className, 'aria-label': ariaLabel = 'Choose color', disabled, ...props }) {
18
+ const swatch = (_jsx("span", { "aria-hidden": "true", "data-slot": "color-well-swatch", className: "absolute inset-0", style: {
19
+ backgroundColor: value ?? 'transparent',
20
+ backgroundImage: value
21
+ ? undefined
22
+ : 'conic-gradient(var(--muted) 25%, transparent 0 50%, var(--muted) 0 75%, transparent 0)',
23
+ backgroundSize: value ? undefined : '8px 8px',
24
+ } }));
25
+ if (readOnly) {
26
+ return (_jsx("span", { "data-slot": "color-well", role: "img", "aria-label": ariaLabel, className: cn(colorWellVariants({ size }), className), children: swatch }));
27
+ }
28
+ return (_jsxs("label", { "data-slot": "color-well", className: cn(colorWellVariants({ size }), disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer', className), children: [swatch, _jsx("input", { type: "color", value: value ?? '#000000', "aria-label": ariaLabel, disabled: disabled, className: "absolute inset-0 cursor-[inherit] opacity-0", onChange: (event) => onValueChange?.(event.currentTarget.value), ...props })] }));
29
+ }
30
+ export { ColorWell, colorWellVariants };
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ declare const dateFieldVariants: (props?: ({
4
+ variant?: "default" | "filled" | null | undefined;
5
+ density?: "compact" | "default" | "comfortable" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ interface DateFieldProps extends Omit<React.ComponentProps<'input'>, 'defaultValue' | 'size' | 'type' | 'value'>, VariantProps<typeof dateFieldVariants> {
8
+ /** ISO calendar date in YYYY-MM-DD form. No timezone conversion is applied. */
9
+ value?: string;
10
+ defaultValue?: string;
11
+ onValueChange?: (value: string) => void;
12
+ onClear?: () => void;
13
+ clearable?: boolean;
14
+ clearLabel?: string;
15
+ inputClassName?: string;
16
+ }
17
+ declare function DateField({ className, inputClassName, value, defaultValue, onChange, onValueChange, onClear, clearable, clearLabel, variant, density, disabled, readOnly, ref, ...props }: DateFieldProps): import("react/jsx-runtime").JSX.Element;
18
+ export { DateField, dateFieldVariants, type DateFieldProps };
19
+ //# sourceMappingURL=date-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-field.d.ts","sourceRoot":"","sources":["../../../src/components/ui/date-field.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAEjE,QAAA,MAAM,iBAAiB;;;8EAmBtB,CAAA;AAED,UAAU,cACR,SAAQ,IAAI,CACR,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAC7B,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAC3C,EACD,YAAY,CAAC,OAAO,iBAAiB,CAAC;IACxC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,cAAc,EACd,KAAK,EACL,YAAiB,EACjB,QAAQ,EACR,aAAa,EACb,OAAO,EACP,SAAiB,EACjB,UAAyB,EACzB,OAAmB,EACnB,OAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACT,EAAE,cAAc,2CAkFhB;AAED,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,CAAA"}