@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,266 @@
1
+ import { isNativeCapabilityManifest } from './capabilities';
2
+ import { NATIVE_CAPABILITIES_REQUEST_TYPE, NATIVE_CAPABILITIES_RESULT_TYPE, } from './types';
3
+ const DEFAULT_TIMEOUT_MS = 10_000;
4
+ export const NATIVE_CAPABILITY_CANCEL_REQUEST_TYPE = 'moldable:native-capabilities-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 NativeCapabilityBridgeError extends Error {
18
+ code;
19
+ details;
20
+ retryable;
21
+ constructor(error) {
22
+ super(error.message);
23
+ this.name = 'NativeCapabilityBridgeError';
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 isNativeCapabilityErrorPayload(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 toNativeCapabilityBridgeError(value, fallbackMessage = 'Native capability request failed.') {
39
+ if (value instanceof NativeCapabilityBridgeError)
40
+ return value;
41
+ if (isNativeCapabilityErrorPayload(value)) {
42
+ return new NativeCapabilityBridgeError(value);
43
+ }
44
+ return new NativeCapabilityBridgeError({
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-capabilities-${crypto.randomUUID()}`;
53
+ }
54
+ return `native-capabilities-${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 resolveNativeCapabilityParentOrigin(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 callNativeCapabilityBridge(request, responseType, options = {}) {
136
+ if (typeof window === 'undefined' || window.parent === window) {
137
+ return Promise.reject(new NativeCapabilityBridgeError({
138
+ code: 'not_in_moldable',
139
+ message: 'Native capability APIs are only available inside Moldable.',
140
+ retryable: false,
141
+ }));
142
+ }
143
+ const parentOrigin = resolveNativeCapabilityParentOrigin(document.referrer);
144
+ if (!parentOrigin) {
145
+ return Promise.reject(new NativeCapabilityBridgeError({
146
+ code: 'not_in_moldable',
147
+ message: 'The native capability bridge parent could not be verified.',
148
+ retryable: false,
149
+ }));
150
+ }
151
+ if (options.signal?.aborted) {
152
+ return Promise.reject(new NativeCapabilityBridgeError({
153
+ code: 'aborted',
154
+ message: 'Native capability 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_CAPABILITY_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 NativeCapabilityBridgeError(error));
187
+ };
188
+ const handleAbort = () => {
189
+ cancelHostRequest();
190
+ fail({
191
+ code: 'aborted',
192
+ message: 'Native capability 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
+ isNativeCapabilityErrorPayload(event.data.error)) {
217
+ fail(event.data.error);
218
+ return;
219
+ }
220
+ fail({
221
+ code: 'invalid_response',
222
+ message: 'Moldable returned an invalid native capability 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 capability 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 capability request.',
247
+ details: error,
248
+ retryable: true,
249
+ });
250
+ }
251
+ });
252
+ }
253
+ export async function getNativeCapabilities(options = {}) {
254
+ const manifest = await callNativeCapabilityBridge({ type: NATIVE_CAPABILITIES_REQUEST_TYPE }, NATIVE_CAPABILITIES_RESULT_TYPE, options);
255
+ if (!isNativeCapabilityManifest(manifest)) {
256
+ throw new NativeCapabilityBridgeError({
257
+ code: 'invalid_response',
258
+ message: 'Moldable returned an invalid native capability 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 = getNativeCapabilities;
@@ -0,0 +1,7 @@
1
+ import { type NativeCapabilityDescriptor, type NativeCapabilityId, type NativeCapabilityManifest } from './types';
2
+ export declare function isNativeCapabilityId(value: unknown): value is NativeCapabilityId;
3
+ export declare function isNativeCapabilityDescriptor(value: unknown, expectedId?: NativeCapabilityId): value is NativeCapabilityDescriptor;
4
+ export declare function isNativeCapabilityManifest(value: unknown): value is NativeCapabilityManifest;
5
+ export declare function getNativeCapability(manifest: NativeCapabilityManifest, id: NativeCapabilityId): NativeCapabilityDescriptor;
6
+ export declare function supportsNativeCapability(manifest: NativeCapabilityManifest, id: NativeCapabilityId): boolean;
7
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC9B,MAAM,SAAS,CAAA;AA+ChB,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,kBAAkB,CAE7B;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,EACd,UAAU,CAAC,EAAE,kBAAkB,GAC9B,KAAK,IAAI,0BAA0B,CA4BrC;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,wBAAwB,CAenC;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,wBAAwB,EAClC,EAAE,EAAE,kBAAkB,GACrB,0BAA0B,CAE5B;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,wBAAwB,EAClC,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAET"}
@@ -0,0 +1,95 @@
1
+ import { NATIVE_CAPABILITY_IDS, NATIVE_CAPABILITY_MANIFEST_SCHEMA_VERSION, } from './types';
2
+ const CAPABILITY_IDS = new Set(NATIVE_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 isNativeCapabilityId(value) {
46
+ return typeof value === 'string' && CAPABILITY_IDS.has(value);
47
+ }
48
+ export function isNativeCapabilityDescriptor(value, expectedId) {
49
+ if (!isRecord(value) || !isNativeCapabilityId(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 isNativeCapabilityManifest(value) {
77
+ if (!isRecord(value))
78
+ return false;
79
+ if (value.schemaVersion !== NATIVE_CAPABILITY_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_CAPABILITY_IDS.every((id) => isNativeCapabilityDescriptor(capabilities[id], id));
89
+ }
90
+ export function getNativeCapability(manifest, id) {
91
+ return manifest.capabilities[id];
92
+ }
93
+ export function supportsNativeCapability(manifest, id) {
94
+ return getNativeCapability(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-capabilities/clipboard.ts"],"names":[],"mappings":"AA2DA;;;GAGG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,CAAC,CASjE;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAS5E"}
@@ -0,0 +1,58 @@
1
+ import { requireMoldableNativeCapabilityAccess } from './access';
2
+ import { NativeCapabilityBridgeError, toNativeCapabilityBridgeError, } from './bridge';
3
+ function clipboardFor(capability, method) {
4
+ if (typeof navigator === 'undefined' ||
5
+ !navigator.clipboard ||
6
+ typeof navigator.clipboard[method] !== 'function') {
7
+ throw clipboardError(capability, new DOMException('Clipboard API unavailable', 'NotSupportedError'));
8
+ }
9
+ return navigator.clipboard;
10
+ }
11
+ function clipboardError(capability, error) {
12
+ if (error instanceof NativeCapabilityBridgeError)
13
+ return error;
14
+ const name = error instanceof DOMException ? error.name : undefined;
15
+ let code = 'host_error';
16
+ if (name === 'NotSupportedError')
17
+ code = 'unsupported';
18
+ else if (name === 'NotAllowedError' || name === 'SecurityError') {
19
+ code = 'permission_denied';
20
+ }
21
+ const fallbackMessage = `Unable to ${capability === 'clipboard-read' ? 'read' : 'write'} clipboard text`;
22
+ return toNativeCapabilityBridgeError({
23
+ code,
24
+ message: error instanceof Error
25
+ ? error.message || fallbackMessage
26
+ : fallbackMessage,
27
+ details: { capability, ...(name ? { cause: name } : {}) },
28
+ retryable: false,
29
+ }, fallbackMessage);
30
+ }
31
+ /**
32
+ * Reads plain text from the clipboard. Browsers generally require a secure context,
33
+ * clipboard permission, and a recent user gesture for reads.
34
+ */
35
+ export async function readMoldableClipboardText() {
36
+ const capability = 'clipboard-read';
37
+ try {
38
+ await requireMoldableNativeCapabilityAccess(capability);
39
+ return await clipboardFor(capability, 'readText').readText();
40
+ }
41
+ catch (error) {
42
+ throw clipboardError(capability, error);
43
+ }
44
+ }
45
+ /**
46
+ * Writes plain text to the clipboard. Browsers require a secure context and may
47
+ * require this call to run directly in response to a user gesture.
48
+ */
49
+ export async function writeMoldableClipboardText(text) {
50
+ const capability = 'clipboard-write';
51
+ try {
52
+ await requireMoldableNativeCapabilityAccess(capability);
53
+ await clipboardFor(capability, 'writeText').writeText(text);
54
+ }
55
+ catch (error) {
56
+ throw clipboardError(capability, error);
57
+ }
58
+ }
@@ -0,0 +1,11 @@
1
+ import { NativeCapabilityBridgeError } 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): NativeCapabilityBridgeError;
4
+ export declare function unsupportedDeviceIoError(capability: 'usb' | 'hid' | 'serial'): NativeCapabilityBridgeError;
5
+ export declare function abortedDeviceIoError(capability: 'usb' | 'hid' | 'serial', operation: DeviceIoOperation): NativeCapabilityBridgeError;
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-capabilities/device-io-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAE5B,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,2BAA2B,CAuB7B;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,GACnC,2BAA2B,CAO7B;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,EACpC,SAAS,EAAE,iBAAiB,GAC3B,2BAA2B,CAO7B;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 { NativeCapabilityBridgeError, toNativeCapabilityBridgeError, } from './bridge';
2
+ function errorCodeFor(error, operation) {
3
+ if (error instanceof NativeCapabilityBridgeError)
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 NativeCapabilityBridgeError)
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 toNativeCapabilityBridgeError({
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 NativeCapabilityBridgeError({
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 NativeCapabilityBridgeError({
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 { NativeCapabilityRequestEnvelope, NativeCapabilityResultEnvelope } 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 = NativeCapabilityRequestEnvelope<typeof NATIVE_DISPLAYS_REQUEST_TYPE>;
26
+ export type MoldableDisplaysResultMessage = NativeCapabilityResultEnvelope<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-capabilities/displays.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,+BAA+B,EAC/B,8BAA8B,EAC/B,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,+BAA+B,CACnE,OAAO,4BAA4B,CACpC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,8BAA8B,CACxE,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 { callNativeCapabilityBridge } 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 callNativeCapabilityBridge({ type: NATIVE_DISPLAYS_REQUEST_TYPE }, NATIVE_DISPLAYS_RESULT_TYPE, options);
12
+ }