@moldable-ai/ui 0.2.19 → 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 (372) 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 +50 -6
  29. package/dist/components/chat/chat-panel.d.ts.map +1 -1
  30. package/dist/components/chat/chat-panel.js +200 -163
  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 +2 -2
  35. package/dist/components/chat/index.d.ts.map +1 -1
  36. package/dist/components/chat/index.js +1 -1
  37. package/dist/components/chat/tool-handlers.d.ts.map +1 -1
  38. package/dist/components/chat/tool-handlers.js +40 -2
  39. package/dist/components/chat/vertical-scroll-fade.d.ts +6 -0
  40. package/dist/components/chat/vertical-scroll-fade.d.ts.map +1 -0
  41. package/dist/components/chat/vertical-scroll-fade.js +12 -0
  42. package/dist/components/native-capabilities/bluetooth-panel-helpers.d.ts +9 -0
  43. package/dist/components/native-capabilities/bluetooth-panel-helpers.d.ts.map +1 -0
  44. package/dist/components/native-capabilities/bluetooth-panel-helpers.js +37 -0
  45. package/dist/components/native-capabilities/bluetooth-panel.d.ts +56 -0
  46. package/dist/components/native-capabilities/bluetooth-panel.d.ts.map +1 -0
  47. package/dist/components/native-capabilities/bluetooth-panel.js +470 -0
  48. package/dist/components/native-capabilities/camera-preview.d.ts +39 -0
  49. package/dist/components/native-capabilities/camera-preview.d.ts.map +1 -0
  50. package/dist/components/native-capabilities/camera-preview.js +228 -0
  51. package/dist/components/native-capabilities/capability-badge.d.ts +23 -0
  52. package/dist/components/native-capabilities/capability-badge.d.ts.map +1 -0
  53. package/dist/components/native-capabilities/capability-badge.js +39 -0
  54. package/dist/components/native-capabilities/capability-matrix.d.ts +14 -0
  55. package/dist/components/native-capabilities/capability-matrix.d.ts.map +1 -0
  56. package/dist/components/native-capabilities/capability-matrix.js +97 -0
  57. package/dist/components/native-capabilities/clipboard-button.d.ts +26 -0
  58. package/dist/components/native-capabilities/clipboard-button.d.ts.map +1 -0
  59. package/dist/components/native-capabilities/clipboard-button.js +99 -0
  60. package/dist/components/native-capabilities/device-io-controls.d.ts +4 -0
  61. package/dist/components/native-capabilities/device-io-controls.d.ts.map +1 -0
  62. package/dist/components/native-capabilities/device-io-controls.js +28 -0
  63. package/dist/components/native-capabilities/device-list.d.ts +20 -0
  64. package/dist/components/native-capabilities/device-list.d.ts.map +1 -0
  65. package/dist/components/native-capabilities/device-list.js +14 -0
  66. package/dist/components/native-capabilities/display-map.d.ts +23 -0
  67. package/dist/components/native-capabilities/display-map.d.ts.map +1 -0
  68. package/dist/components/native-capabilities/display-map.js +114 -0
  69. package/dist/components/native-capabilities/haptic-button.d.ts +26 -0
  70. package/dist/components/native-capabilities/haptic-button.d.ts.map +1 -0
  71. package/dist/components/native-capabilities/haptic-button.js +94 -0
  72. package/dist/components/native-capabilities/hid-panel.d.ts +40 -0
  73. package/dist/components/native-capabilities/hid-panel.d.ts.map +1 -0
  74. package/dist/components/native-capabilities/hid-panel.js +373 -0
  75. package/dist/components/native-capabilities/index.d.ts +27 -0
  76. package/dist/components/native-capabilities/index.d.ts.map +1 -0
  77. package/dist/components/native-capabilities/index.js +26 -0
  78. package/dist/components/native-capabilities/live-indicator.d.ts +15 -0
  79. package/dist/components/native-capabilities/live-indicator.d.ts.map +1 -0
  80. package/dist/components/native-capabilities/live-indicator.js +26 -0
  81. package/dist/components/native-capabilities/local-auth-button.d.ts +33 -0
  82. package/dist/components/native-capabilities/local-auth-button.d.ts.map +1 -0
  83. package/dist/components/native-capabilities/local-auth-button.js +115 -0
  84. package/dist/components/native-capabilities/location-panel.d.ts +29 -0
  85. package/dist/components/native-capabilities/location-panel.d.ts.map +1 -0
  86. package/dist/components/native-capabilities/location-panel.js +146 -0
  87. package/dist/components/native-capabilities/microphone-meter.d.ts +35 -0
  88. package/dist/components/native-capabilities/microphone-meter.d.ts.map +1 -0
  89. package/dist/components/native-capabilities/microphone-meter.js +244 -0
  90. package/dist/components/native-capabilities/midi-monitor.d.ts +54 -0
  91. package/dist/components/native-capabilities/midi-monitor.d.ts.map +1 -0
  92. package/dist/components/native-capabilities/midi-monitor.js +534 -0
  93. package/dist/components/native-capabilities/native-capability-panel.d.ts +11 -0
  94. package/dist/components/native-capabilities/native-capability-panel.d.ts.map +1 -0
  95. package/dist/components/native-capabilities/native-capability-panel.js +28 -0
  96. package/dist/components/native-capabilities/notification-panel.d.ts +24 -0
  97. package/dist/components/native-capabilities/notification-panel.d.ts.map +1 -0
  98. package/dist/components/native-capabilities/notification-panel.js +124 -0
  99. package/dist/components/native-capabilities/power-blocker-controller.d.ts +19 -0
  100. package/dist/components/native-capabilities/power-blocker-controller.d.ts.map +1 -0
  101. package/dist/components/native-capabilities/power-blocker-controller.js +83 -0
  102. package/dist/components/native-capabilities/power-panel.d.ts +67 -0
  103. package/dist/components/native-capabilities/power-panel.d.ts.map +1 -0
  104. package/dist/components/native-capabilities/power-panel.js +309 -0
  105. package/dist/components/native-capabilities/readout.d.ts +10 -0
  106. package/dist/components/native-capabilities/readout.d.ts.map +1 -0
  107. package/dist/components/native-capabilities/readout.js +11 -0
  108. package/dist/components/native-capabilities/screen-share-preview.d.ts +36 -0
  109. package/dist/components/native-capabilities/screen-share-preview.d.ts.map +1 -0
  110. package/dist/components/native-capabilities/screen-share-preview.js +191 -0
  111. package/dist/components/native-capabilities/secure-storage-panel.d.ts +36 -0
  112. package/dist/components/native-capabilities/secure-storage-panel.d.ts.map +1 -0
  113. package/dist/components/native-capabilities/secure-storage-panel.js +193 -0
  114. package/dist/components/native-capabilities/serial-console.d.ts +64 -0
  115. package/dist/components/native-capabilities/serial-console.d.ts.map +1 -0
  116. package/dist/components/native-capabilities/serial-console.js +399 -0
  117. package/dist/components/native-capabilities/shortcut-recorder.d.ts +35 -0
  118. package/dist/components/native-capabilities/shortcut-recorder.d.ts.map +1 -0
  119. package/dist/components/native-capabilities/shortcut-recorder.js +217 -0
  120. package/dist/components/native-capabilities/stream-log.d.ts +35 -0
  121. package/dist/components/native-capabilities/stream-log.d.ts.map +1 -0
  122. package/dist/components/native-capabilities/stream-log.js +65 -0
  123. package/dist/components/native-capabilities/system-audio-monitor.d.ts +34 -0
  124. package/dist/components/native-capabilities/system-audio-monitor.d.ts.map +1 -0
  125. package/dist/components/native-capabilities/system-audio-monitor.js +275 -0
  126. package/dist/components/native-capabilities/usb-panel.d.ts +54 -0
  127. package/dist/components/native-capabilities/usb-panel.d.ts.map +1 -0
  128. package/dist/components/native-capabilities/usb-panel.js +363 -0
  129. package/dist/components/native-capabilities/use-capability.d.ts +20 -0
  130. package/dist/components/native-capabilities/use-capability.d.ts.map +1 -0
  131. package/dist/components/native-capabilities/use-capability.js +61 -0
  132. package/dist/components/ui/app-frame.d.ts +22 -0
  133. package/dist/components/ui/app-frame.d.ts.map +1 -0
  134. package/dist/components/ui/app-frame.js +56 -0
  135. package/dist/components/ui/button-group.d.ts +1 -1
  136. package/dist/components/ui/button.js +1 -1
  137. package/dist/components/ui/color-well.d.ts +13 -0
  138. package/dist/components/ui/color-well.d.ts.map +1 -0
  139. package/dist/components/ui/color-well.js +30 -0
  140. package/dist/components/ui/date-field.d.ts +19 -0
  141. package/dist/components/ui/date-field.d.ts.map +1 -0
  142. package/dist/components/ui/date-field.js +54 -0
  143. package/dist/components/ui/edge-fade.d.ts +11 -0
  144. package/dist/components/ui/edge-fade.d.ts.map +1 -0
  145. package/dist/components/ui/edge-fade.js +41 -0
  146. package/dist/components/ui/empty.js +1 -1
  147. package/dist/components/ui/field.d.ts +1 -1
  148. package/dist/components/ui/grid.d.ts +24 -0
  149. package/dist/components/ui/grid.d.ts.map +1 -0
  150. package/dist/components/ui/grid.js +234 -0
  151. package/dist/components/ui/icon-button.d.ts +15 -0
  152. package/dist/components/ui/icon-button.d.ts.map +1 -0
  153. package/dist/components/ui/icon-button.js +15 -0
  154. package/dist/components/ui/index.d.ts +19 -0
  155. package/dist/components/ui/index.d.ts.map +1 -1
  156. package/dist/components/ui/index.js +19 -0
  157. package/dist/components/ui/input-group.d.ts +1 -1
  158. package/dist/components/ui/inspector.d.ts +15 -0
  159. package/dist/components/ui/inspector.d.ts.map +1 -0
  160. package/dist/components/ui/inspector.js +26 -0
  161. package/dist/components/ui/kbd.d.ts +1 -1
  162. package/dist/components/ui/list.d.ts +24 -0
  163. package/dist/components/ui/list.d.ts.map +1 -0
  164. package/dist/components/ui/list.js +224 -0
  165. package/dist/components/ui/message-scroller-layout-stability.d.ts +33 -0
  166. package/dist/components/ui/message-scroller-layout-stability.d.ts.map +1 -0
  167. package/dist/components/ui/message-scroller-layout-stability.js +153 -0
  168. package/dist/components/ui/message-scroller.d.ts +11 -0
  169. package/dist/components/ui/message-scroller.d.ts.map +1 -0
  170. package/dist/components/ui/message-scroller.js +37 -0
  171. package/dist/components/ui/notification-dot.d.ts +4 -0
  172. package/dist/components/ui/notification-dot.d.ts.map +1 -0
  173. package/dist/components/ui/notification-dot.js +7 -0
  174. package/dist/components/ui/number-input.d.ts +16 -0
  175. package/dist/components/ui/number-input.d.ts.map +1 -0
  176. package/dist/components/ui/number-input.js +56 -0
  177. package/dist/components/ui/panel.d.ts +18 -0
  178. package/dist/components/ui/panel.d.ts.map +1 -0
  179. package/dist/components/ui/panel.js +40 -0
  180. package/dist/components/ui/popover.js +1 -1
  181. package/dist/components/ui/search-field.d.ts +19 -0
  182. package/dist/components/ui/search-field.d.ts.map +1 -0
  183. package/dist/components/ui/search-field.js +64 -0
  184. package/dist/components/ui/segmented-control.d.ts +21 -0
  185. package/dist/components/ui/segmented-control.d.ts.map +1 -0
  186. package/dist/components/ui/segmented-control.js +61 -0
  187. package/dist/components/ui/sidebar.js +1 -1
  188. package/dist/components/ui/sonner.d.ts +4 -3
  189. package/dist/components/ui/sonner.d.ts.map +1 -1
  190. package/dist/components/ui/sonner.js +7 -6
  191. package/dist/components/ui/split-view.d.ts +11 -0
  192. package/dist/components/ui/split-view.d.ts.map +1 -0
  193. package/dist/components/ui/split-view.js +13 -0
  194. package/dist/components/ui/status.d.ts +13 -0
  195. package/dist/components/ui/status.d.ts.map +1 -0
  196. package/dist/components/ui/status.js +36 -0
  197. package/dist/components/ui/table.d.ts +11 -2
  198. package/dist/components/ui/table.d.ts.map +1 -1
  199. package/dist/components/ui/table.js +28 -6
  200. package/dist/components/ui/text.d.ts +17 -0
  201. package/dist/components/ui/text.d.ts.map +1 -0
  202. package/dist/components/ui/text.js +55 -0
  203. package/dist/components/ui/toggle.js +1 -1
  204. package/dist/components/ui/toolbar.d.ts +20 -0
  205. package/dist/components/ui/toolbar.d.ts.map +1 -0
  206. package/dist/components/ui/toolbar.js +52 -0
  207. package/dist/index.d.ts +2 -2
  208. package/dist/index.d.ts.map +1 -1
  209. package/dist/index.js +4 -4
  210. package/dist/lib/frame-lifecycle.d.ts +28 -0
  211. package/dist/lib/frame-lifecycle.d.ts.map +1 -1
  212. package/dist/lib/frame-lifecycle.js +84 -0
  213. package/dist/lib/native-capabilities/access.d.ts +13 -0
  214. package/dist/lib/native-capabilities/access.d.ts.map +1 -0
  215. package/dist/lib/native-capabilities/access.js +53 -0
  216. package/dist/lib/native-capabilities/bluetooth-access.d.ts +14 -0
  217. package/dist/lib/native-capabilities/bluetooth-access.d.ts.map +1 -0
  218. package/dist/lib/native-capabilities/bluetooth-access.js +43 -0
  219. package/dist/lib/native-capabilities/bluetooth-connection.d.ts +19 -0
  220. package/dist/lib/native-capabilities/bluetooth-connection.d.ts.map +1 -0
  221. package/dist/lib/native-capabilities/bluetooth-connection.js +88 -0
  222. package/dist/lib/native-capabilities/bluetooth-gatt.d.ts +7 -0
  223. package/dist/lib/native-capabilities/bluetooth-gatt.d.ts.map +1 -0
  224. package/dist/lib/native-capabilities/bluetooth-gatt.js +77 -0
  225. package/dist/lib/native-capabilities/bluetooth-internal.d.ts +10 -0
  226. package/dist/lib/native-capabilities/bluetooth-internal.d.ts.map +1 -0
  227. package/dist/lib/native-capabilities/bluetooth-internal.js +105 -0
  228. package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts +33 -0
  229. package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts.map +1 -0
  230. package/dist/lib/native-capabilities/bluetooth-native-fallback.js +214 -0
  231. package/dist/lib/native-capabilities/bluetooth-types.d.ts +85 -0
  232. package/dist/lib/native-capabilities/bluetooth-types.d.ts.map +1 -0
  233. package/dist/lib/native-capabilities/bluetooth-types.js +2 -0
  234. package/dist/lib/native-capabilities/bluetooth.d.ts +7 -0
  235. package/dist/lib/native-capabilities/bluetooth.d.ts.map +1 -0
  236. package/dist/lib/native-capabilities/bluetooth.js +4 -0
  237. package/dist/lib/native-capabilities/bridge.d.ts +23 -0
  238. package/dist/lib/native-capabilities/bridge.d.ts.map +1 -0
  239. package/dist/lib/native-capabilities/bridge.js +266 -0
  240. package/dist/lib/native-capabilities/capabilities.d.ts +7 -0
  241. package/dist/lib/native-capabilities/capabilities.d.ts.map +1 -0
  242. package/dist/lib/native-capabilities/capabilities.js +95 -0
  243. package/dist/lib/native-capabilities/clipboard.d.ts +11 -0
  244. package/dist/lib/native-capabilities/clipboard.d.ts.map +1 -0
  245. package/dist/lib/native-capabilities/clipboard.js +58 -0
  246. package/dist/lib/native-capabilities/device-io-errors.d.ts +11 -0
  247. package/dist/lib/native-capabilities/device-io-errors.d.ts.map +1 -0
  248. package/dist/lib/native-capabilities/device-io-errors.js +82 -0
  249. package/dist/lib/native-capabilities/displays.d.ts +38 -0
  250. package/dist/lib/native-capabilities/displays.d.ts.map +1 -0
  251. package/dist/lib/native-capabilities/displays.js +12 -0
  252. package/dist/lib/native-capabilities/global-shortcuts.d.ts +86 -0
  253. package/dist/lib/native-capabilities/global-shortcuts.d.ts.map +1 -0
  254. package/dist/lib/native-capabilities/global-shortcuts.js +351 -0
  255. package/dist/lib/native-capabilities/haptics.d.ts +25 -0
  256. package/dist/lib/native-capabilities/haptics.d.ts.map +1 -0
  257. package/dist/lib/native-capabilities/haptics.js +18 -0
  258. package/dist/lib/native-capabilities/hid-native.d.ts +26 -0
  259. package/dist/lib/native-capabilities/hid-native.d.ts.map +1 -0
  260. package/dist/lib/native-capabilities/hid-native.js +229 -0
  261. package/dist/lib/native-capabilities/hid.d.ts +52 -0
  262. package/dist/lib/native-capabilities/hid.d.ts.map +1 -0
  263. package/dist/lib/native-capabilities/hid.js +163 -0
  264. package/dist/lib/native-capabilities/index.d.ts +40 -0
  265. package/dist/lib/native-capabilities/index.d.ts.map +1 -0
  266. package/dist/lib/native-capabilities/index.js +21 -0
  267. package/dist/lib/native-capabilities/local-authentication.d.ts +32 -0
  268. package/dist/lib/native-capabilities/local-authentication.d.ts.map +1 -0
  269. package/dist/lib/native-capabilities/local-authentication.js +46 -0
  270. package/dist/lib/native-capabilities/location.d.ts +49 -0
  271. package/dist/lib/native-capabilities/location.d.ts.map +1 -0
  272. package/dist/lib/native-capabilities/location.js +114 -0
  273. package/dist/lib/native-capabilities/media-permissions.d.ts +28 -0
  274. package/dist/lib/native-capabilities/media-permissions.d.ts.map +1 -0
  275. package/dist/lib/native-capabilities/media-permissions.js +37 -0
  276. package/dist/lib/native-capabilities/media.d.ts +17 -0
  277. package/dist/lib/native-capabilities/media.d.ts.map +1 -0
  278. package/dist/lib/native-capabilities/media.js +104 -0
  279. package/dist/lib/native-capabilities/midi-access.d.ts +13 -0
  280. package/dist/lib/native-capabilities/midi-access.d.ts.map +1 -0
  281. package/dist/lib/native-capabilities/midi-access.js +68 -0
  282. package/dist/lib/native-capabilities/midi-internal.d.ts +12 -0
  283. package/dist/lib/native-capabilities/midi-internal.d.ts.map +1 -0
  284. package/dist/lib/native-capabilities/midi-internal.js +88 -0
  285. package/dist/lib/native-capabilities/midi-native-fallback.d.ts +27 -0
  286. package/dist/lib/native-capabilities/midi-native-fallback.d.ts.map +1 -0
  287. package/dist/lib/native-capabilities/midi-native-fallback.js +127 -0
  288. package/dist/lib/native-capabilities/midi-ports.d.ts +6 -0
  289. package/dist/lib/native-capabilities/midi-ports.d.ts.map +1 -0
  290. package/dist/lib/native-capabilities/midi-ports.js +115 -0
  291. package/dist/lib/native-capabilities/midi-types.d.ts +25 -0
  292. package/dist/lib/native-capabilities/midi-types.d.ts.map +1 -0
  293. package/dist/lib/native-capabilities/midi-types.js +1 -0
  294. package/dist/lib/native-capabilities/midi.d.ts +6 -0
  295. package/dist/lib/native-capabilities/midi.d.ts.map +1 -0
  296. package/dist/lib/native-capabilities/midi.js +3 -0
  297. package/dist/lib/native-capabilities/native-device-io.d.ts +28 -0
  298. package/dist/lib/native-capabilities/native-device-io.d.ts.map +1 -0
  299. package/dist/lib/native-capabilities/native-device-io.js +91 -0
  300. package/dist/lib/native-capabilities/native-device-lifecycle.d.ts +13 -0
  301. package/dist/lib/native-capabilities/native-device-lifecycle.d.ts.map +1 -0
  302. package/dist/lib/native-capabilities/native-device-lifecycle.js +40 -0
  303. package/dist/lib/native-capabilities/notifications.d.ts +38 -0
  304. package/dist/lib/native-capabilities/notifications.d.ts.map +1 -0
  305. package/dist/lib/native-capabilities/notifications.js +50 -0
  306. package/dist/lib/native-capabilities/power-session.d.ts +113 -0
  307. package/dist/lib/native-capabilities/power-session.d.ts.map +1 -0
  308. package/dist/lib/native-capabilities/power-session.js +264 -0
  309. package/dist/lib/native-capabilities/secure-storage.d.ts +36 -0
  310. package/dist/lib/native-capabilities/secure-storage.d.ts.map +1 -0
  311. package/dist/lib/native-capabilities/secure-storage.js +64 -0
  312. package/dist/lib/native-capabilities/serial-native.d.ts +23 -0
  313. package/dist/lib/native-capabilities/serial-native.d.ts.map +1 -0
  314. package/dist/lib/native-capabilities/serial-native.js +181 -0
  315. package/dist/lib/native-capabilities/serial.d.ts +76 -0
  316. package/dist/lib/native-capabilities/serial.d.ts.map +1 -0
  317. package/dist/lib/native-capabilities/serial.js +215 -0
  318. package/dist/lib/native-capabilities/system-audio.d.ts +127 -0
  319. package/dist/lib/native-capabilities/system-audio.d.ts.map +1 -0
  320. package/dist/lib/native-capabilities/system-audio.js +330 -0
  321. package/dist/lib/native-capabilities/types.d.ts +62 -0
  322. package/dist/lib/native-capabilities/types.d.ts.map +1 -0
  323. package/dist/lib/native-capabilities/types.js +27 -0
  324. package/dist/lib/native-capabilities/usb-native.d.ts +39 -0
  325. package/dist/lib/native-capabilities/usb-native.d.ts.map +1 -0
  326. package/dist/lib/native-capabilities/usb-native.js +217 -0
  327. package/dist/lib/native-capabilities/usb.d.ts +85 -0
  328. package/dist/lib/native-capabilities/usb.d.ts.map +1 -0
  329. package/dist/lib/native-capabilities/usb.js +225 -0
  330. package/docs/README.md +37 -0
  331. package/docs/accessibility.md +32 -0
  332. package/docs/app-anatomy.md +72 -0
  333. package/docs/component-catalog.md +59 -0
  334. package/docs/component-guide-template.md +37 -0
  335. package/docs/design-tokens.md +172 -0
  336. package/docs/foundations.md +56 -0
  337. package/docs/native-integration.md +33 -0
  338. package/docs/standalone-app-windows.md +128 -0
  339. package/package.json +9 -3
  340. package/src/components/ui/alert.md +55 -0
  341. package/src/components/ui/app-frame.md +33 -0
  342. package/src/components/ui/badge.md +57 -0
  343. package/src/components/ui/button.md +76 -0
  344. package/src/components/ui/color-well.md +11 -0
  345. package/src/components/ui/combobox.md +43 -0
  346. package/src/components/ui/date-field.md +32 -0
  347. package/src/components/ui/edge-fade.md +7 -0
  348. package/src/components/ui/empty.md +82 -0
  349. package/src/components/ui/field.md +77 -0
  350. package/src/components/ui/grid.md +105 -0
  351. package/src/components/ui/icon-button.md +36 -0
  352. package/src/components/ui/inspector.md +11 -0
  353. package/src/components/ui/item.md +87 -0
  354. package/src/components/ui/list.md +107 -0
  355. package/src/components/ui/notification-dot.md +7 -0
  356. package/src/components/ui/number-input.md +19 -0
  357. package/src/components/ui/panel.md +11 -0
  358. package/src/components/ui/resizable.md +66 -0
  359. package/src/components/ui/scroll-area.md +68 -0
  360. package/src/components/ui/search-field.md +33 -0
  361. package/src/components/ui/segmented-control.md +39 -0
  362. package/src/components/ui/sidebar.md +113 -0
  363. package/src/components/ui/sonner.md +37 -0
  364. package/src/components/ui/split-view.md +15 -0
  365. package/src/components/ui/status.md +12 -0
  366. package/src/components/ui/table.md +35 -0
  367. package/src/components/ui/tabs.md +66 -0
  368. package/src/components/ui/text.md +17 -0
  369. package/src/components/ui/toggle-group.md +80 -0
  370. package/src/components/ui/toggle.md +73 -0
  371. package/src/components/ui/toolbar.md +21 -0
  372. package/src/styles/index.css +491 -3
@@ -0,0 +1,52 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { cn } from '../../lib/utils';
4
+ import { Separator } from './separator';
5
+ import { Text } from './text';
6
+ import { cva } from 'class-variance-authority';
7
+ const toolbarVariants = cva('z-20 flex w-full shrink-0 items-center gap-2 px-3', {
8
+ variants: {
9
+ variant: {
10
+ default: 'border-border/70 bg-background/90 supports-[backdrop-filter]:bg-background/75 border-b backdrop-blur-xl',
11
+ plain: 'bg-transparent',
12
+ panel: 'border-border/60 bg-muted/35 border-b',
13
+ },
14
+ density: {
15
+ compact: 'min-h-8 py-1',
16
+ default: 'min-h-10 py-1.5',
17
+ comfortable: 'min-h-12 py-2',
18
+ },
19
+ position: {
20
+ static: '',
21
+ top: 'sticky top-0',
22
+ bottom: 'sticky bottom-0 border-t border-b-0',
23
+ },
24
+ },
25
+ defaultVariants: {
26
+ variant: 'default',
27
+ density: 'compact',
28
+ position: 'static',
29
+ },
30
+ });
31
+ function Toolbar({ variant, density, position, className, ...props }) {
32
+ return (_jsx("header", { "data-slot": "toolbar", "data-density": density ?? 'compact', "data-position": position ?? 'static', "data-variant": variant ?? 'default', className: cn(toolbarVariants({ variant, density, position }), className), ...props }));
33
+ }
34
+ function ToolbarGroup({ className, ...props }) {
35
+ return (_jsx("div", { "data-slot": "toolbar-group", className: cn('flex min-w-0 items-center gap-1.5', className), ...props }));
36
+ }
37
+ function ToolbarContent({ className, ...props }) {
38
+ return (_jsx("div", { "data-slot": "toolbar-content", className: cn('flex min-w-0 flex-1 flex-col', className), ...props }));
39
+ }
40
+ function ToolbarTitle({ className, ...props }) {
41
+ return (_jsx(Text, { as: "h2", variant: "strong", truncate: true, "data-slot": "toolbar-title", className: className, ...props }));
42
+ }
43
+ function ToolbarDescription({ className, ...props }) {
44
+ return (_jsx(Text, { as: "p", variant: "small", color: "secondary", truncate: true, "data-slot": "toolbar-description", className: className, ...props }));
45
+ }
46
+ function ToolbarActions({ className, ...props }) {
47
+ return (_jsx("div", { "data-slot": "toolbar-actions", className: cn('ml-auto flex shrink-0 items-center gap-1', className), ...props }));
48
+ }
49
+ function ToolbarSeparator({ className, ...props }) {
50
+ return (_jsx(Separator, { orientation: "vertical", "data-slot": "toolbar-separator", className: cn('mx-1 h-4', className), ...props }));
51
+ }
52
+ export { Toolbar, ToolbarActions, ToolbarContent, ToolbarDescription, ToolbarGroup, ToolbarSeparator, ToolbarTitle, toolbarVariants, };
package/dist/index.d.ts CHANGED
@@ -2,9 +2,9 @@ export { cn } from './lib/utils';
2
2
  export { ThemeProvider, useTheme, themeScript, type Theme } from './lib/theme';
3
3
  export { WorkspaceProvider, useWorkspace, WORKSPACE_HEADER, } from './lib/workspace';
4
4
  export { useMoldableCommands, useMoldableCommand, useMoldableAppCommands, useMoldableNavigationPop, useMoldableNavigationState, isInMoldable, sendToMoldable, pushMoldableNavigation, popMoldableNavigation, resetMoldableNavigation, downloadFile, publishMoldableArtifact, setMoldableWindowFullscreen, type AppCommand, type CommandAction, type CommandsResponse, type CommandMessage, type MoldableNavigationEntry, type MoldableNavigationPopMessage, type MoldableNavigationStateMessage, type DownloadFileOptions, type MoldableArtifactFile, type MoldableArtifactPublishOptions, type MoldableArtifactPublishResult, type MoldableWindowFullscreenMode, type MoldableWindowFullscreenOptions, type MoldableWindowFullscreenResult, type MoldableWindowFullscreenMessage, type MoldableWindowFullscreenResultMessage, } from './lib/commands';
5
- export * from './lib/native-hardware';
5
+ export * from './lib/native-capabilities';
6
6
  export * from './components/ui';
7
- export * from './components/hardware';
7
+ export * from './components/native-capabilities';
8
8
  export { TODAY_KIND_RANK, TODAY_KIND_TTL_MS, makeTodayItem, type TodayItem, type TodayItemKind, type TodaySurface, type TodayAction, type TodayResponse, type ResumeState, type HydratedTodayItem, type HydratedResume, } from './lib/today';
9
9
  export { useIsMobile } from './hooks/use-mobile';
10
10
  export { Markdown } from './components/markdown';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAGhC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AAG9E,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,qCAAqC,GAC3C,MAAM,gBAAgB,CAAA;AAGvB,cAAc,uBAAuB,CAAA;AAGrC,cAAc,iBAAiB,CAAA;AAG/B,cAAc,uBAAuB,CAAA;AAGrC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGhD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,gCAAgC,CAAA;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,OAAO,EACL,gBAAgB,EAChB,KAAK,cAAc,GACpB,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAA;AAGrE,cAAc,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAGhC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AAG9E,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,qCAAqC,GAC3C,MAAM,gBAAgB,CAAA;AAGvB,cAAc,2BAA2B,CAAA;AAGzC,cAAc,iBAAiB,CAAA;AAG/B,cAAc,kCAAkC,CAAA;AAGhD,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGhD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,gCAAgC,CAAA;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,OAAO,EACL,gBAAgB,EAChB,KAAK,cAAc,GACpB,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAA;AAGrE,cAAc,mBAAmB,CAAA"}
package/dist/index.js CHANGED
@@ -6,12 +6,12 @@ export { ThemeProvider, useTheme, themeScript } from './lib/theme';
6
6
  export { WorkspaceProvider, useWorkspace, WORKSPACE_HEADER, } from './lib/workspace';
7
7
  // Export commands
8
8
  export { useMoldableCommands, useMoldableCommand, useMoldableAppCommands, useMoldableNavigationPop, useMoldableNavigationState, isInMoldable, sendToMoldable, pushMoldableNavigation, popMoldableNavigation, resetMoldableNavigation, downloadFile, publishMoldableArtifact, setMoldableWindowFullscreen, } from './lib/commands';
9
- // Export typed desktop/native hardware APIs
10
- export * from './lib/native-hardware';
9
+ // Export typed desktop/native capability APIs
10
+ export * from './lib/native-capabilities';
11
11
  // Export UI components
12
12
  export * from './components/ui';
13
- // Export native hardware components (polished wrappers over lib/native-hardware)
14
- export * from './components/hardware';
13
+ // Export native capability components (polished wrappers over lib/native-capabilities)
14
+ export * from './components/native-capabilities';
15
15
  // Export Today contract
16
16
  export { TODAY_KIND_RANK, TODAY_KIND_TTL_MS, makeTodayItem, } from './lib/today';
17
17
  // Export hooks
@@ -1,2 +1,30 @@
1
+ export interface MoldableChatStateMessage {
2
+ type: 'moldable:chat-state';
3
+ expanded?: boolean;
4
+ minimized?: boolean;
5
+ safePadding?: unknown;
6
+ }
7
+ export interface MoldableHostContextMessage {
8
+ type: 'moldable:host-context';
9
+ version: 1;
10
+ displayMode: 'embedded' | 'window';
11
+ platform?: 'macos' | 'windows' | 'linux' | 'unknown';
12
+ windowId?: string;
13
+ safeInsets?: {
14
+ top?: unknown;
15
+ inlineStart?: unknown;
16
+ inlineEnd?: unknown;
17
+ bottom?: unknown;
18
+ titlebarHeight?: unknown;
19
+ controlInsetInlineStart?: unknown;
20
+ controlInsetInlineEnd?: unknown;
21
+ cornerRadius?: unknown;
22
+ };
23
+ chat?: {
24
+ presentation?: 'hidden' | 'docked' | 'expanded' | 'minimized';
25
+ safePadding?: unknown;
26
+ };
27
+ }
28
+ export declare function applyMoldableChatSafePadding(safePadding: unknown): boolean;
1
29
  export declare function installMoldableFrameLifecycle(): void;
2
30
  //# sourceMappingURL=frame-lifecycle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frame-lifecycle.d.ts","sourceRoot":"","sources":["../../src/lib/frame-lifecycle.ts"],"names":[],"mappings":"AAgEA,wBAAgB,6BAA6B,IAAI,IAAI,CAapD"}
1
+ {"version":3,"file":"frame-lifecycle.d.ts","sourceRoot":"","sources":["../../src/lib/frame-lifecycle.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,uBAAuB,CAAA;IAC7B,OAAO,EAAE,CAAC,CAAA;IACV,WAAW,EAAE,UAAU,GAAG,QAAQ,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE;QACX,GAAG,CAAC,EAAE,OAAO,CAAA;QACb,WAAW,CAAC,EAAE,OAAO,CAAA;QACrB,SAAS,CAAC,EAAE,OAAO,CAAA;QACnB,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB,uBAAuB,CAAC,EAAE,OAAO,CAAA;QACjC,qBAAqB,CAAC,EAAE,OAAO,CAAA;QAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;KACvB,CAAA;IACD,IAAI,CAAC,EAAE;QACL,YAAY,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAA;QAC7D,WAAW,CAAC,EAAE,OAAO,CAAA;KACtB,CAAA;CACF;AAwBD,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAa1E;AA0ID,wBAAgB,6BAA6B,IAAI,IAAI,CAcpD"}
@@ -1,4 +1,87 @@
1
1
  let frameLifecycleInstalled = false;
2
+ export function applyMoldableChatSafePadding(safePadding) {
3
+ if (typeof document === 'undefined')
4
+ return false;
5
+ const value = Number(safePadding);
6
+ if (!Number.isFinite(value))
7
+ return false;
8
+ // Keep a malformed or stale host message from creating an unusable canvas.
9
+ const boundedValue = Math.min(4096, Math.max(0, value));
10
+ document.documentElement.style.setProperty('--chat-safe-padding', `${boundedValue}px`);
11
+ return true;
12
+ }
13
+ function applyBoundedLength(property, value) {
14
+ const number = Number(value);
15
+ if (!Number.isFinite(number))
16
+ return;
17
+ document.documentElement.style.setProperty(property, `${Math.min(4096, Math.max(0, number))}px`);
18
+ }
19
+ function applyMoldableChatState(message) {
20
+ applyMoldableChatSafePadding(message.safePadding);
21
+ const presentation = message.expanded
22
+ ? 'expanded'
23
+ : message.minimized
24
+ ? 'minimized'
25
+ : 'docked';
26
+ document.documentElement.dataset.moldableChat = presentation;
27
+ }
28
+ function applyMoldableHostContext(message) {
29
+ const root = document.documentElement;
30
+ root.dataset.moldableDisplayMode = message.displayMode;
31
+ if (message.platform)
32
+ root.dataset.moldablePlatform = message.platform;
33
+ if (message.windowId)
34
+ root.dataset.moldableWindowId = message.windowId;
35
+ const insets = message.safeInsets;
36
+ if (insets) {
37
+ applyBoundedLength('--window-safe-area-top', insets.top);
38
+ applyBoundedLength('--window-safe-area-inline-start', insets.inlineStart);
39
+ applyBoundedLength('--window-safe-area-inline-end', insets.inlineEnd);
40
+ applyBoundedLength('--window-safe-area-bottom', insets.bottom);
41
+ applyBoundedLength('--window-titlebar-height', insets.titlebarHeight);
42
+ applyBoundedLength('--window-control-inset-inline-start', insets.controlInsetInlineStart);
43
+ applyBoundedLength('--window-control-inset-inline-end', insets.controlInsetInlineEnd);
44
+ applyBoundedLength('--window-corner-radius', insets.cornerRadius);
45
+ }
46
+ if (message.chat) {
47
+ applyMoldableChatSafePadding(message.chat.safePadding);
48
+ if (message.chat.presentation) {
49
+ root.dataset.moldableChat = message.chat.presentation;
50
+ }
51
+ }
52
+ window.dispatchEvent(new CustomEvent('moldable:host-context-change', { detail: message }));
53
+ }
54
+ function installHostStateLifecycle() {
55
+ const root = document.documentElement;
56
+ root.dataset.moldableDisplayMode =
57
+ window.parent === window ? 'window' : 'embedded';
58
+ // Standalone windows do not reserve space for the desktop chat dock.
59
+ if (window.parent === window) {
60
+ applyMoldableChatSafePadding(0);
61
+ return;
62
+ }
63
+ window.addEventListener('message', (event) => {
64
+ if (event.source !== window.parent)
65
+ return;
66
+ if (typeof event.data !== 'object' ||
67
+ event.data === null ||
68
+ !('type' in event.data) ||
69
+ typeof event.data.type !== 'string') {
70
+ return;
71
+ }
72
+ if (event.data.type === 'moldable:chat-state') {
73
+ applyMoldableChatState(event.data);
74
+ }
75
+ else if (event.data.type === 'moldable:host-context') {
76
+ const message = event.data;
77
+ if (message.version === 1 &&
78
+ (message.displayMode === 'embedded' ||
79
+ message.displayMode === 'window')) {
80
+ applyMoldableHostContext(message);
81
+ }
82
+ }
83
+ });
84
+ }
2
85
  function postMoldableFrameMessage(message) {
3
86
  if (typeof window === 'undefined' || window.parent === window)
4
87
  return;
@@ -37,6 +120,7 @@ export function installMoldableFrameLifecycle() {
37
120
  if (typeof window === 'undefined' || frameLifecycleInstalled)
38
121
  return;
39
122
  frameLifecycleInstalled = true;
123
+ installHostStateLifecycle();
40
124
  installViteHmrLifecycle();
41
125
  scheduleRenderReady();
42
126
  if (document.readyState === 'complete') {
@@ -0,0 +1,13 @@
1
+ import { type NativeCapabilityBridgeOptions } from './bridge';
2
+ import type { NativeCapabilityId } from './types';
3
+ export declare const NATIVE_CAPABILITY_ACCESS_REQUEST_TYPE: "moldable:native-capabilities-access-request";
4
+ export declare const NATIVE_CAPABILITY_ACCESS_RESULT_TYPE: "moldable:native-capabilities-access-result";
5
+ export interface MoldableNativeCapabilityAccessState {
6
+ capability: NativeCapabilityId;
7
+ granted: boolean;
8
+ }
9
+ export declare function getMoldableNativeCapabilityAccess(capability: NativeCapabilityId, options?: NativeCapabilityBridgeOptions): Promise<MoldableNativeCapabilityAccessState>;
10
+ export declare function requestMoldableNativeCapabilityAccess(capability: NativeCapabilityId, options?: NativeCapabilityBridgeOptions): Promise<MoldableNativeCapabilityAccessState>;
11
+ export declare function assertMoldableNativeCapabilityAccess(capability: NativeCapabilityId, options?: NativeCapabilityBridgeOptions): Promise<void>;
12
+ export declare function requireMoldableNativeCapabilityAccess(capability: NativeCapabilityId, options?: NativeCapabilityBridgeOptions): Promise<void>;
13
+ //# sourceMappingURL=access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/access.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,6BAA6B,EAEnC,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,qCAAqC,EAChD,6CAAsD,CAAA;AACxD,eAAO,MAAM,oCAAoC,EAC/C,4CAAqD,CAAA;AAEvD,MAAM,WAAW,mCAAmC;IAClD,UAAU,EAAE,kBAAkB,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;CACjB;AAgBD,wBAAsB,iCAAiC,CACrD,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,mCAAmC,CAAC,CAY9C;AAED,wBAAsB,qCAAqC,CACzD,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,mCAAmC,CAAC,CAY9C;AAED,wBAAsB,oCAAoC,CACxD,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,wBAAsB,qCAAqC,CACzD,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAWf"}
@@ -0,0 +1,53 @@
1
+ import { NativeCapabilityBridgeError, callNativeCapabilityBridge, } from './bridge';
2
+ import { isNativeCapabilityId } from './capabilities';
3
+ export const NATIVE_CAPABILITY_ACCESS_REQUEST_TYPE = 'moldable:native-capabilities-access-request';
4
+ export const NATIVE_CAPABILITY_ACCESS_RESULT_TYPE = 'moldable:native-capabilities-access-result';
5
+ function isEmbedded() {
6
+ return typeof window !== 'undefined' && window.parent !== window;
7
+ }
8
+ function validateCapability(capability) {
9
+ if (isNativeCapabilityId(capability))
10
+ return capability;
11
+ throw new NativeCapabilityBridgeError({
12
+ code: 'invalid_request',
13
+ message: 'Unknown native capability.',
14
+ });
15
+ }
16
+ export async function getMoldableNativeCapabilityAccess(capability, options = {}) {
17
+ const validated = validateCapability(capability);
18
+ if (!isEmbedded())
19
+ return { capability: validated, granted: true };
20
+ return callNativeCapabilityBridge({
21
+ type: NATIVE_CAPABILITY_ACCESS_REQUEST_TYPE,
22
+ action: 'getStatus',
23
+ capability: validated,
24
+ }, NATIVE_CAPABILITY_ACCESS_RESULT_TYPE, options);
25
+ }
26
+ export async function requestMoldableNativeCapabilityAccess(capability, options = {}) {
27
+ const validated = validateCapability(capability);
28
+ if (!isEmbedded())
29
+ return { capability: validated, granted: true };
30
+ return callNativeCapabilityBridge({
31
+ type: NATIVE_CAPABILITY_ACCESS_REQUEST_TYPE,
32
+ action: 'request',
33
+ capability: validated,
34
+ }, NATIVE_CAPABILITY_ACCESS_RESULT_TYPE, options);
35
+ }
36
+ export async function assertMoldableNativeCapabilityAccess(capability, options = {}) {
37
+ const result = await getMoldableNativeCapabilityAccess(capability, options);
38
+ if (!result.granted) {
39
+ throw new NativeCapabilityBridgeError({
40
+ code: 'permission_denied',
41
+ message: `Access to ${capability} was not approved for this app.`,
42
+ });
43
+ }
44
+ }
45
+ export async function requireMoldableNativeCapabilityAccess(capability, options = {}) {
46
+ const result = await requestMoldableNativeCapabilityAccess(capability, options);
47
+ if (!result.granted) {
48
+ throw new NativeCapabilityBridgeError({
49
+ code: 'permission_denied',
50
+ message: `Access to ${capability} was not approved for this app.`,
51
+ });
52
+ }
53
+ }
@@ -0,0 +1,14 @@
1
+ import type { MoldableBluetoothAvailability, MoldableBluetoothDevice, MoldableBluetoothOperationOptions, MoldableBluetoothRequestDeviceOptions, MoldableBluetoothRequestOptions } from './bluetooth-types';
2
+ /** Checks only for the standards-based Web Bluetooth entry point. */
3
+ export declare function isMoldableBluetoothSupported(): boolean;
4
+ /**
5
+ * Returns adapter availability when the runtime exposes it. `unknown` means the
6
+ * API exists but cannot report adapter state, not that Bluetooth is available.
7
+ */
8
+ export declare function getMoldableBluetoothAvailability(options?: MoldableBluetoothOperationOptions): Promise<MoldableBluetoothAvailability>;
9
+ /**
10
+ * Opens the browser's device chooser. This must be called directly from a
11
+ * trusted user action; it never silently scans for or selects devices.
12
+ */
13
+ export declare function requestMoldableBluetoothDevice(deviceOptions: MoldableBluetoothRequestDeviceOptions, options?: MoldableBluetoothRequestOptions): Promise<MoldableBluetoothDevice>;
14
+ //# sourceMappingURL=bluetooth-access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bluetooth-access.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/bluetooth-access.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,iCAAiC,EACjC,qCAAqC,EACrC,+BAA+B,EAChC,MAAM,mBAAmB,CAAA;AAE1B,qEAAqE;AACrE,wBAAgB,4BAA4B,IAAI,OAAO,CAGtD;AAED;;;GAGG;AACH,wBAAsB,gCAAgC,CACpD,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,6BAA6B,CAAC,CAgBxC;AAED;;;GAGG;AACH,wBAAsB,8BAA8B,CAClD,aAAa,EAAE,qCAAqC,EACpD,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC,uBAAuB,CAAC,CAgBlC"}
@@ -0,0 +1,43 @@
1
+ import { assertMoldableNativeCapabilityAccess, requireMoldableNativeCapabilityAccess, } from './access';
2
+ import { abortableBluetooth, assertBluetoothUserGesture, bluetoothError, getBluetoothAPI, getBluetoothNavigator, validateBluetoothRequestOptions, } from './bluetooth-internal';
3
+ /** Checks only for the standards-based Web Bluetooth entry point. */
4
+ export function isMoldableBluetoothSupported() {
5
+ const api = getBluetoothNavigator()?.bluetooth;
6
+ return Boolean(api && typeof api.requestDevice === 'function');
7
+ }
8
+ /**
9
+ * Returns adapter availability when the runtime exposes it. `unknown` means the
10
+ * API exists but cannot report adapter state, not that Bluetooth is available.
11
+ */
12
+ export async function getMoldableBluetoothAvailability(options = {}) {
13
+ const operation = 'check Bluetooth availability';
14
+ await assertMoldableNativeCapabilityAccess('bluetooth', options);
15
+ const api = getBluetoothAPI(operation);
16
+ if (typeof api.getAvailability !== 'function')
17
+ return 'unknown';
18
+ try {
19
+ return (await abortableBluetooth(api.getAvailability(), options.signal, operation))
20
+ ? 'available'
21
+ : 'unavailable';
22
+ }
23
+ catch (error) {
24
+ throw bluetoothError(error, operation);
25
+ }
26
+ }
27
+ /**
28
+ * Opens the browser's device chooser. This must be called directly from a
29
+ * trusted user action; it never silently scans for or selects devices.
30
+ */
31
+ export async function requestMoldableBluetoothDevice(deviceOptions, options = {}) {
32
+ const operation = 'request a Bluetooth device';
33
+ validateBluetoothRequestOptions(deviceOptions);
34
+ assertBluetoothUserGesture();
35
+ try {
36
+ await requireMoldableNativeCapabilityAccess('bluetooth', options);
37
+ const api = getBluetoothAPI(operation);
38
+ return await abortableBluetooth(api.requestDevice(deviceOptions), options.signal, operation, (device) => device.gatt?.disconnect());
39
+ }
40
+ catch (error) {
41
+ throw bluetoothError(error, operation);
42
+ }
43
+ }
@@ -0,0 +1,19 @@
1
+ import type { MoldableBluetoothConnectionOptions, MoldableBluetoothDevice, MoldableBluetoothOperationOptions, MoldableBluetoothRemoteGATTServer, MoldableBluetoothRemoteGATTService, MoldableBluetoothUUID } from './bluetooth-types';
2
+ export declare class MoldableBluetoothConnection {
3
+ readonly device: MoldableBluetoothDevice;
4
+ readonly server: MoldableBluetoothRemoteGATTServer;
5
+ private readonly abortSignal?;
6
+ private readonly disconnectListeners;
7
+ private isClosed;
8
+ constructor(device: MoldableBluetoothDevice, server: MoldableBluetoothRemoteGATTServer, options?: MoldableBluetoothConnectionOptions);
9
+ get connected(): boolean;
10
+ onDisconnected(listener: () => void, signal?: AbortSignal): () => void;
11
+ getPrimaryService(service: MoldableBluetoothUUID, options?: MoldableBluetoothOperationOptions): Promise<MoldableBluetoothRemoteGATTService>;
12
+ disconnect(): void;
13
+ private readonly handleAbort;
14
+ private readonly handleDisconnected;
15
+ private finish;
16
+ }
17
+ /** Connects a previously user-selected device and owns disconnect cleanup. */
18
+ export declare function connectMoldableBluetoothDevice(device: MoldableBluetoothDevice, options?: MoldableBluetoothConnectionOptions): Promise<MoldableBluetoothConnection>;
19
+ //# sourceMappingURL=bluetooth-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bluetooth-connection.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/bluetooth-connection.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kCAAkC,EAClC,uBAAuB,EACvB,iCAAiC,EACjC,iCAAiC,EACjC,kCAAkC,EAClC,qBAAqB,EACtB,MAAM,mBAAmB,CAAA;AAE1B,qBAAa,2BAA2B;IACtC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAA;IACxC,QAAQ,CAAC,MAAM,EAAE,iCAAiC,CAAA;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAa;IAC1C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAwB;IAC5D,OAAO,CAAC,QAAQ,CAAQ;gBAGtB,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,iCAAiC,EACzC,OAAO,GAAE,kCAAuC;IASlD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI;IAWhE,iBAAiB,CACrB,OAAO,EAAE,qBAAqB,EAC9B,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,kCAAkC,CAAC;IAmB9C,UAAU,IAAI,IAAI;IAMlB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0B;IACtD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA0B;IAE7D,OAAO,CAAC,MAAM;CAqBf;AAED,8EAA8E;AAC9E,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,uBAAuB,EAC/B,OAAO,GAAE,kCAAuC,GAC/C,OAAO,CAAC,2BAA2B,CAAC,CA0BtC"}
@@ -0,0 +1,88 @@
1
+ import { abortableBluetooth, bluetoothAborted, bluetoothError, } from './bluetooth-internal';
2
+ export class MoldableBluetoothConnection {
3
+ device;
4
+ server;
5
+ abortSignal;
6
+ disconnectListeners = new Set();
7
+ isClosed = false;
8
+ constructor(device, server, options = {}) {
9
+ this.device = device;
10
+ this.server = server;
11
+ this.abortSignal = options.signal;
12
+ device.addEventListener('gattserverdisconnected', this.handleDisconnected);
13
+ options.signal?.addEventListener('abort', this.handleAbort, { once: true });
14
+ }
15
+ get connected() {
16
+ return !this.isClosed && this.server.connected;
17
+ }
18
+ onDisconnected(listener, signal) {
19
+ if (signal?.aborted || this.isClosed)
20
+ return () => undefined;
21
+ this.disconnectListeners.add(listener);
22
+ const cleanup = () => {
23
+ this.disconnectListeners.delete(listener);
24
+ signal?.removeEventListener('abort', cleanup);
25
+ };
26
+ signal?.addEventListener('abort', cleanup, { once: true });
27
+ return cleanup;
28
+ }
29
+ async getPrimaryService(service, options = {}) {
30
+ const operation = `get Bluetooth service ${String(service)}`;
31
+ if (!this.connected) {
32
+ throw bluetoothError(new DOMException('Bluetooth device is disconnected', 'NetworkError'), operation);
33
+ }
34
+ try {
35
+ return await abortableBluetooth(this.server.getPrimaryService(service), options.signal, operation);
36
+ }
37
+ catch (error) {
38
+ throw bluetoothError(error, operation);
39
+ }
40
+ }
41
+ disconnect() {
42
+ if (this.isClosed)
43
+ return;
44
+ this.finish(false);
45
+ if (this.server.connected)
46
+ this.server.disconnect();
47
+ }
48
+ handleAbort = () => this.disconnect();
49
+ handleDisconnected = () => this.finish(true);
50
+ finish(notify) {
51
+ if (this.isClosed)
52
+ return;
53
+ this.isClosed = true;
54
+ this.device.removeEventListener('gattserverdisconnected', this.handleDisconnected);
55
+ this.abortSignal?.removeEventListener('abort', this.handleAbort);
56
+ if (notify) {
57
+ const listeners = [...this.disconnectListeners];
58
+ this.disconnectListeners.clear();
59
+ for (const listener of listeners) {
60
+ try {
61
+ listener();
62
+ }
63
+ catch {
64
+ // A consumer callback must not prevent connection cleanup.
65
+ }
66
+ }
67
+ }
68
+ this.disconnectListeners.clear();
69
+ }
70
+ }
71
+ /** Connects a previously user-selected device and owns disconnect cleanup. */
72
+ export async function connectMoldableBluetoothDevice(device, options = {}) {
73
+ const operation = `connect to Bluetooth device ${device.id}`;
74
+ if (!device.gatt) {
75
+ throw bluetoothError(new DOMException('Device does not expose a GATT server', 'NotSupportedError'), operation);
76
+ }
77
+ try {
78
+ const server = await abortableBluetooth(device.gatt.connect(), options.signal, operation, (lateServer) => lateServer.disconnect());
79
+ if (options.signal?.aborted) {
80
+ server.disconnect();
81
+ throw bluetoothAborted(operation);
82
+ }
83
+ return new MoldableBluetoothConnection(device, server, options);
84
+ }
85
+ catch (error) {
86
+ throw bluetoothError(error, operation);
87
+ }
88
+ }
@@ -0,0 +1,7 @@
1
+ import type { MoldableBluetoothOperationOptions, MoldableBluetoothRemoteGATTCharacteristic, MoldableBluetoothRemoteGATTService, MoldableBluetoothUUID, MoldableBluetoothWriteMode } from './bluetooth-types';
2
+ export declare function getMoldableBluetoothCharacteristic(service: MoldableBluetoothRemoteGATTService, characteristic: MoldableBluetoothUUID, options?: MoldableBluetoothOperationOptions): Promise<MoldableBluetoothRemoteGATTCharacteristic>;
3
+ export declare function readMoldableBluetoothValue(characteristic: MoldableBluetoothRemoteGATTCharacteristic, options?: MoldableBluetoothOperationOptions): Promise<DataView>;
4
+ /** Starts notifications and returns async, idempotent subscription cleanup. */
5
+ export declare function observeMoldableBluetoothNotifications(characteristic: MoldableBluetoothRemoteGATTCharacteristic, listener: (event: Event) => void, options?: MoldableBluetoothOperationOptions): Promise<() => Promise<void>>;
6
+ export declare function writeMoldableBluetoothValue(characteristic: MoldableBluetoothRemoteGATTCharacteristic, value: BufferSource, mode?: MoldableBluetoothWriteMode, options?: MoldableBluetoothOperationOptions): Promise<void>;
7
+ //# sourceMappingURL=bluetooth-gatt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bluetooth-gatt.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/bluetooth-gatt.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,iCAAiC,EACjC,yCAAyC,EACzC,kCAAkC,EAClC,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAA;AAE1B,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,kCAAkC,EAC3C,cAAc,EAAE,qBAAqB,EACrC,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,yCAAyC,CAAC,CAWpD;AAED,wBAAsB,0BAA0B,CAC9C,cAAc,EAAE,yCAAyC,EACzD,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,QAAQ,CAAC,CAWnB;AAED,+EAA+E;AAC/E,wBAAsB,qCAAqC,CACzD,cAAc,EAAE,yCAAyC,EACzD,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAChC,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAmC9B;AAED,wBAAsB,2BAA2B,CAC/C,cAAc,EAAE,yCAAyC,EACzD,KAAK,EAAE,YAAY,EACnB,IAAI,GAAE,0BAAwC,EAC9C,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
@@ -0,0 +1,77 @@
1
+ import { abortableBluetooth, bluetoothAborted, bluetoothError, } from './bluetooth-internal';
2
+ export async function getMoldableBluetoothCharacteristic(service, characteristic, options = {}) {
3
+ const operation = `get Bluetooth characteristic ${String(characteristic)}`;
4
+ try {
5
+ return await abortableBluetooth(service.getCharacteristic(characteristic), options.signal, operation);
6
+ }
7
+ catch (error) {
8
+ throw bluetoothError(error, operation);
9
+ }
10
+ }
11
+ export async function readMoldableBluetoothValue(characteristic, options = {}) {
12
+ const operation = `read Bluetooth characteristic ${characteristic.uuid}`;
13
+ try {
14
+ return await abortableBluetooth(characteristic.readValue(), options.signal, operation);
15
+ }
16
+ catch (error) {
17
+ throw bluetoothError(error, operation);
18
+ }
19
+ }
20
+ /** Starts notifications and returns async, idempotent subscription cleanup. */
21
+ export async function observeMoldableBluetoothNotifications(characteristic, listener, options = {}) {
22
+ const operation = `observe Bluetooth characteristic ${characteristic.uuid}`;
23
+ try {
24
+ await abortableBluetooth(characteristic.startNotifications(), options.signal, operation, (lateCharacteristic) => {
25
+ void lateCharacteristic.stopNotifications();
26
+ });
27
+ if (options.signal?.aborted) {
28
+ await characteristic.stopNotifications();
29
+ throw bluetoothAborted(operation);
30
+ }
31
+ }
32
+ catch (error) {
33
+ throw bluetoothError(error, operation);
34
+ }
35
+ let active = true;
36
+ const cleanup = async () => {
37
+ if (!active)
38
+ return;
39
+ active = false;
40
+ characteristic.removeEventListener('characteristicvaluechanged', listener);
41
+ options.signal?.removeEventListener('abort', onAbort);
42
+ try {
43
+ await characteristic.stopNotifications();
44
+ }
45
+ catch (error) {
46
+ throw bluetoothError(error, `stop ${operation}`);
47
+ }
48
+ };
49
+ const onAbort = () => void cleanup().catch(() => undefined);
50
+ characteristic.addEventListener('characteristicvaluechanged', listener);
51
+ options.signal?.addEventListener('abort', onAbort, { once: true });
52
+ return cleanup;
53
+ }
54
+ export async function writeMoldableBluetoothValue(characteristic, value, mode = 'automatic', options = {}) {
55
+ const operation = `write Bluetooth characteristic ${characteristic.uuid}`;
56
+ let write;
57
+ if (mode === 'with-response') {
58
+ write = characteristic.writeValueWithResponse?.bind(characteristic);
59
+ }
60
+ else if (mode === 'without-response') {
61
+ write = characteristic.writeValueWithoutResponse?.bind(characteristic);
62
+ }
63
+ else {
64
+ write =
65
+ characteristic.writeValueWithResponse?.bind(characteristic) ??
66
+ characteristic.writeValue.bind(characteristic);
67
+ }
68
+ if (!write) {
69
+ throw bluetoothError(new DOMException(`Bluetooth write mode ${mode} is unavailable`, 'NotSupportedError'), operation);
70
+ }
71
+ try {
72
+ await abortableBluetooth(write(value), options.signal, operation);
73
+ }
74
+ catch (error) {
75
+ throw bluetoothError(error, operation);
76
+ }
77
+ }
@@ -0,0 +1,10 @@
1
+ import type { MoldableBluetoothAPI, MoldableBluetoothNavigator, MoldableBluetoothRequestDeviceOptions } from './bluetooth-types';
2
+ import { NativeCapabilityBridgeError } from './bridge';
3
+ export declare function bluetoothError(error: unknown, operation: string): NativeCapabilityBridgeError;
4
+ export declare function bluetoothAborted(operation: string): NativeCapabilityBridgeError;
5
+ export declare function getBluetoothNavigator(): MoldableBluetoothNavigator | undefined;
6
+ export declare function getBluetoothAPI(operation: string): MoldableBluetoothAPI;
7
+ export declare function assertBluetoothUserGesture(): void;
8
+ export declare function validateBluetoothRequestOptions(options: MoldableBluetoothRequestDeviceOptions): void;
9
+ export declare function abortableBluetooth<T>(promise: Promise<T>, signal: AbortSignal | undefined, operation: string, onLateResolution?: (value: T) => void): Promise<T>;
10
+ //# sourceMappingURL=bluetooth-internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bluetooth-internal.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/bluetooth-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,qCAAqC,EACtC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,2BAA2B,EAE5B,MAAM,UAAU,CAAA;AAGjB,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,GAChB,2BAA2B,CAsC7B;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,GAChB,2BAA2B,CAK7B;AAED,wBAAgB,qBAAqB,IACjC,0BAA0B,GAC1B,SAAS,CAIZ;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,CASvE;AAED,wBAAgB,0BAA0B,IAAI,IAAI,CAWjD;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,qCAAqC,GAC7C,IAAI,CAiBN;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,SAAS,EAAE,MAAM,EACjB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GACpC,OAAO,CAAC,CAAC,CAAC,CA+BZ"}