@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,4 @@
1
+ export { getMoldableBluetoothAvailability, isMoldableBluetoothSupported, requestMoldableBluetoothDevice, } from './bluetooth-access';
2
+ export { connectMoldableBluetoothDevice, MoldableBluetoothConnection, } from './bluetooth-connection';
3
+ export { getMoldableBluetoothCharacteristic, observeMoldableBluetoothNotifications, readMoldableBluetoothValue, writeMoldableBluetoothValue, } from './bluetooth-gatt';
4
+ export { requestMoldableBluetoothWithFallback } from './bluetooth-native-fallback';
@@ -0,0 +1,23 @@
1
+ import { type NativeHardwareCapabilityManifest, type NativeHardwareErrorCode, type NativeHardwareErrorPayload } from './types';
2
+ export declare const NATIVE_HARDWARE_CANCEL_REQUEST_TYPE: "moldable:native-hardware-cancel";
3
+ export interface NativeHardwareBridgeOptions {
4
+ timeoutMs?: number;
5
+ signal?: AbortSignal;
6
+ }
7
+ export declare class NativeHardwareBridgeError extends Error {
8
+ readonly code: NativeHardwareErrorCode;
9
+ readonly details?: unknown;
10
+ readonly retryable?: boolean;
11
+ constructor(error: NativeHardwareErrorPayload);
12
+ }
13
+ export declare function toNativeHardwareBridgeError(value: unknown, fallbackMessage?: string): NativeHardwareBridgeError;
14
+ /** Resolve only desktop-owned parent origins; unknown embedders fail closed. */
15
+ export declare function resolveNativeHardwareParentOrigin(referrer: string, immediateAncestorOrigin?: string, currentOrigin?: string, allowDevelopmentOrigin?: boolean): string | null;
16
+ export declare function callNativeHardwareBridge<TResult>(request: {
17
+ type: string;
18
+ [key: string]: unknown;
19
+ }, responseType: string, options?: NativeHardwareBridgeOptions): Promise<TResult>;
20
+ export declare function getNativeHardwareCapabilities(options?: NativeHardwareBridgeOptions): Promise<NativeHardwareCapabilityManifest>;
21
+ /** Public app-author API for querying the host's native capability manifest. */
22
+ export declare const getMoldableNativeCapabilities: typeof getNativeHardwareCapabilities;
23
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../src/lib/native-hardware/bridge.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,gCAAgC,EACrC,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAChC,MAAM,SAAS,CAAA;AAGhB,eAAO,MAAM,mCAAmC,EAC9C,iCAA0C,CAAA;AAc5C,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAA;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;gBAEhB,KAAK,EAAE,0BAA0B;CAO9C;AAiBD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,EACd,eAAe,SAAoC,GAClD,yBAAyB,CAW3B;AA6FD,gFAAgF;AAChF,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,EAChB,uBAAuB,SAAgC,EACvD,aAAa,SAAyB,EACtC,sBAAsB,UAAmC,GACxD,MAAM,GAAG,IAAI,CAoBf;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAC9C,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EACjD,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,OAAO,CAAC,CAqIlB;AAED,wBAAsB,6BAA6B,CACjD,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,gCAAgC,CAAC,CAkB3C;AAED,gFAAgF;AAChF,eAAO,MAAM,6BAA6B,sCAAgC,CAAA"}
@@ -0,0 +1,266 @@
1
+ import { isNativeHardwareCapabilityManifest } from './capabilities';
2
+ import { NATIVE_HARDWARE_CAPABILITIES_REQUEST_TYPE, NATIVE_HARDWARE_CAPABILITIES_RESULT_TYPE, } from './types';
3
+ const DEFAULT_TIMEOUT_MS = 10_000;
4
+ export const NATIVE_HARDWARE_CANCEL_REQUEST_TYPE = 'moldable:native-hardware-cancel';
5
+ const ERROR_CODES = new Set([
6
+ 'invalid_request',
7
+ 'not_in_moldable',
8
+ 'timeout',
9
+ 'aborted',
10
+ 'invalid_response',
11
+ 'unsupported',
12
+ 'unavailable',
13
+ 'permission_denied',
14
+ 'cancelled',
15
+ 'host_error',
16
+ ]);
17
+ export class NativeHardwareBridgeError extends Error {
18
+ code;
19
+ details;
20
+ retryable;
21
+ constructor(error) {
22
+ super(error.message);
23
+ this.name = 'NativeHardwareBridgeError';
24
+ this.code = error.code;
25
+ this.details = error.details;
26
+ this.retryable = error.retryable;
27
+ }
28
+ }
29
+ function isRecord(value) {
30
+ return typeof value === 'object' && value !== null;
31
+ }
32
+ function isNativeHardwareErrorPayload(value) {
33
+ return (isRecord(value) &&
34
+ typeof value.code === 'string' &&
35
+ ERROR_CODES.has(value.code) &&
36
+ typeof value.message === 'string');
37
+ }
38
+ export function toNativeHardwareBridgeError(value, fallbackMessage = 'Native hardware request failed.') {
39
+ if (value instanceof NativeHardwareBridgeError)
40
+ return value;
41
+ if (isNativeHardwareErrorPayload(value)) {
42
+ return new NativeHardwareBridgeError(value);
43
+ }
44
+ return new NativeHardwareBridgeError({
45
+ code: 'host_error',
46
+ message: value instanceof Error ? value.message : fallbackMessage,
47
+ details: value,
48
+ });
49
+ }
50
+ function makeRequestId() {
51
+ if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) {
52
+ return `native-hardware-${crypto.randomUUID()}`;
53
+ }
54
+ return `native-hardware-${Date.now()}-${Math.random().toString(36).slice(2)}`;
55
+ }
56
+ function hasExplicitAuthorityPort(value) {
57
+ const authorityStart = value.indexOf('//');
58
+ if (authorityStart < 0)
59
+ return false;
60
+ const authority = value
61
+ .slice(authorityStart + 2)
62
+ .split(/[/?#]/, 1)[0]
63
+ ?.split('@')
64
+ .at(-1);
65
+ return authority?.includes(':') === true;
66
+ }
67
+ function resolveDesktopOwnedOrigin(value, allowDevelopmentOrigin) {
68
+ try {
69
+ const url = new URL(value);
70
+ const hasUnexpectedAuthority = url.username !== '' ||
71
+ url.password !== '' ||
72
+ hasExplicitAuthorityPort(value);
73
+ if (url.protocol === 'tauri:' &&
74
+ url.hostname === 'localhost' &&
75
+ !hasUnexpectedAuthority) {
76
+ return `${url.protocol}//${url.host}`;
77
+ }
78
+ if ((url.protocol === 'http:' || url.protocol === 'https:') &&
79
+ url.hostname === 'tauri.localhost' &&
80
+ !hasUnexpectedAuthority) {
81
+ return url.origin;
82
+ }
83
+ if (allowDevelopmentOrigin &&
84
+ url.protocol === 'http:' &&
85
+ (url.hostname === 'localhost' || url.hostname === '127.0.0.1') &&
86
+ url.port === '5173') {
87
+ return url.origin;
88
+ }
89
+ }
90
+ catch {
91
+ // Invalid origins are never trusted.
92
+ }
93
+ return null;
94
+ }
95
+ function readImmediateAncestorOrigin() {
96
+ try {
97
+ return window.location.ancestorOrigins?.item(0) ?? '';
98
+ }
99
+ catch {
100
+ return '';
101
+ }
102
+ }
103
+ function referrerMatchesCurrentOrigin(referrer, currentOrigin) {
104
+ try {
105
+ const referrerOrigin = new URL(referrer).origin;
106
+ const documentOrigin = new URL(currentOrigin).origin;
107
+ return (referrerOrigin !== 'null' &&
108
+ documentOrigin !== 'null' &&
109
+ referrerOrigin === documentOrigin);
110
+ }
111
+ catch {
112
+ return false;
113
+ }
114
+ }
115
+ function allowsDesktopDevelopmentOrigin() {
116
+ return (import.meta.env.DEV &&
117
+ import.meta.env.VITE_MOLDABLE_DESKTOP_DEV_BRIDGE === 'true');
118
+ }
119
+ /** Resolve only desktop-owned parent origins; unknown embedders fail closed. */
120
+ export function resolveNativeHardwareParentOrigin(referrer, immediateAncestorOrigin = readImmediateAncestorOrigin(), currentOrigin = window.location.origin, allowDevelopmentOrigin = allowsDesktopDevelopmentOrigin()) {
121
+ const referrerValue = referrer.trim();
122
+ if (referrerValue) {
123
+ const trustedReferrer = resolveDesktopOwnedOrigin(referrerValue, allowDevelopmentOrigin);
124
+ if (trustedReferrer)
125
+ return trustedReferrer;
126
+ // A same-origin reload or HMR navigation can replace the parent referrer
127
+ // with the app's own URL. In that case the browser-owned ancestor list is
128
+ // still the authoritative embedding boundary. A different untrusted
129
+ // referrer never reaches this fallback.
130
+ if (!referrerMatchesCurrentOrigin(referrerValue, currentOrigin))
131
+ return null;
132
+ }
133
+ return resolveDesktopOwnedOrigin(immediateAncestorOrigin.trim(), allowDevelopmentOrigin);
134
+ }
135
+ export function callNativeHardwareBridge(request, responseType, options = {}) {
136
+ if (typeof window === 'undefined' || window.parent === window) {
137
+ return Promise.reject(new NativeHardwareBridgeError({
138
+ code: 'not_in_moldable',
139
+ message: 'Native hardware APIs are only available inside Moldable.',
140
+ retryable: false,
141
+ }));
142
+ }
143
+ const parentOrigin = resolveNativeHardwareParentOrigin(document.referrer);
144
+ if (!parentOrigin) {
145
+ return Promise.reject(new NativeHardwareBridgeError({
146
+ code: 'not_in_moldable',
147
+ message: 'The native hardware bridge parent could not be verified.',
148
+ retryable: false,
149
+ }));
150
+ }
151
+ if (options.signal?.aborted) {
152
+ return Promise.reject(new NativeHardwareBridgeError({
153
+ code: 'aborted',
154
+ message: 'Native hardware request was aborted.',
155
+ retryable: false,
156
+ }));
157
+ }
158
+ return new Promise((resolve, reject) => {
159
+ const requestId = makeRequestId();
160
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
161
+ let settled = false;
162
+ const cleanup = () => {
163
+ window.clearTimeout(timeout);
164
+ window.removeEventListener('message', handleResponse);
165
+ options.signal?.removeEventListener('abort', handleAbort);
166
+ };
167
+ const cancelHostRequest = () => {
168
+ if (settled)
169
+ return;
170
+ try {
171
+ window.parent.postMessage({
172
+ type: NATIVE_HARDWARE_CANCEL_REQUEST_TYPE,
173
+ requestType: request.type,
174
+ requestId,
175
+ }, parentOrigin);
176
+ }
177
+ catch {
178
+ // The local rejection still completes if the parent disappeared.
179
+ }
180
+ };
181
+ const fail = (error) => {
182
+ if (settled)
183
+ return;
184
+ settled = true;
185
+ cleanup();
186
+ reject(new NativeHardwareBridgeError(error));
187
+ };
188
+ const handleAbort = () => {
189
+ cancelHostRequest();
190
+ fail({
191
+ code: 'aborted',
192
+ message: 'Native hardware request was aborted.',
193
+ retryable: false,
194
+ });
195
+ };
196
+ const handleResponse = (event) => {
197
+ if (event.source !== window.parent)
198
+ return;
199
+ if (event.origin !== parentOrigin)
200
+ return;
201
+ if (!isRecord(event.data))
202
+ return;
203
+ if (event.data.type !== responseType)
204
+ return;
205
+ if (event.data.requestId !== requestId)
206
+ return;
207
+ if (event.data.ok === true && 'result' in event.data) {
208
+ if (settled)
209
+ return;
210
+ settled = true;
211
+ cleanup();
212
+ resolve(event.data.result);
213
+ return;
214
+ }
215
+ if (event.data.ok === false &&
216
+ isNativeHardwareErrorPayload(event.data.error)) {
217
+ fail(event.data.error);
218
+ return;
219
+ }
220
+ fail({
221
+ code: 'invalid_response',
222
+ message: 'Moldable returned an invalid native hardware response.',
223
+ details: event.data,
224
+ retryable: false,
225
+ });
226
+ };
227
+ const timeout = window.setTimeout(() => {
228
+ cancelHostRequest();
229
+ fail({
230
+ code: 'timeout',
231
+ message: 'Native hardware request timed out.',
232
+ details: { timeoutMs },
233
+ retryable: true,
234
+ });
235
+ }, timeoutMs);
236
+ window.addEventListener('message', handleResponse);
237
+ options.signal?.addEventListener('abort', handleAbort, { once: true });
238
+ try {
239
+ window.parent.postMessage({ ...request, requestId }, parentOrigin);
240
+ }
241
+ catch (error) {
242
+ fail({
243
+ code: 'host_error',
244
+ message: error instanceof Error
245
+ ? error.message
246
+ : 'Failed to send native hardware request.',
247
+ details: error,
248
+ retryable: true,
249
+ });
250
+ }
251
+ });
252
+ }
253
+ export async function getNativeHardwareCapabilities(options = {}) {
254
+ const manifest = await callNativeHardwareBridge({ type: NATIVE_HARDWARE_CAPABILITIES_REQUEST_TYPE }, NATIVE_HARDWARE_CAPABILITIES_RESULT_TYPE, options);
255
+ if (!isNativeHardwareCapabilityManifest(manifest)) {
256
+ throw new NativeHardwareBridgeError({
257
+ code: 'invalid_response',
258
+ message: 'Moldable returned an invalid native hardware manifest.',
259
+ details: manifest,
260
+ retryable: false,
261
+ });
262
+ }
263
+ return manifest;
264
+ }
265
+ /** Public app-author API for querying the host's native capability manifest. */
266
+ export const getMoldableNativeCapabilities = getNativeHardwareCapabilities;
@@ -0,0 +1,7 @@
1
+ import { type NativeHardwareCapabilityDescriptor, type NativeHardwareCapabilityId, type NativeHardwareCapabilityManifest } from './types';
2
+ export declare function isNativeHardwareCapabilityId(value: unknown): value is NativeHardwareCapabilityId;
3
+ export declare function isNativeHardwareCapabilityDescriptor(value: unknown, expectedId?: NativeHardwareCapabilityId): value is NativeHardwareCapabilityDescriptor;
4
+ export declare function isNativeHardwareCapabilityManifest(value: unknown): value is NativeHardwareCapabilityManifest;
5
+ export declare function getNativeHardwareCapability(manifest: NativeHardwareCapabilityManifest, id: NativeHardwareCapabilityId): NativeHardwareCapabilityDescriptor;
6
+ export declare function supportsNativeHardwareCapability(manifest: NativeHardwareCapabilityManifest, id: NativeHardwareCapabilityId): boolean;
7
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/lib/native-hardware/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACtC,MAAM,SAAS,CAAA;AA+ChB,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,0BAA0B,CAErC;AAED,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,OAAO,EACd,UAAU,CAAC,EAAE,0BAA0B,GACtC,KAAK,IAAI,kCAAkC,CA4B7C;AAED,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,gCAAgC,CAe3C;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,gCAAgC,EAC1C,EAAE,EAAE,0BAA0B,GAC7B,kCAAkC,CAEpC;AAED,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,gCAAgC,EAC1C,EAAE,EAAE,0BAA0B,GAC7B,OAAO,CAET"}
@@ -0,0 +1,95 @@
1
+ import { NATIVE_HARDWARE_CAPABILITY_IDS, NATIVE_HARDWARE_MANIFEST_SCHEMA_VERSION, } from './types';
2
+ const CAPABILITY_IDS = new Set(NATIVE_HARDWARE_CAPABILITY_IDS);
3
+ const PLATFORMS = new Set(['macos', 'windows', 'linux', 'unknown']);
4
+ const SUPPORT_LEVELS = new Set(['supported', 'partial', 'unsupported']);
5
+ const TRANSPORT_KINDS = new Set([
6
+ 'web-api',
7
+ 'desktop-bridge',
8
+ 'tauri-command',
9
+ 'hybrid',
10
+ 'unavailable',
11
+ ]);
12
+ const PERMISSION_NAMES = new Set([
13
+ 'camera',
14
+ 'microphone',
15
+ 'screen-recording',
16
+ 'location',
17
+ 'clipboard-read',
18
+ 'clipboard-write',
19
+ 'notifications',
20
+ 'global-shortcuts',
21
+ 'local-authentication',
22
+ 'secure-storage',
23
+ 'usb',
24
+ 'hid',
25
+ 'serial',
26
+ 'midi',
27
+ 'bluetooth',
28
+ 'none',
29
+ ]);
30
+ const PERMISSION_AUTHORITIES = new Set([
31
+ 'webview',
32
+ 'operating-system',
33
+ 'both',
34
+ 'none',
35
+ ]);
36
+ const PERMISSION_REQUESTS = new Set([
37
+ 'on-use',
38
+ 'explicit',
39
+ 'system-settings',
40
+ 'none',
41
+ ]);
42
+ function isRecord(value) {
43
+ return typeof value === 'object' && value !== null;
44
+ }
45
+ export function isNativeHardwareCapabilityId(value) {
46
+ return typeof value === 'string' && CAPABILITY_IDS.has(value);
47
+ }
48
+ export function isNativeHardwareCapabilityDescriptor(value, expectedId) {
49
+ if (!isRecord(value) || !isNativeHardwareCapabilityId(value.id))
50
+ return false;
51
+ if (expectedId && value.id !== expectedId)
52
+ return false;
53
+ if (typeof value.support !== 'string' || !SUPPORT_LEVELS.has(value.support)) {
54
+ return false;
55
+ }
56
+ if (!isRecord(value.transport))
57
+ return false;
58
+ if (typeof value.transport.kind !== 'string' ||
59
+ !TRANSPORT_KINDS.has(value.transport.kind) ||
60
+ typeof value.transport.name !== 'string') {
61
+ return false;
62
+ }
63
+ if (!isRecord(value.permission))
64
+ return false;
65
+ if (typeof value.permission.name !== 'string' ||
66
+ !PERMISSION_NAMES.has(value.permission.name) ||
67
+ typeof value.permission.required !== 'boolean' ||
68
+ typeof value.permission.authority !== 'string' ||
69
+ !PERMISSION_AUTHORITIES.has(value.permission.authority) ||
70
+ typeof value.permission.request !== 'string' ||
71
+ !PERMISSION_REQUESTS.has(value.permission.request)) {
72
+ return false;
73
+ }
74
+ return value.reason === undefined || typeof value.reason === 'string';
75
+ }
76
+ export function isNativeHardwareCapabilityManifest(value) {
77
+ if (!isRecord(value))
78
+ return false;
79
+ if (value.schemaVersion !== NATIVE_HARDWARE_MANIFEST_SCHEMA_VERSION) {
80
+ return false;
81
+ }
82
+ if (typeof value.platform !== 'string' || !PLATFORMS.has(value.platform)) {
83
+ return false;
84
+ }
85
+ if (!isRecord(value.capabilities))
86
+ return false;
87
+ const capabilities = value.capabilities;
88
+ return NATIVE_HARDWARE_CAPABILITY_IDS.every((id) => isNativeHardwareCapabilityDescriptor(capabilities[id], id));
89
+ }
90
+ export function getNativeHardwareCapability(manifest, id) {
91
+ return manifest.capabilities[id];
92
+ }
93
+ export function supportsNativeHardwareCapability(manifest, id) {
94
+ return getNativeHardwareCapability(manifest, id).support !== 'unsupported';
95
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Reads plain text from the clipboard. Browsers generally require a secure context,
3
+ * clipboard permission, and a recent user gesture for reads.
4
+ */
5
+ export declare function readMoldableClipboardText(): Promise<string>;
6
+ /**
7
+ * Writes plain text to the clipboard. Browsers require a secure context and may
8
+ * require this call to run directly in response to a user gesture.
9
+ */
10
+ export declare function writeMoldableClipboardText(text: string): Promise<void>;
11
+ //# sourceMappingURL=clipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../src/lib/native-hardware/clipboard.ts"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,CAAC,CAQjE;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ5E"}
@@ -0,0 +1,55 @@
1
+ import { NativeHardwareBridgeError, toNativeHardwareBridgeError, } from './bridge';
2
+ function clipboardFor(capability, method) {
3
+ if (typeof navigator === 'undefined' ||
4
+ !navigator.clipboard ||
5
+ typeof navigator.clipboard[method] !== 'function') {
6
+ throw clipboardError(capability, new DOMException('Clipboard API unavailable', 'NotSupportedError'));
7
+ }
8
+ return navigator.clipboard;
9
+ }
10
+ function clipboardError(capability, error) {
11
+ if (error instanceof NativeHardwareBridgeError)
12
+ return error;
13
+ const name = error instanceof DOMException ? error.name : undefined;
14
+ let code = 'host_error';
15
+ if (name === 'NotSupportedError')
16
+ code = 'unsupported';
17
+ else if (name === 'NotAllowedError' || name === 'SecurityError') {
18
+ code = 'permission_denied';
19
+ }
20
+ const fallbackMessage = `Unable to ${capability === 'clipboard-read' ? 'read' : 'write'} clipboard text`;
21
+ return toNativeHardwareBridgeError({
22
+ code,
23
+ message: error instanceof Error
24
+ ? error.message || fallbackMessage
25
+ : fallbackMessage,
26
+ details: { capability, ...(name ? { cause: name } : {}) },
27
+ retryable: false,
28
+ }, fallbackMessage);
29
+ }
30
+ /**
31
+ * Reads plain text from the clipboard. Browsers generally require a secure context,
32
+ * clipboard permission, and a recent user gesture for reads.
33
+ */
34
+ export async function readMoldableClipboardText() {
35
+ const capability = 'clipboard-read';
36
+ try {
37
+ return await clipboardFor(capability, 'readText').readText();
38
+ }
39
+ catch (error) {
40
+ throw clipboardError(capability, error);
41
+ }
42
+ }
43
+ /**
44
+ * Writes plain text to the clipboard. Browsers require a secure context and may
45
+ * require this call to run directly in response to a user gesture.
46
+ */
47
+ export async function writeMoldableClipboardText(text) {
48
+ const capability = 'clipboard-write';
49
+ try {
50
+ await clipboardFor(capability, 'writeText').writeText(text);
51
+ }
52
+ catch (error) {
53
+ throw clipboardError(capability, error);
54
+ }
55
+ }
@@ -0,0 +1,11 @@
1
+ import { NativeHardwareBridgeError } from './bridge';
2
+ export type DeviceIoOperation = 'enumerate' | 'request' | 'open' | 'close' | 'read' | 'write';
3
+ export declare function deviceIoError(capability: 'usb' | 'hid' | 'serial', operation: DeviceIoOperation, error: unknown): NativeHardwareBridgeError;
4
+ export declare function unsupportedDeviceIoError(capability: 'usb' | 'hid' | 'serial'): NativeHardwareBridgeError;
5
+ export declare function abortedDeviceIoError(capability: 'usb' | 'hid' | 'serial', operation: DeviceIoOperation): NativeHardwareBridgeError;
6
+ /**
7
+ * Rejects promptly when the caller aborts. The browser operation itself may
8
+ * continue when its underlying standard does not accept an AbortSignal.
9
+ */
10
+ export declare function awaitDeviceIoWithAbort<T>(promise: Promise<T>, capability: 'usb' | 'hid' | 'serial', operation: DeviceIoOperation, signal?: AbortSignal): Promise<T>;
11
+ //# sourceMappingURL=device-io-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-io-errors.d.ts","sourceRoot":"","sources":["../../../src/lib/native-hardware/device-io-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EAE1B,MAAM,UAAU,CAAA;AAGjB,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,SAAS,GACT,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,CAAA;AA8BX,wBAAgB,aAAa,CAC3B,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,EACpC,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,OAAO,GACb,yBAAyB,CAuB3B;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,GACnC,yBAAyB,CAO3B;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,EACpC,SAAS,EAAE,iBAAiB,GAC3B,yBAAyB,CAO3B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,EACpC,SAAS,EAAE,iBAAiB,EAC5B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,CAAC,CAAC,CAuBZ"}
@@ -0,0 +1,82 @@
1
+ import { NativeHardwareBridgeError, toNativeHardwareBridgeError, } from './bridge';
2
+ function errorCodeFor(error, operation) {
3
+ if (error instanceof NativeHardwareBridgeError)
4
+ return error.code;
5
+ const name = error instanceof DOMException ? error.name : undefined;
6
+ if (name === 'NotSupportedError')
7
+ return 'unsupported';
8
+ if (name === 'NotAllowedError' || name === 'SecurityError') {
9
+ return 'permission_denied';
10
+ }
11
+ if (name === 'AbortError')
12
+ return 'aborted';
13
+ if (name === 'NotFoundError') {
14
+ return operation === 'request' ? 'cancelled' : 'unavailable';
15
+ }
16
+ if (name === 'InvalidStateError' ||
17
+ name === 'DataError' ||
18
+ error instanceof TypeError) {
19
+ return 'invalid_request';
20
+ }
21
+ if (name === 'NetworkError')
22
+ return 'unavailable';
23
+ return 'host_error';
24
+ }
25
+ export function deviceIoError(capability, operation, error) {
26
+ if (error instanceof NativeHardwareBridgeError)
27
+ return error;
28
+ const code = errorCodeFor(error, operation);
29
+ const cause = error instanceof DOMException ? error.name : undefined;
30
+ const fallbackMessage = `Unable to ${operation} ${capability} device.`;
31
+ return toNativeHardwareBridgeError({
32
+ code,
33
+ message: error instanceof Error && error.message
34
+ ? error.message
35
+ : fallbackMessage,
36
+ details: { capability, operation, ...(cause ? { cause } : {}) },
37
+ retryable: code === 'unavailable' ||
38
+ code === 'cancelled' ||
39
+ code === 'aborted' ||
40
+ code === 'host_error',
41
+ }, fallbackMessage);
42
+ }
43
+ export function unsupportedDeviceIoError(capability) {
44
+ return new NativeHardwareBridgeError({
45
+ code: 'unsupported',
46
+ message: `This runtime does not expose the Web ${capability.toUpperCase()} API.`,
47
+ details: { capability },
48
+ retryable: false,
49
+ });
50
+ }
51
+ export function abortedDeviceIoError(capability, operation) {
52
+ return new NativeHardwareBridgeError({
53
+ code: 'aborted',
54
+ message: `${capability.toUpperCase()} ${operation} was aborted.`,
55
+ details: { capability, operation },
56
+ retryable: true,
57
+ });
58
+ }
59
+ /**
60
+ * Rejects promptly when the caller aborts. The browser operation itself may
61
+ * continue when its underlying standard does not accept an AbortSignal.
62
+ */
63
+ export function awaitDeviceIoWithAbort(promise, capability, operation, signal) {
64
+ if (!signal)
65
+ return promise;
66
+ if (signal.aborted) {
67
+ return Promise.reject(abortedDeviceIoError(capability, operation));
68
+ }
69
+ return new Promise((resolve, reject) => {
70
+ const handleAbort = () => {
71
+ reject(abortedDeviceIoError(capability, operation));
72
+ };
73
+ signal.addEventListener('abort', handleAbort, { once: true });
74
+ promise.then((value) => {
75
+ signal.removeEventListener('abort', handleAbort);
76
+ resolve(value);
77
+ }, (error) => {
78
+ signal.removeEventListener('abort', handleAbort);
79
+ reject(error);
80
+ });
81
+ });
82
+ }
@@ -0,0 +1,38 @@
1
+ import type { NativeHardwareRequestEnvelope, NativeHardwareResultEnvelope } from './types';
2
+ export declare const NATIVE_DISPLAYS_REQUEST_TYPE: "moldable:native-displays";
3
+ export declare const NATIVE_DISPLAYS_RESULT_TYPE: "moldable:native-displays-result";
4
+ /** A position in physical screen pixels within the virtual desktop. */
5
+ export interface MoldableDisplayPosition {
6
+ x: number;
7
+ y: number;
8
+ }
9
+ /** A size in physical screen pixels. */
10
+ export interface MoldableDisplaySize {
11
+ width: number;
12
+ height: number;
13
+ }
14
+ /** Serializable display metadata. This API never returns screen pixels. */
15
+ export interface MoldableDisplay {
16
+ name: string | null;
17
+ position: MoldableDisplayPosition;
18
+ size: MoldableDisplaySize;
19
+ scaleFactor: number;
20
+ primary: boolean;
21
+ }
22
+ export interface MoldableDisplaysResult {
23
+ displays: MoldableDisplay[];
24
+ }
25
+ export type MoldableDisplaysRequest = NativeHardwareRequestEnvelope<typeof NATIVE_DISPLAYS_REQUEST_TYPE>;
26
+ export type MoldableDisplaysResultMessage = NativeHardwareResultEnvelope<typeof NATIVE_DISPLAYS_RESULT_TYPE, MoldableDisplaysResult>;
27
+ export interface GetMoldableDisplaysOptions {
28
+ timeoutMs?: number;
29
+ signal?: AbortSignal;
30
+ }
31
+ /**
32
+ * Query metadata for the displays attached to the native desktop host.
33
+ *
34
+ * This is intentionally a one-shot query. Display polling and change events are
35
+ * not exposed because monitor metadata can contribute to device fingerprinting.
36
+ */
37
+ export declare function getMoldableDisplays(options?: GetMoldableDisplaysOptions): Promise<MoldableDisplaysResult>;
38
+ //# sourceMappingURL=displays.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"displays.d.ts","sourceRoot":"","sources":["../../../src/lib/native-hardware/displays.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,4BAA4B,EAAG,0BAAmC,CAAA;AAC/E,eAAO,MAAM,2BAA2B,EACtC,iCAA0C,CAAA;AAE5C,uEAAuE;AACvE,MAAM,WAAW,uBAAuB;IACtC,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,QAAQ,EAAE,uBAAuB,CAAA;IACjC,IAAI,EAAE,mBAAmB,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,eAAe,EAAE,CAAA;CAC5B;AAED,MAAM,MAAM,uBAAuB,GAAG,6BAA6B,CACjE,OAAO,4BAA4B,CACpC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,4BAA4B,CACtE,OAAO,2BAA2B,EAClC,sBAAsB,CACvB,CAAA;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,sBAAsB,CAAC,CAMjC"}
@@ -0,0 +1,12 @@
1
+ import { callNativeHardwareBridge } from './bridge';
2
+ export const NATIVE_DISPLAYS_REQUEST_TYPE = 'moldable:native-displays';
3
+ export const NATIVE_DISPLAYS_RESULT_TYPE = 'moldable:native-displays-result';
4
+ /**
5
+ * Query metadata for the displays attached to the native desktop host.
6
+ *
7
+ * This is intentionally a one-shot query. Display polling and change events are
8
+ * not exposed because monitor metadata can contribute to device fingerprinting.
9
+ */
10
+ export function getMoldableDisplays(options = {}) {
11
+ return callNativeHardwareBridge({ type: NATIVE_DISPLAYS_REQUEST_TYPE }, NATIVE_DISPLAYS_RESULT_TYPE, options);
12
+ }