@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.
- package/dist/catalog/catalog-manifest.d.ts +6 -0
- package/dist/catalog/catalog-manifest.d.ts.map +1 -0
- package/dist/catalog/catalog-manifest.js +105 -0
- package/dist/catalog/catalog-types.d.ts +54 -0
- package/dist/catalog/catalog-types.d.ts.map +1 -0
- package/dist/catalog/catalog-types.js +14 -0
- package/dist/catalog/component-catalog.d.ts +14 -0
- package/dist/catalog/component-catalog.d.ts.map +1 -0
- package/dist/catalog/component-catalog.js +39 -0
- package/dist/catalog/core-catalog.d.ts +6 -0
- package/dist/catalog/core-catalog.d.ts.map +1 -0
- package/dist/catalog/core-catalog.js +105 -0
- package/dist/catalog/index.d.ts +5 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +4 -0
- package/dist/components/app-error-boundary.d.ts +1 -0
- package/dist/components/app-error-boundary.d.ts.map +1 -1
- package/dist/components/app-error-boundary.js +13 -0
- package/dist/components/chat/chat-image-lightbox.d.ts +9 -0
- package/dist/components/chat/chat-image-lightbox.d.ts.map +1 -0
- package/dist/components/chat/chat-image-lightbox.js +9 -0
- package/dist/components/chat/chat-message.d.ts +19 -1
- package/dist/components/chat/chat-message.d.ts.map +1 -1
- package/dist/components/chat/chat-message.js +66 -16
- package/dist/components/chat/chat-messages.d.ts +5 -2
- package/dist/components/chat/chat-messages.d.ts.map +1 -1
- package/dist/components/chat/chat-messages.js +61 -6
- package/dist/components/chat/chat-panel.d.ts +67 -17
- package/dist/components/chat/chat-panel.d.ts.map +1 -1
- package/dist/components/chat/chat-panel.js +250 -159
- package/dist/components/chat/conversation-history.d.ts +39 -5
- package/dist/components/chat/conversation-history.d.ts.map +1 -1
- package/dist/components/chat/conversation-history.js +192 -26
- package/dist/components/chat/index.d.ts +3 -2
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +3 -2
- package/dist/components/chat/model-effort-power-effects.d.ts +7 -0
- package/dist/components/chat/model-effort-power-effects.d.ts.map +1 -0
- package/dist/components/chat/model-effort-power-effects.js +54 -0
- package/dist/components/chat/model-effort-selector.d.ts +26 -0
- package/dist/components/chat/model-effort-selector.d.ts.map +1 -0
- package/dist/components/chat/model-effort-selector.js +179 -0
- package/dist/components/chat/model-effort-ultra-effects.d.ts +5 -0
- package/dist/components/chat/model-effort-ultra-effects.d.ts.map +1 -0
- package/dist/components/chat/model-effort-ultra-effects.js +56 -0
- package/dist/components/chat/tool-handlers.d.ts.map +1 -1
- package/dist/components/chat/tool-handlers.js +40 -2
- package/dist/components/chat/vertical-scroll-fade.d.ts +6 -0
- package/dist/components/chat/vertical-scroll-fade.d.ts.map +1 -0
- package/dist/components/chat/vertical-scroll-fade.js +12 -0
- package/dist/components/hardware/bluetooth-panel-helpers.d.ts +9 -0
- package/dist/components/hardware/bluetooth-panel-helpers.d.ts.map +1 -0
- package/dist/components/hardware/bluetooth-panel-helpers.js +37 -0
- package/dist/components/hardware/bluetooth-panel.d.ts +56 -0
- package/dist/components/hardware/bluetooth-panel.d.ts.map +1 -0
- package/dist/components/hardware/bluetooth-panel.js +470 -0
- package/dist/components/hardware/camera-preview.d.ts +39 -0
- package/dist/components/hardware/camera-preview.d.ts.map +1 -0
- package/dist/components/hardware/camera-preview.js +228 -0
- package/dist/components/hardware/capability-badge.d.ts +23 -0
- package/dist/components/hardware/capability-badge.d.ts.map +1 -0
- package/dist/components/hardware/capability-badge.js +39 -0
- package/dist/components/hardware/capability-matrix.d.ts +14 -0
- package/dist/components/hardware/capability-matrix.d.ts.map +1 -0
- package/dist/components/hardware/capability-matrix.js +97 -0
- package/dist/components/hardware/clipboard-button.d.ts +26 -0
- package/dist/components/hardware/clipboard-button.d.ts.map +1 -0
- package/dist/components/hardware/clipboard-button.js +114 -0
- package/dist/components/hardware/device-io-controls.d.ts +4 -0
- package/dist/components/hardware/device-io-controls.d.ts.map +1 -0
- package/dist/components/hardware/device-io-controls.js +28 -0
- package/dist/components/hardware/device-list.d.ts +20 -0
- package/dist/components/hardware/device-list.d.ts.map +1 -0
- package/dist/components/hardware/device-list.js +14 -0
- package/dist/components/hardware/display-map.d.ts +23 -0
- package/dist/components/hardware/display-map.d.ts.map +1 -0
- package/dist/components/hardware/display-map.js +114 -0
- package/dist/components/hardware/haptic-button.d.ts +26 -0
- package/dist/components/hardware/haptic-button.d.ts.map +1 -0
- package/dist/components/hardware/haptic-button.js +94 -0
- package/dist/components/hardware/hardware-panel.d.ts +11 -0
- package/dist/components/hardware/hardware-panel.d.ts.map +1 -0
- package/dist/components/hardware/hardware-panel.js +28 -0
- package/dist/components/hardware/hid-panel.d.ts +40 -0
- package/dist/components/hardware/hid-panel.d.ts.map +1 -0
- package/dist/components/hardware/hid-panel.js +373 -0
- package/dist/components/hardware/index.d.ts +27 -0
- package/dist/components/hardware/index.d.ts.map +1 -0
- package/dist/components/hardware/index.js +26 -0
- package/dist/components/hardware/live-indicator.d.ts +15 -0
- package/dist/components/hardware/live-indicator.d.ts.map +1 -0
- package/dist/components/hardware/live-indicator.js +26 -0
- package/dist/components/hardware/local-auth-button.d.ts +33 -0
- package/dist/components/hardware/local-auth-button.d.ts.map +1 -0
- package/dist/components/hardware/local-auth-button.js +115 -0
- package/dist/components/hardware/location-panel.d.ts +29 -0
- package/dist/components/hardware/location-panel.d.ts.map +1 -0
- package/dist/components/hardware/location-panel.js +154 -0
- package/dist/components/hardware/microphone-meter.d.ts +35 -0
- package/dist/components/hardware/microphone-meter.d.ts.map +1 -0
- package/dist/components/hardware/microphone-meter.js +244 -0
- package/dist/components/hardware/midi-monitor.d.ts +54 -0
- package/dist/components/hardware/midi-monitor.d.ts.map +1 -0
- package/dist/components/hardware/midi-monitor.js +534 -0
- package/dist/components/hardware/notification-panel.d.ts +24 -0
- package/dist/components/hardware/notification-panel.d.ts.map +1 -0
- package/dist/components/hardware/notification-panel.js +124 -0
- package/dist/components/hardware/power-blocker-controller.d.ts +19 -0
- package/dist/components/hardware/power-blocker-controller.d.ts.map +1 -0
- package/dist/components/hardware/power-blocker-controller.js +83 -0
- package/dist/components/hardware/power-panel.d.ts +67 -0
- package/dist/components/hardware/power-panel.d.ts.map +1 -0
- package/dist/components/hardware/power-panel.js +309 -0
- package/dist/components/hardware/readout.d.ts +10 -0
- package/dist/components/hardware/readout.d.ts.map +1 -0
- package/dist/components/hardware/readout.js +11 -0
- package/dist/components/hardware/screen-share-preview.d.ts +36 -0
- package/dist/components/hardware/screen-share-preview.d.ts.map +1 -0
- package/dist/components/hardware/screen-share-preview.js +191 -0
- package/dist/components/hardware/secure-storage-panel.d.ts +36 -0
- package/dist/components/hardware/secure-storage-panel.d.ts.map +1 -0
- package/dist/components/hardware/secure-storage-panel.js +193 -0
- package/dist/components/hardware/serial-console.d.ts +64 -0
- package/dist/components/hardware/serial-console.d.ts.map +1 -0
- package/dist/components/hardware/serial-console.js +399 -0
- package/dist/components/hardware/shortcut-recorder.d.ts +35 -0
- package/dist/components/hardware/shortcut-recorder.d.ts.map +1 -0
- package/dist/components/hardware/shortcut-recorder.js +217 -0
- package/dist/components/hardware/stream-log.d.ts +35 -0
- package/dist/components/hardware/stream-log.d.ts.map +1 -0
- package/dist/components/hardware/stream-log.js +65 -0
- package/dist/components/hardware/system-audio-monitor.d.ts +34 -0
- package/dist/components/hardware/system-audio-monitor.d.ts.map +1 -0
- package/dist/components/hardware/system-audio-monitor.js +275 -0
- package/dist/components/hardware/usb-panel.d.ts +54 -0
- package/dist/components/hardware/usb-panel.d.ts.map +1 -0
- package/dist/components/hardware/usb-panel.js +363 -0
- package/dist/components/hardware/use-capability.d.ts +20 -0
- package/dist/components/hardware/use-capability.d.ts.map +1 -0
- package/dist/components/hardware/use-capability.js +61 -0
- package/dist/components/native-capabilities/bluetooth-panel-helpers.d.ts +9 -0
- package/dist/components/native-capabilities/bluetooth-panel-helpers.d.ts.map +1 -0
- package/dist/components/native-capabilities/bluetooth-panel-helpers.js +37 -0
- package/dist/components/native-capabilities/bluetooth-panel.d.ts +56 -0
- package/dist/components/native-capabilities/bluetooth-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/bluetooth-panel.js +470 -0
- package/dist/components/native-capabilities/camera-preview.d.ts +39 -0
- package/dist/components/native-capabilities/camera-preview.d.ts.map +1 -0
- package/dist/components/native-capabilities/camera-preview.js +228 -0
- package/dist/components/native-capabilities/capability-badge.d.ts +23 -0
- package/dist/components/native-capabilities/capability-badge.d.ts.map +1 -0
- package/dist/components/native-capabilities/capability-badge.js +39 -0
- package/dist/components/native-capabilities/capability-matrix.d.ts +14 -0
- package/dist/components/native-capabilities/capability-matrix.d.ts.map +1 -0
- package/dist/components/native-capabilities/capability-matrix.js +97 -0
- package/dist/components/native-capabilities/clipboard-button.d.ts +26 -0
- package/dist/components/native-capabilities/clipboard-button.d.ts.map +1 -0
- package/dist/components/native-capabilities/clipboard-button.js +99 -0
- package/dist/components/native-capabilities/device-io-controls.d.ts +4 -0
- package/dist/components/native-capabilities/device-io-controls.d.ts.map +1 -0
- package/dist/components/native-capabilities/device-io-controls.js +28 -0
- package/dist/components/native-capabilities/device-list.d.ts +20 -0
- package/dist/components/native-capabilities/device-list.d.ts.map +1 -0
- package/dist/components/native-capabilities/device-list.js +14 -0
- package/dist/components/native-capabilities/display-map.d.ts +23 -0
- package/dist/components/native-capabilities/display-map.d.ts.map +1 -0
- package/dist/components/native-capabilities/display-map.js +114 -0
- package/dist/components/native-capabilities/haptic-button.d.ts +26 -0
- package/dist/components/native-capabilities/haptic-button.d.ts.map +1 -0
- package/dist/components/native-capabilities/haptic-button.js +94 -0
- package/dist/components/native-capabilities/hid-panel.d.ts +40 -0
- package/dist/components/native-capabilities/hid-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/hid-panel.js +373 -0
- package/dist/components/native-capabilities/index.d.ts +27 -0
- package/dist/components/native-capabilities/index.d.ts.map +1 -0
- package/dist/components/native-capabilities/index.js +26 -0
- package/dist/components/native-capabilities/live-indicator.d.ts +15 -0
- package/dist/components/native-capabilities/live-indicator.d.ts.map +1 -0
- package/dist/components/native-capabilities/live-indicator.js +26 -0
- package/dist/components/native-capabilities/local-auth-button.d.ts +33 -0
- package/dist/components/native-capabilities/local-auth-button.d.ts.map +1 -0
- package/dist/components/native-capabilities/local-auth-button.js +115 -0
- package/dist/components/native-capabilities/location-panel.d.ts +29 -0
- package/dist/components/native-capabilities/location-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/location-panel.js +146 -0
- package/dist/components/native-capabilities/microphone-meter.d.ts +35 -0
- package/dist/components/native-capabilities/microphone-meter.d.ts.map +1 -0
- package/dist/components/native-capabilities/microphone-meter.js +244 -0
- package/dist/components/native-capabilities/midi-monitor.d.ts +54 -0
- package/dist/components/native-capabilities/midi-monitor.d.ts.map +1 -0
- package/dist/components/native-capabilities/midi-monitor.js +534 -0
- package/dist/components/native-capabilities/native-capability-panel.d.ts +11 -0
- package/dist/components/native-capabilities/native-capability-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/native-capability-panel.js +28 -0
- package/dist/components/native-capabilities/notification-panel.d.ts +24 -0
- package/dist/components/native-capabilities/notification-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/notification-panel.js +124 -0
- package/dist/components/native-capabilities/power-blocker-controller.d.ts +19 -0
- package/dist/components/native-capabilities/power-blocker-controller.d.ts.map +1 -0
- package/dist/components/native-capabilities/power-blocker-controller.js +83 -0
- package/dist/components/native-capabilities/power-panel.d.ts +67 -0
- package/dist/components/native-capabilities/power-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/power-panel.js +309 -0
- package/dist/components/native-capabilities/readout.d.ts +10 -0
- package/dist/components/native-capabilities/readout.d.ts.map +1 -0
- package/dist/components/native-capabilities/readout.js +11 -0
- package/dist/components/native-capabilities/screen-share-preview.d.ts +36 -0
- package/dist/components/native-capabilities/screen-share-preview.d.ts.map +1 -0
- package/dist/components/native-capabilities/screen-share-preview.js +191 -0
- package/dist/components/native-capabilities/secure-storage-panel.d.ts +36 -0
- package/dist/components/native-capabilities/secure-storage-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/secure-storage-panel.js +193 -0
- package/dist/components/native-capabilities/serial-console.d.ts +64 -0
- package/dist/components/native-capabilities/serial-console.d.ts.map +1 -0
- package/dist/components/native-capabilities/serial-console.js +399 -0
- package/dist/components/native-capabilities/shortcut-recorder.d.ts +35 -0
- package/dist/components/native-capabilities/shortcut-recorder.d.ts.map +1 -0
- package/dist/components/native-capabilities/shortcut-recorder.js +217 -0
- package/dist/components/native-capabilities/stream-log.d.ts +35 -0
- package/dist/components/native-capabilities/stream-log.d.ts.map +1 -0
- package/dist/components/native-capabilities/stream-log.js +65 -0
- package/dist/components/native-capabilities/system-audio-monitor.d.ts +34 -0
- package/dist/components/native-capabilities/system-audio-monitor.d.ts.map +1 -0
- package/dist/components/native-capabilities/system-audio-monitor.js +275 -0
- package/dist/components/native-capabilities/usb-panel.d.ts +54 -0
- package/dist/components/native-capabilities/usb-panel.d.ts.map +1 -0
- package/dist/components/native-capabilities/usb-panel.js +363 -0
- package/dist/components/native-capabilities/use-capability.d.ts +20 -0
- package/dist/components/native-capabilities/use-capability.d.ts.map +1 -0
- package/dist/components/native-capabilities/use-capability.js +61 -0
- package/dist/components/ui/app-frame.d.ts +22 -0
- package/dist/components/ui/app-frame.d.ts.map +1 -0
- package/dist/components/ui/app-frame.js +56 -0
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/color-well.d.ts +13 -0
- package/dist/components/ui/color-well.d.ts.map +1 -0
- package/dist/components/ui/color-well.js +30 -0
- package/dist/components/ui/date-field.d.ts +19 -0
- package/dist/components/ui/date-field.d.ts.map +1 -0
- package/dist/components/ui/date-field.js +54 -0
- package/dist/components/ui/edge-fade.d.ts +11 -0
- package/dist/components/ui/edge-fade.d.ts.map +1 -0
- package/dist/components/ui/edge-fade.js +41 -0
- package/dist/components/ui/empty.js +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/grid.d.ts +24 -0
- package/dist/components/ui/grid.d.ts.map +1 -0
- package/dist/components/ui/grid.js +234 -0
- package/dist/components/ui/icon-button.d.ts +15 -0
- package/dist/components/ui/icon-button.d.ts.map +1 -0
- package/dist/components/ui/icon-button.js +15 -0
- package/dist/components/ui/index.d.ts +19 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +19 -0
- package/dist/components/ui/inspector.d.ts +15 -0
- package/dist/components/ui/inspector.d.ts.map +1 -0
- package/dist/components/ui/inspector.js +26 -0
- package/dist/components/ui/kbd.d.ts +1 -1
- package/dist/components/ui/list.d.ts +24 -0
- package/dist/components/ui/list.d.ts.map +1 -0
- package/dist/components/ui/list.js +224 -0
- package/dist/components/ui/message-scroller-layout-stability.d.ts +33 -0
- package/dist/components/ui/message-scroller-layout-stability.d.ts.map +1 -0
- package/dist/components/ui/message-scroller-layout-stability.js +153 -0
- package/dist/components/ui/message-scroller.d.ts +11 -0
- package/dist/components/ui/message-scroller.d.ts.map +1 -0
- package/dist/components/ui/message-scroller.js +37 -0
- package/dist/components/ui/notification-dot.d.ts +4 -0
- package/dist/components/ui/notification-dot.d.ts.map +1 -0
- package/dist/components/ui/notification-dot.js +7 -0
- package/dist/components/ui/number-input.d.ts +16 -0
- package/dist/components/ui/number-input.d.ts.map +1 -0
- package/dist/components/ui/number-input.js +56 -0
- package/dist/components/ui/panel.d.ts +18 -0
- package/dist/components/ui/panel.d.ts.map +1 -0
- package/dist/components/ui/panel.js +40 -0
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/search-field.d.ts +19 -0
- package/dist/components/ui/search-field.d.ts.map +1 -0
- package/dist/components/ui/search-field.js +64 -0
- package/dist/components/ui/segmented-control.d.ts +21 -0
- package/dist/components/ui/segmented-control.d.ts.map +1 -0
- package/dist/components/ui/segmented-control.js +61 -0
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/slider.d.ts +4 -1
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/slider.js +2 -2
- package/dist/components/ui/sonner.d.ts +4 -3
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/sonner.js +7 -6
- package/dist/components/ui/split-view.d.ts +11 -0
- package/dist/components/ui/split-view.d.ts.map +1 -0
- package/dist/components/ui/split-view.js +13 -0
- package/dist/components/ui/status.d.ts +13 -0
- package/dist/components/ui/status.d.ts.map +1 -0
- package/dist/components/ui/status.js +36 -0
- package/dist/components/ui/table.d.ts +11 -2
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +28 -6
- package/dist/components/ui/text.d.ts +17 -0
- package/dist/components/ui/text.d.ts.map +1 -0
- package/dist/components/ui/text.js +55 -0
- package/dist/components/ui/toggle.js +1 -1
- package/dist/components/ui/toolbar.d.ts +20 -0
- package/dist/components/ui/toolbar.d.ts.map +1 -0
- package/dist/components/ui/toolbar.js +52 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/lib/frame-lifecycle.d.ts +28 -0
- package/dist/lib/frame-lifecycle.d.ts.map +1 -1
- package/dist/lib/frame-lifecycle.js +84 -0
- package/dist/lib/native-capabilities/access.d.ts +13 -0
- package/dist/lib/native-capabilities/access.d.ts.map +1 -0
- package/dist/lib/native-capabilities/access.js +53 -0
- package/dist/lib/native-capabilities/bluetooth-access.d.ts +14 -0
- package/dist/lib/native-capabilities/bluetooth-access.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-access.js +43 -0
- package/dist/lib/native-capabilities/bluetooth-connection.d.ts +19 -0
- package/dist/lib/native-capabilities/bluetooth-connection.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-connection.js +88 -0
- package/dist/lib/native-capabilities/bluetooth-gatt.d.ts +7 -0
- package/dist/lib/native-capabilities/bluetooth-gatt.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-gatt.js +77 -0
- package/dist/lib/native-capabilities/bluetooth-internal.d.ts +10 -0
- package/dist/lib/native-capabilities/bluetooth-internal.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-internal.js +105 -0
- package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts +33 -0
- package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-native-fallback.js +214 -0
- package/dist/lib/native-capabilities/bluetooth-types.d.ts +85 -0
- package/dist/lib/native-capabilities/bluetooth-types.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth-types.js +2 -0
- package/dist/lib/native-capabilities/bluetooth.d.ts +7 -0
- package/dist/lib/native-capabilities/bluetooth.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bluetooth.js +4 -0
- package/dist/lib/native-capabilities/bridge.d.ts +23 -0
- package/dist/lib/native-capabilities/bridge.d.ts.map +1 -0
- package/dist/lib/native-capabilities/bridge.js +266 -0
- package/dist/lib/native-capabilities/capabilities.d.ts +7 -0
- package/dist/lib/native-capabilities/capabilities.d.ts.map +1 -0
- package/dist/lib/native-capabilities/capabilities.js +95 -0
- package/dist/lib/native-capabilities/clipboard.d.ts +11 -0
- package/dist/lib/native-capabilities/clipboard.d.ts.map +1 -0
- package/dist/lib/native-capabilities/clipboard.js +58 -0
- package/dist/lib/native-capabilities/device-io-errors.d.ts +11 -0
- package/dist/lib/native-capabilities/device-io-errors.d.ts.map +1 -0
- package/dist/lib/native-capabilities/device-io-errors.js +82 -0
- package/dist/lib/native-capabilities/displays.d.ts +38 -0
- package/dist/lib/native-capabilities/displays.d.ts.map +1 -0
- package/dist/lib/native-capabilities/displays.js +12 -0
- package/dist/lib/native-capabilities/global-shortcuts.d.ts +86 -0
- package/dist/lib/native-capabilities/global-shortcuts.d.ts.map +1 -0
- package/dist/lib/native-capabilities/global-shortcuts.js +351 -0
- package/dist/lib/native-capabilities/haptics.d.ts +25 -0
- package/dist/lib/native-capabilities/haptics.d.ts.map +1 -0
- package/dist/lib/native-capabilities/haptics.js +18 -0
- package/dist/lib/native-capabilities/hid-native.d.ts +26 -0
- package/dist/lib/native-capabilities/hid-native.d.ts.map +1 -0
- package/dist/lib/native-capabilities/hid-native.js +229 -0
- package/dist/lib/native-capabilities/hid.d.ts +52 -0
- package/dist/lib/native-capabilities/hid.d.ts.map +1 -0
- package/dist/lib/native-capabilities/hid.js +163 -0
- package/dist/lib/native-capabilities/index.d.ts +40 -0
- package/dist/lib/native-capabilities/index.d.ts.map +1 -0
- package/dist/lib/native-capabilities/index.js +21 -0
- package/dist/lib/native-capabilities/local-authentication.d.ts +32 -0
- package/dist/lib/native-capabilities/local-authentication.d.ts.map +1 -0
- package/dist/lib/native-capabilities/local-authentication.js +46 -0
- package/dist/lib/native-capabilities/location.d.ts +49 -0
- package/dist/lib/native-capabilities/location.d.ts.map +1 -0
- package/dist/lib/native-capabilities/location.js +114 -0
- package/dist/lib/native-capabilities/media-permissions.d.ts +28 -0
- package/dist/lib/native-capabilities/media-permissions.d.ts.map +1 -0
- package/dist/lib/native-capabilities/media-permissions.js +37 -0
- package/dist/lib/native-capabilities/media.d.ts +17 -0
- package/dist/lib/native-capabilities/media.d.ts.map +1 -0
- package/dist/lib/native-capabilities/media.js +104 -0
- package/dist/lib/native-capabilities/midi-access.d.ts +13 -0
- package/dist/lib/native-capabilities/midi-access.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi-access.js +68 -0
- package/dist/lib/native-capabilities/midi-internal.d.ts +12 -0
- package/dist/lib/native-capabilities/midi-internal.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi-internal.js +88 -0
- package/dist/lib/native-capabilities/midi-native-fallback.d.ts +27 -0
- package/dist/lib/native-capabilities/midi-native-fallback.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi-native-fallback.js +127 -0
- package/dist/lib/native-capabilities/midi-ports.d.ts +6 -0
- package/dist/lib/native-capabilities/midi-ports.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi-ports.js +115 -0
- package/dist/lib/native-capabilities/midi-types.d.ts +25 -0
- package/dist/lib/native-capabilities/midi-types.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi-types.js +1 -0
- package/dist/lib/native-capabilities/midi.d.ts +6 -0
- package/dist/lib/native-capabilities/midi.d.ts.map +1 -0
- package/dist/lib/native-capabilities/midi.js +3 -0
- package/dist/lib/native-capabilities/native-device-io.d.ts +28 -0
- package/dist/lib/native-capabilities/native-device-io.d.ts.map +1 -0
- package/dist/lib/native-capabilities/native-device-io.js +91 -0
- package/dist/lib/native-capabilities/native-device-lifecycle.d.ts +13 -0
- package/dist/lib/native-capabilities/native-device-lifecycle.d.ts.map +1 -0
- package/dist/lib/native-capabilities/native-device-lifecycle.js +40 -0
- package/dist/lib/native-capabilities/notifications.d.ts +38 -0
- package/dist/lib/native-capabilities/notifications.d.ts.map +1 -0
- package/dist/lib/native-capabilities/notifications.js +50 -0
- package/dist/lib/native-capabilities/power-session.d.ts +113 -0
- package/dist/lib/native-capabilities/power-session.d.ts.map +1 -0
- package/dist/lib/native-capabilities/power-session.js +264 -0
- package/dist/lib/native-capabilities/secure-storage.d.ts +36 -0
- package/dist/lib/native-capabilities/secure-storage.d.ts.map +1 -0
- package/dist/lib/native-capabilities/secure-storage.js +64 -0
- package/dist/lib/native-capabilities/serial-native.d.ts +23 -0
- package/dist/lib/native-capabilities/serial-native.d.ts.map +1 -0
- package/dist/lib/native-capabilities/serial-native.js +181 -0
- package/dist/lib/native-capabilities/serial.d.ts +76 -0
- package/dist/lib/native-capabilities/serial.d.ts.map +1 -0
- package/dist/lib/native-capabilities/serial.js +215 -0
- package/dist/lib/native-capabilities/system-audio.d.ts +127 -0
- package/dist/lib/native-capabilities/system-audio.d.ts.map +1 -0
- package/dist/lib/native-capabilities/system-audio.js +330 -0
- package/dist/lib/native-capabilities/types.d.ts +62 -0
- package/dist/lib/native-capabilities/types.d.ts.map +1 -0
- package/dist/lib/native-capabilities/types.js +27 -0
- package/dist/lib/native-capabilities/usb-native.d.ts +39 -0
- package/dist/lib/native-capabilities/usb-native.d.ts.map +1 -0
- package/dist/lib/native-capabilities/usb-native.js +217 -0
- package/dist/lib/native-capabilities/usb.d.ts +85 -0
- package/dist/lib/native-capabilities/usb.d.ts.map +1 -0
- package/dist/lib/native-capabilities/usb.js +225 -0
- package/dist/lib/native-hardware/bluetooth-access.d.ts +14 -0
- package/dist/lib/native-hardware/bluetooth-access.d.ts.map +1 -0
- package/dist/lib/native-hardware/bluetooth-access.js +40 -0
- package/dist/lib/native-hardware/bluetooth-connection.d.ts +19 -0
- package/dist/lib/native-hardware/bluetooth-connection.d.ts.map +1 -0
- package/dist/lib/native-hardware/bluetooth-connection.js +88 -0
- package/dist/lib/native-hardware/bluetooth-gatt.d.ts +7 -0
- package/dist/lib/native-hardware/bluetooth-gatt.d.ts.map +1 -0
- package/dist/lib/native-hardware/bluetooth-gatt.js +77 -0
- package/dist/lib/native-hardware/bluetooth-internal.d.ts +10 -0
- package/dist/lib/native-hardware/bluetooth-internal.d.ts.map +1 -0
- package/dist/lib/native-hardware/bluetooth-internal.js +105 -0
- package/dist/lib/native-hardware/bluetooth-native-fallback.d.ts +33 -0
- package/dist/lib/native-hardware/bluetooth-native-fallback.d.ts.map +1 -0
- package/dist/lib/native-hardware/bluetooth-native-fallback.js +214 -0
- package/dist/lib/native-hardware/bluetooth-types.d.ts +85 -0
- package/dist/lib/native-hardware/bluetooth-types.d.ts.map +1 -0
- package/dist/lib/native-hardware/bluetooth-types.js +2 -0
- package/dist/lib/native-hardware/bluetooth.d.ts +7 -0
- package/dist/lib/native-hardware/bluetooth.d.ts.map +1 -0
- package/dist/lib/native-hardware/bluetooth.js +4 -0
- package/dist/lib/native-hardware/bridge.d.ts +23 -0
- package/dist/lib/native-hardware/bridge.d.ts.map +1 -0
- package/dist/lib/native-hardware/bridge.js +266 -0
- package/dist/lib/native-hardware/capabilities.d.ts +7 -0
- package/dist/lib/native-hardware/capabilities.d.ts.map +1 -0
- package/dist/lib/native-hardware/capabilities.js +95 -0
- package/dist/lib/native-hardware/clipboard.d.ts +11 -0
- package/dist/lib/native-hardware/clipboard.d.ts.map +1 -0
- package/dist/lib/native-hardware/clipboard.js +55 -0
- package/dist/lib/native-hardware/device-io-errors.d.ts +11 -0
- package/dist/lib/native-hardware/device-io-errors.d.ts.map +1 -0
- package/dist/lib/native-hardware/device-io-errors.js +82 -0
- package/dist/lib/native-hardware/displays.d.ts +38 -0
- package/dist/lib/native-hardware/displays.d.ts.map +1 -0
- package/dist/lib/native-hardware/displays.js +12 -0
- package/dist/lib/native-hardware/global-shortcuts.d.ts +86 -0
- package/dist/lib/native-hardware/global-shortcuts.d.ts.map +1 -0
- package/dist/lib/native-hardware/global-shortcuts.js +351 -0
- package/dist/lib/native-hardware/haptics.d.ts +25 -0
- package/dist/lib/native-hardware/haptics.d.ts.map +1 -0
- package/dist/lib/native-hardware/haptics.js +18 -0
- package/dist/lib/native-hardware/hid-native.d.ts +26 -0
- package/dist/lib/native-hardware/hid-native.d.ts.map +1 -0
- package/dist/lib/native-hardware/hid-native.js +229 -0
- package/dist/lib/native-hardware/hid.d.ts +52 -0
- package/dist/lib/native-hardware/hid.d.ts.map +1 -0
- package/dist/lib/native-hardware/hid.js +160 -0
- package/dist/lib/native-hardware/index.d.ts +38 -0
- package/dist/lib/native-hardware/index.d.ts.map +1 -0
- package/dist/lib/native-hardware/index.js +20 -0
- package/dist/lib/native-hardware/local-authentication.d.ts +32 -0
- package/dist/lib/native-hardware/local-authentication.d.ts.map +1 -0
- package/dist/lib/native-hardware/local-authentication.js +46 -0
- package/dist/lib/native-hardware/location.d.ts +49 -0
- package/dist/lib/native-hardware/location.d.ts.map +1 -0
- package/dist/lib/native-hardware/location.js +114 -0
- package/dist/lib/native-hardware/media-permissions.d.ts +28 -0
- package/dist/lib/native-hardware/media-permissions.d.ts.map +1 -0
- package/dist/lib/native-hardware/media-permissions.js +37 -0
- package/dist/lib/native-hardware/media.d.ts +17 -0
- package/dist/lib/native-hardware/media.d.ts.map +1 -0
- package/dist/lib/native-hardware/media.js +99 -0
- package/dist/lib/native-hardware/midi-access.d.ts +13 -0
- package/dist/lib/native-hardware/midi-access.d.ts.map +1 -0
- package/dist/lib/native-hardware/midi-access.js +66 -0
- package/dist/lib/native-hardware/midi-internal.d.ts +12 -0
- package/dist/lib/native-hardware/midi-internal.d.ts.map +1 -0
- package/dist/lib/native-hardware/midi-internal.js +88 -0
- package/dist/lib/native-hardware/midi-native-fallback.d.ts +27 -0
- package/dist/lib/native-hardware/midi-native-fallback.d.ts.map +1 -0
- package/dist/lib/native-hardware/midi-native-fallback.js +127 -0
- package/dist/lib/native-hardware/midi-ports.d.ts +6 -0
- package/dist/lib/native-hardware/midi-ports.d.ts.map +1 -0
- package/dist/lib/native-hardware/midi-ports.js +115 -0
- package/dist/lib/native-hardware/midi-types.d.ts +25 -0
- package/dist/lib/native-hardware/midi-types.d.ts.map +1 -0
- package/dist/lib/native-hardware/midi-types.js +1 -0
- package/dist/lib/native-hardware/midi.d.ts +6 -0
- package/dist/lib/native-hardware/midi.d.ts.map +1 -0
- package/dist/lib/native-hardware/midi.js +3 -0
- package/dist/lib/native-hardware/native-device-io.d.ts +28 -0
- package/dist/lib/native-hardware/native-device-io.d.ts.map +1 -0
- package/dist/lib/native-hardware/native-device-io.js +91 -0
- package/dist/lib/native-hardware/native-device-lifecycle.d.ts +13 -0
- package/dist/lib/native-hardware/native-device-lifecycle.d.ts.map +1 -0
- package/dist/lib/native-hardware/native-device-lifecycle.js +40 -0
- package/dist/lib/native-hardware/notifications.d.ts +38 -0
- package/dist/lib/native-hardware/notifications.d.ts.map +1 -0
- package/dist/lib/native-hardware/notifications.js +50 -0
- package/dist/lib/native-hardware/power-session.d.ts +113 -0
- package/dist/lib/native-hardware/power-session.d.ts.map +1 -0
- package/dist/lib/native-hardware/power-session.js +264 -0
- package/dist/lib/native-hardware/secure-storage.d.ts +36 -0
- package/dist/lib/native-hardware/secure-storage.d.ts.map +1 -0
- package/dist/lib/native-hardware/secure-storage.js +64 -0
- package/dist/lib/native-hardware/serial-native.d.ts +23 -0
- package/dist/lib/native-hardware/serial-native.d.ts.map +1 -0
- package/dist/lib/native-hardware/serial-native.js +181 -0
- package/dist/lib/native-hardware/serial.d.ts +76 -0
- package/dist/lib/native-hardware/serial.d.ts.map +1 -0
- package/dist/lib/native-hardware/serial.js +212 -0
- package/dist/lib/native-hardware/system-audio.d.ts +127 -0
- package/dist/lib/native-hardware/system-audio.d.ts.map +1 -0
- package/dist/lib/native-hardware/system-audio.js +330 -0
- package/dist/lib/native-hardware/types.d.ts +62 -0
- package/dist/lib/native-hardware/types.d.ts.map +1 -0
- package/dist/lib/native-hardware/types.js +27 -0
- package/dist/lib/native-hardware/usb-native.d.ts +39 -0
- package/dist/lib/native-hardware/usb-native.d.ts.map +1 -0
- package/dist/lib/native-hardware/usb-native.js +217 -0
- package/dist/lib/native-hardware/usb.d.ts +85 -0
- package/dist/lib/native-hardware/usb.d.ts.map +1 -0
- package/dist/lib/native-hardware/usb.js +222 -0
- package/docs/README.md +37 -0
- package/docs/accessibility.md +32 -0
- package/docs/app-anatomy.md +72 -0
- package/docs/component-catalog.md +59 -0
- package/docs/component-guide-template.md +37 -0
- package/docs/design-tokens.md +172 -0
- package/docs/foundations.md +56 -0
- package/docs/native-integration.md +33 -0
- package/docs/standalone-app-windows.md +128 -0
- package/package.json +9 -3
- package/src/components/ui/alert.md +55 -0
- package/src/components/ui/app-frame.md +33 -0
- package/src/components/ui/badge.md +57 -0
- package/src/components/ui/button.md +76 -0
- package/src/components/ui/color-well.md +11 -0
- package/src/components/ui/combobox.md +43 -0
- package/src/components/ui/date-field.md +32 -0
- package/src/components/ui/edge-fade.md +7 -0
- package/src/components/ui/empty.md +82 -0
- package/src/components/ui/field.md +77 -0
- package/src/components/ui/grid.md +105 -0
- package/src/components/ui/icon-button.md +36 -0
- package/src/components/ui/inspector.md +11 -0
- package/src/components/ui/item.md +87 -0
- package/src/components/ui/list.md +107 -0
- package/src/components/ui/notification-dot.md +7 -0
- package/src/components/ui/number-input.md +19 -0
- package/src/components/ui/panel.md +11 -0
- package/src/components/ui/resizable.md +66 -0
- package/src/components/ui/scroll-area.md +68 -0
- package/src/components/ui/search-field.md +33 -0
- package/src/components/ui/segmented-control.md +39 -0
- package/src/components/ui/sidebar.md +113 -0
- package/src/components/ui/sonner.md +37 -0
- package/src/components/ui/split-view.md +15 -0
- package/src/components/ui/status.md +12 -0
- package/src/components/ui/table.md +35 -0
- package/src/components/ui/tabs.md +66 -0
- package/src/components/ui/text.md +17 -0
- package/src/components/ui/toggle-group.md +80 -0
- package/src/components/ui/toggle.md +73 -0
- package/src/components/ui/toolbar.md +21 -0
- package/src/styles/index.css +868 -3
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { NativeCapabilityBridgeError } from './bridge';
|
|
2
|
+
import { bytesFromNativeDeviceResult, bytesWrittenFromNativeDeviceResult, closeMoldableNativeDevice, executeMoldableNativeDeviceOperation, openMoldableNativeDevice, } from './native-device-io';
|
|
3
|
+
import { NativeDeviceLifecycle, isNativeDeviceDisconnect, } from './native-device-lifecycle';
|
|
4
|
+
export class NativeMoldableHidDevice extends EventTarget {
|
|
5
|
+
descriptor;
|
|
6
|
+
vendorId;
|
|
7
|
+
productId;
|
|
8
|
+
productName;
|
|
9
|
+
handle;
|
|
10
|
+
closing;
|
|
11
|
+
inputPump;
|
|
12
|
+
lifecycle = new NativeDeviceLifecycle();
|
|
13
|
+
constructor(descriptor) {
|
|
14
|
+
super();
|
|
15
|
+
this.descriptor = descriptor;
|
|
16
|
+
this.vendorId = descriptor.vendorId ?? 0;
|
|
17
|
+
this.productId = descriptor.productId ?? 0;
|
|
18
|
+
this.productName = descriptor.label;
|
|
19
|
+
}
|
|
20
|
+
get opened() {
|
|
21
|
+
return this.lifecycle.opened;
|
|
22
|
+
}
|
|
23
|
+
async open() {
|
|
24
|
+
if (this.closing)
|
|
25
|
+
await this.closing;
|
|
26
|
+
if (this.handle && this.lifecycle.disconnected)
|
|
27
|
+
await this.close();
|
|
28
|
+
if (this.opened)
|
|
29
|
+
return;
|
|
30
|
+
const result = await openMoldableNativeDevice('hid', this.descriptor.selector, {});
|
|
31
|
+
if (result.kind !== 'hid')
|
|
32
|
+
throw new Error('Native device kind mismatch.');
|
|
33
|
+
this.handle = result.handle;
|
|
34
|
+
this.lifecycle.didOpen();
|
|
35
|
+
this.startInputPump();
|
|
36
|
+
}
|
|
37
|
+
async close() {
|
|
38
|
+
if (this.closing)
|
|
39
|
+
return this.closing;
|
|
40
|
+
if (!this.handle)
|
|
41
|
+
return;
|
|
42
|
+
const handle = this.handle;
|
|
43
|
+
this.inputPump?.abort();
|
|
44
|
+
this.inputPump = undefined;
|
|
45
|
+
const closing = closeMoldableNativeDevice('hid', handle)
|
|
46
|
+
.then(() => {
|
|
47
|
+
if (this.handle === handle) {
|
|
48
|
+
this.handle = undefined;
|
|
49
|
+
this.lifecycle.didClose();
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
.catch((error) => {
|
|
53
|
+
if (this.handle === handle && !this.lifecycle.disconnected) {
|
|
54
|
+
this.startInputPump();
|
|
55
|
+
}
|
|
56
|
+
throw error;
|
|
57
|
+
})
|
|
58
|
+
.finally(() => {
|
|
59
|
+
if (this.closing === closing)
|
|
60
|
+
this.closing = undefined;
|
|
61
|
+
});
|
|
62
|
+
this.closing = closing;
|
|
63
|
+
return closing;
|
|
64
|
+
}
|
|
65
|
+
async forget() {
|
|
66
|
+
await this.close();
|
|
67
|
+
}
|
|
68
|
+
async sendReport(reportId, data) {
|
|
69
|
+
assertReportId(reportId);
|
|
70
|
+
const payload = asBytes(data);
|
|
71
|
+
const bytes = new Uint8Array(payload.byteLength + 1);
|
|
72
|
+
bytes[0] = reportId;
|
|
73
|
+
bytes.set(payload, 1);
|
|
74
|
+
const result = await this.execute({
|
|
75
|
+
action: 'write',
|
|
76
|
+
endpoint: null,
|
|
77
|
+
data: [...bytes],
|
|
78
|
+
timeoutMs: 10_000,
|
|
79
|
+
bulk: false,
|
|
80
|
+
});
|
|
81
|
+
if (bytesWrittenFromNativeDeviceResult(result) !== bytes.byteLength) {
|
|
82
|
+
throw new NativeCapabilityBridgeError({
|
|
83
|
+
code: 'host_error',
|
|
84
|
+
message: 'The HID device accepted only part of the output report.',
|
|
85
|
+
retryable: true,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async sendFeatureReport(reportId, data) {
|
|
90
|
+
assertReportId(reportId);
|
|
91
|
+
await this.execute({
|
|
92
|
+
action: 'hidSendFeature',
|
|
93
|
+
reportId,
|
|
94
|
+
data: [...asBytes(data)],
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async receiveFeatureReport(reportId) {
|
|
98
|
+
assertReportId(reportId);
|
|
99
|
+
const result = await this.execute({
|
|
100
|
+
action: 'hidReceiveFeature',
|
|
101
|
+
reportId,
|
|
102
|
+
length: 4096,
|
|
103
|
+
});
|
|
104
|
+
const bytes = bytesFromNativeDeviceResult(result);
|
|
105
|
+
return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
106
|
+
}
|
|
107
|
+
listen(listener, signal) {
|
|
108
|
+
if (signal?.aborted)
|
|
109
|
+
return () => undefined;
|
|
110
|
+
let active = true;
|
|
111
|
+
const handleReport = (event) => {
|
|
112
|
+
listener(event);
|
|
113
|
+
};
|
|
114
|
+
const stop = () => {
|
|
115
|
+
if (!active)
|
|
116
|
+
return;
|
|
117
|
+
active = false;
|
|
118
|
+
this.removeEventListener('inputreport', handleReport);
|
|
119
|
+
signal?.removeEventListener('abort', stop);
|
|
120
|
+
};
|
|
121
|
+
this.addEventListener('inputreport', handleReport);
|
|
122
|
+
signal?.addEventListener('abort', stop, { once: true });
|
|
123
|
+
return stop;
|
|
124
|
+
}
|
|
125
|
+
startInputPump() {
|
|
126
|
+
if (!this.handle || this.inputPump || this.lifecycle.disconnected)
|
|
127
|
+
return;
|
|
128
|
+
const controller = new AbortController();
|
|
129
|
+
this.inputPump = controller;
|
|
130
|
+
void this.readLoop(controller.signal).finally(() => {
|
|
131
|
+
if (this.inputPump === controller)
|
|
132
|
+
this.inputPump = undefined;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async readLoop(signal) {
|
|
136
|
+
while (!signal.aborted && this.handle) {
|
|
137
|
+
try {
|
|
138
|
+
const result = await this.execute({
|
|
139
|
+
action: 'hidReadInput',
|
|
140
|
+
length: 4096,
|
|
141
|
+
timeoutMs: 500,
|
|
142
|
+
}, signal);
|
|
143
|
+
if (result.kind !== 'hidInput' ||
|
|
144
|
+
!Number.isInteger(result.reportId) ||
|
|
145
|
+
Number(result.reportId) < 0 ||
|
|
146
|
+
Number(result.reportId) > 255) {
|
|
147
|
+
throw new NativeCapabilityBridgeError({
|
|
148
|
+
code: 'invalid_response',
|
|
149
|
+
message: 'Moldable returned an invalid HID input report.',
|
|
150
|
+
details: result,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
const bytes = bytesFromNativeDeviceResult({
|
|
154
|
+
kind: 'data',
|
|
155
|
+
data: result.data,
|
|
156
|
+
});
|
|
157
|
+
if (bytes.length === 0)
|
|
158
|
+
continue;
|
|
159
|
+
const event = new Event('inputreport');
|
|
160
|
+
Object.defineProperties(event, {
|
|
161
|
+
device: { value: this },
|
|
162
|
+
reportId: { value: Number(result.reportId) },
|
|
163
|
+
data: {
|
|
164
|
+
value: new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength),
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
this.dispatchEvent(event);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
if (signal.aborted || !this.handle)
|
|
171
|
+
return;
|
|
172
|
+
if (error instanceof NativeCapabilityBridgeError &&
|
|
173
|
+
error.code === 'timeout') {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (isNativeDeviceDisconnect(error)) {
|
|
177
|
+
this.lifecycle.didDisconnect(this, error);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
const event = new Event('error');
|
|
181
|
+
Object.defineProperty(event, 'error', { value: error });
|
|
182
|
+
this.dispatchEvent(event);
|
|
183
|
+
}
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async execute(operation, signal) {
|
|
189
|
+
if (!this.handle) {
|
|
190
|
+
throw new NativeCapabilityBridgeError({
|
|
191
|
+
code: 'invalid_request',
|
|
192
|
+
message: 'HID device is not open.',
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (this.lifecycle.disconnected) {
|
|
196
|
+
throw new NativeCapabilityBridgeError({
|
|
197
|
+
code: 'unavailable',
|
|
198
|
+
message: 'HID device is disconnected.',
|
|
199
|
+
retryable: true,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
return await executeMoldableNativeDeviceOperation('hid', this.handle, operation, { signal });
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
if (isNativeDeviceDisconnect(error)) {
|
|
207
|
+
this.lifecycle.didDisconnect(this, error);
|
|
208
|
+
}
|
|
209
|
+
throw error;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
export function isNativeMoldableHidDevice(device) {
|
|
214
|
+
return device instanceof NativeMoldableHidDevice;
|
|
215
|
+
}
|
|
216
|
+
function asBytes(data) {
|
|
217
|
+
return data instanceof ArrayBuffer
|
|
218
|
+
? new Uint8Array(data)
|
|
219
|
+
: new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
220
|
+
}
|
|
221
|
+
function assertReportId(reportId) {
|
|
222
|
+
if (!Number.isInteger(reportId) || reportId < 0 || reportId > 0xff) {
|
|
223
|
+
throw new NativeCapabilityBridgeError({
|
|
224
|
+
code: 'invalid_request',
|
|
225
|
+
message: 'HID reportId must be an integer between 0 and 255.',
|
|
226
|
+
retryable: false,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface MoldableHidOperationOptions {
|
|
2
|
+
signal?: AbortSignal;
|
|
3
|
+
}
|
|
4
|
+
export interface MoldableHidDeviceFilter {
|
|
5
|
+
vendorId?: number;
|
|
6
|
+
productId?: number;
|
|
7
|
+
usagePage?: number;
|
|
8
|
+
usage?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface MoldableHidInputReportEvent extends Event {
|
|
11
|
+
readonly data: DataView;
|
|
12
|
+
readonly device: MoldableHidDevice;
|
|
13
|
+
readonly reportId: number;
|
|
14
|
+
}
|
|
15
|
+
/** Structural subset of the standard HIDDevice interface used by the helpers. */
|
|
16
|
+
export interface MoldableHidDevice extends EventTarget {
|
|
17
|
+
readonly opened: boolean;
|
|
18
|
+
readonly vendorId: number;
|
|
19
|
+
readonly productId: number;
|
|
20
|
+
readonly productName: string;
|
|
21
|
+
open(): Promise<void>;
|
|
22
|
+
close(): Promise<void>;
|
|
23
|
+
forget?(): Promise<void>;
|
|
24
|
+
sendReport(reportId: number, data: BufferSource): Promise<void>;
|
|
25
|
+
sendFeatureReport(reportId: number, data: BufferSource): Promise<void>;
|
|
26
|
+
receiveFeatureReport(reportId: number): Promise<DataView>;
|
|
27
|
+
}
|
|
28
|
+
export interface MoldableHidRequestOptions extends MoldableHidOperationOptions {
|
|
29
|
+
filters: readonly MoldableHidDeviceFilter[];
|
|
30
|
+
exclusionFilters?: readonly MoldableHidDeviceFilter[];
|
|
31
|
+
}
|
|
32
|
+
/** Returns true only when this WebView exposes the WebHID entry point. */
|
|
33
|
+
export declare function isMoldableHidSupported(): boolean;
|
|
34
|
+
/** Lists devices previously authorized through WebHID. */
|
|
35
|
+
export declare function getMoldableHidDevices(): Promise<MoldableHidDevice[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Shows the browser's HID chooser. Call this directly from a user gesture.
|
|
38
|
+
* Aborting stops awaiting the result but cannot dismiss every browser chooser.
|
|
39
|
+
*/
|
|
40
|
+
export declare function requestMoldableHidDevices(options: MoldableHidRequestOptions): Promise<MoldableHidDevice[]>;
|
|
41
|
+
export declare function openMoldableHidDevice(device: MoldableHidDevice): Promise<void>;
|
|
42
|
+
export declare function closeMoldableHidDevice(device: MoldableHidDevice): Promise<void>;
|
|
43
|
+
/** Revokes the saved permission when the runtime supports HIDDevice.forget(). */
|
|
44
|
+
export declare function forgetMoldableHidDevice(device: MoldableHidDevice): Promise<void>;
|
|
45
|
+
export declare function sendMoldableHidReport(device: MoldableHidDevice, reportId: number, data: BufferSource, options?: MoldableHidOperationOptions): Promise<void>;
|
|
46
|
+
export declare function sendMoldableHidFeatureReport(device: MoldableHidDevice, reportId: number, data: BufferSource, options?: MoldableHidOperationOptions): Promise<void>;
|
|
47
|
+
export declare function receiveMoldableHidFeatureReport(device: MoldableHidDevice, reportId: number, options?: MoldableHidOperationOptions): Promise<DataView>;
|
|
48
|
+
/** Registers an input-report listener and returns an idempotent cleanup handle. */
|
|
49
|
+
export declare function listenForMoldableHidInputReports(device: MoldableHidDevice, listener: (event: MoldableHidInputReportEvent) => void, options?: {
|
|
50
|
+
signal?: AbortSignal;
|
|
51
|
+
}): () => void;
|
|
52
|
+
//# sourceMappingURL=hid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hid.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/hid.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,2BAA2B;IAC1C,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,2BAA4B,SAAQ,KAAK;IACxD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAA;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAED,iFAAiF;AACjF,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/D,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtE,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CAC1D;AAcD,MAAM,WAAW,yBAA0B,SAAQ,2BAA2B;IAC5E,OAAO,EAAE,SAAS,uBAAuB,EAAE,CAAA;IAC3C,gBAAgB,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAA;CACtD;AA6BD,0EAA0E;AAC1E,wBAAgB,sBAAsB,IAAI,OAAO,CAIhD;AAED,0DAA0D;AAC1D,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAU1E;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA0D9B;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,iFAAiF;AACjF,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,YAAY,EAClB,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,IAAI,CAAC,CAWf;AAED,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,YAAY,EAClB,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,IAAI,CAAC,CAWf;AAED,wBAAsB,+BAA+B,CACnD,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,QAAQ,CAAC,CAWnB;AAED,mFAAmF;AACnF,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,EACtD,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACrC,MAAM,IAAI,CAqBZ"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { assertMoldableNativeCapabilityAccess, requireMoldableNativeCapabilityAccess, } from './access';
|
|
2
|
+
import { NativeCapabilityBridgeError } from './bridge';
|
|
3
|
+
import { awaitDeviceIoWithAbort, deviceIoError, unsupportedDeviceIoError, } from './device-io-errors';
|
|
4
|
+
import { NativeMoldableHidDevice, isNativeMoldableHidDevice, } from './hid-native';
|
|
5
|
+
import { listMoldableNativeDevices } from './native-device-io';
|
|
6
|
+
function assertNativeHidFiltersSupported(filters) {
|
|
7
|
+
if (filters?.some((filter) => filter.usagePage !== undefined || filter.usage !== undefined)) {
|
|
8
|
+
throw new NativeCapabilityBridgeError({
|
|
9
|
+
code: 'unsupported',
|
|
10
|
+
message: 'The native HID fallback cannot match usagePage or usage filters on this platform.',
|
|
11
|
+
retryable: false,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function hidApi() {
|
|
16
|
+
const api = typeof navigator === 'undefined'
|
|
17
|
+
? undefined
|
|
18
|
+
: navigator.hid;
|
|
19
|
+
if (!api)
|
|
20
|
+
throw unsupportedDeviceIoError('hid');
|
|
21
|
+
return api;
|
|
22
|
+
}
|
|
23
|
+
/** Returns true only when this WebView exposes the WebHID entry point. */
|
|
24
|
+
export function isMoldableHidSupported() {
|
|
25
|
+
return (typeof navigator !== 'undefined' && !!navigator.hid);
|
|
26
|
+
}
|
|
27
|
+
/** Lists devices previously authorized through WebHID. */
|
|
28
|
+
export async function getMoldableHidDevices() {
|
|
29
|
+
await assertMoldableNativeCapabilityAccess('hid');
|
|
30
|
+
if (!isMoldableHidSupported()) {
|
|
31
|
+
throw unsupportedDeviceIoError('hid');
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
return await hidApi().getDevices();
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw deviceIoError('hid', 'enumerate', error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Shows the browser's HID chooser. Call this directly from a user gesture.
|
|
42
|
+
* Aborting stops awaiting the result but cannot dismiss every browser chooser.
|
|
43
|
+
*/
|
|
44
|
+
export async function requestMoldableHidDevices(options) {
|
|
45
|
+
await requireMoldableNativeCapabilityAccess('hid', options);
|
|
46
|
+
if (!isMoldableHidSupported()) {
|
|
47
|
+
assertNativeHidFiltersSupported(options.filters);
|
|
48
|
+
assertNativeHidFiltersSupported(options.exclusionFilters);
|
|
49
|
+
const descriptors = await listMoldableNativeDevices('hid', {
|
|
50
|
+
signal: options.signal,
|
|
51
|
+
filters: options.filters.map(({ vendorId, productId }) => ({
|
|
52
|
+
vendorId,
|
|
53
|
+
productId,
|
|
54
|
+
})),
|
|
55
|
+
...(options.exclusionFilters
|
|
56
|
+
? {
|
|
57
|
+
exclusionFilters: options.exclusionFilters.map(({ vendorId, productId }) => ({ vendorId, productId })),
|
|
58
|
+
}
|
|
59
|
+
: {}),
|
|
60
|
+
});
|
|
61
|
+
return descriptors
|
|
62
|
+
.filter((descriptor) => options.filters.length === 0
|
|
63
|
+
? true
|
|
64
|
+
: options.filters.some((filter) => (filter.vendorId === undefined ||
|
|
65
|
+
filter.vendorId === descriptor.vendorId) &&
|
|
66
|
+
(filter.productId === undefined ||
|
|
67
|
+
filter.productId === descriptor.productId)))
|
|
68
|
+
.filter((descriptor) => !options.exclusionFilters?.some((filter) => (filter.vendorId === undefined ||
|
|
69
|
+
filter.vendorId === descriptor.vendorId) &&
|
|
70
|
+
(filter.productId === undefined ||
|
|
71
|
+
filter.productId === descriptor.productId)))
|
|
72
|
+
.map((descriptor) => new NativeMoldableHidDevice(descriptor));
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
return await awaitDeviceIoWithAbort(hidApi().requestDevice({
|
|
76
|
+
filters: [...options.filters],
|
|
77
|
+
...(options.exclusionFilters
|
|
78
|
+
? { exclusionFilters: [...options.exclusionFilters] }
|
|
79
|
+
: {}),
|
|
80
|
+
}), 'hid', 'request', options.signal);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
throw deviceIoError('hid', 'request', error);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export async function openMoldableHidDevice(device) {
|
|
87
|
+
if (device.opened)
|
|
88
|
+
return;
|
|
89
|
+
try {
|
|
90
|
+
await device.open();
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
throw deviceIoError('hid', 'open', error);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export async function closeMoldableHidDevice(device) {
|
|
97
|
+
if (!device.opened && !isNativeMoldableHidDevice(device))
|
|
98
|
+
return;
|
|
99
|
+
try {
|
|
100
|
+
await device.close();
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
throw deviceIoError('hid', 'close', error);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** Revokes the saved permission when the runtime supports HIDDevice.forget(). */
|
|
107
|
+
export async function forgetMoldableHidDevice(device) {
|
|
108
|
+
if (typeof device.forget !== 'function') {
|
|
109
|
+
throw unsupportedDeviceIoError('hid');
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
await device.forget();
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
throw deviceIoError('hid', 'close', error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export async function sendMoldableHidReport(device, reportId, data, options = {}) {
|
|
119
|
+
try {
|
|
120
|
+
await awaitDeviceIoWithAbort(device.sendReport(reportId, data), 'hid', 'write', options.signal);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
throw deviceIoError('hid', 'write', error);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export async function sendMoldableHidFeatureReport(device, reportId, data, options = {}) {
|
|
127
|
+
try {
|
|
128
|
+
await awaitDeviceIoWithAbort(device.sendFeatureReport(reportId, data), 'hid', 'write', options.signal);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
throw deviceIoError('hid', 'write', error);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export async function receiveMoldableHidFeatureReport(device, reportId, options = {}) {
|
|
135
|
+
try {
|
|
136
|
+
return await awaitDeviceIoWithAbort(device.receiveFeatureReport(reportId), 'hid', 'read', options.signal);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
throw deviceIoError('hid', 'read', error);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/** Registers an input-report listener and returns an idempotent cleanup handle. */
|
|
143
|
+
export function listenForMoldableHidInputReports(device, listener, options = {}) {
|
|
144
|
+
if (isNativeMoldableHidDevice(device)) {
|
|
145
|
+
return device.listen(listener, options.signal);
|
|
146
|
+
}
|
|
147
|
+
if (options.signal?.aborted)
|
|
148
|
+
return () => undefined;
|
|
149
|
+
const handleReport = (event) => {
|
|
150
|
+
listener(event);
|
|
151
|
+
};
|
|
152
|
+
let active = true;
|
|
153
|
+
const cleanup = () => {
|
|
154
|
+
if (!active)
|
|
155
|
+
return;
|
|
156
|
+
active = false;
|
|
157
|
+
device.removeEventListener('inputreport', handleReport);
|
|
158
|
+
options.signal?.removeEventListener('abort', cleanup);
|
|
159
|
+
};
|
|
160
|
+
device.addEventListener('inputreport', handleReport);
|
|
161
|
+
options.signal?.addEventListener('abort', cleanup, { once: true });
|
|
162
|
+
return cleanup;
|
|
163
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export { NativeCapabilityBridgeError, getMoldableNativeCapabilities, toNativeCapabilityBridgeError, } from './bridge';
|
|
2
|
+
export type { NativeCapabilityBridgeOptions } from './bridge';
|
|
3
|
+
export { assertMoldableNativeCapabilityAccess, getMoldableNativeCapabilityAccess, requestMoldableNativeCapabilityAccess, requireMoldableNativeCapabilityAccess, } from './access';
|
|
4
|
+
export type { MoldableNativeCapabilityAccessState } from './access';
|
|
5
|
+
export { getNativeCapability, isNativeCapabilityDescriptor, isNativeCapabilityId, isNativeCapabilityManifest, supportsNativeCapability, } from './capabilities';
|
|
6
|
+
export { readMoldableClipboardText, writeMoldableClipboardText, } from './clipboard';
|
|
7
|
+
export { MoldableBluetoothConnection, connectMoldableBluetoothDevice, getMoldableBluetoothAvailability, getMoldableBluetoothCharacteristic, isMoldableBluetoothSupported, observeMoldableBluetoothNotifications, readMoldableBluetoothValue, requestMoldableBluetoothDevice, requestMoldableBluetoothWithFallback, writeMoldableBluetoothValue, } from './bluetooth';
|
|
8
|
+
export type { MoldableBluetoothAPI, MoldableBluetoothAvailability, MoldableBluetoothConnectionOptions, MoldableBluetoothDataFilter, MoldableBluetoothDevice, MoldableBluetoothDeviceEventMap, MoldableBluetoothLEScanFilter, MoldableBluetoothManufacturerDataFilter, MoldableBluetoothNavigator, MoldableBluetoothOperationOptions, MoldableBluetoothRemoteGATTCharacteristic, MoldableBluetoothRemoteGATTServer, MoldableBluetoothRemoteGATTService, MoldableBluetoothRequestDeviceOptions, MoldableBluetoothRequestOptions, MoldableBluetoothServiceDataFilter, MoldableBluetoothTransport, MoldableBluetoothUUID, MoldableBluetoothWriteMode, MoldableNativeBluetoothDevice, MoldableNativeBluetoothService, } from './bluetooth';
|
|
9
|
+
export { getMoldableDisplays } from './displays';
|
|
10
|
+
export type { GetMoldableDisplaysOptions, MoldableDisplay, MoldableDisplayPosition, MoldableDisplaySize, MoldableDisplaysResult, } from './displays';
|
|
11
|
+
export { areMoldableGlobalShortcutsSuspended, isMoldableGlobalShortcutRegistered, isMoldableGlobalShortcut, registerAllMoldableGlobalShortcuts, registerMoldableGlobalShortcut, setMoldableGlobalShortcutsSuspended, unregisterAllMoldableGlobalShortcuts, unregisterMoldableGlobalShortcut, } from './global-shortcuts';
|
|
12
|
+
export type { MoldableGlobalShortcutEvent, MoldableGlobalShortcutHandler, MoldableGlobalShortcutRegistration, MoldableGlobalShortcutState, } from './global-shortcuts';
|
|
13
|
+
export { getMoldableHapticAvailability, performMoldableHapticFeedback, } from './haptics';
|
|
14
|
+
export type { MoldableHapticAvailability, MoldableHapticPattern, MoldableHapticResult, } from './haptics';
|
|
15
|
+
export { closeMoldableHidDevice, forgetMoldableHidDevice, getMoldableHidDevices, isMoldableHidSupported, listenForMoldableHidInputReports, openMoldableHidDevice, receiveMoldableHidFeatureReport, requestMoldableHidDevices, sendMoldableHidFeatureReport, sendMoldableHidReport, } from './hid';
|
|
16
|
+
export type { MoldableHidDevice, MoldableHidDeviceFilter, MoldableHidInputReportEvent, MoldableHidOperationOptions, MoldableHidRequestOptions, } from './hid';
|
|
17
|
+
export { MOLDABLE_LOCATION_MAX_CACHE_AGE_MS, MOLDABLE_LOCATION_MAX_TIMEOUT_MS, MOLDABLE_LOCATION_MIN_TIMEOUT_MS, getMoldableCurrentPosition, getMoldableLocationAuthorizationStatus, } from './location';
|
|
18
|
+
export type { MoldableLocationAuthorization, MoldableLocationAuthorizationState, MoldableLocationCoordinates, MoldableLocationOptions, MoldableLocationResult, } from './location';
|
|
19
|
+
export { LOCAL_AUTHENTICATION_MAX_REASON_BYTES, authenticateMoldableLocalUser, getMoldableLocalAuthenticationAvailability, } from './local-authentication';
|
|
20
|
+
export type { MoldableLocalAuthenticationAvailability, MoldableLocalAuthenticationMethod, MoldableLocalAuthenticationOptions, MoldableLocalAuthenticationOutcome, MoldableLocalAuthenticationPolicy, MoldableLocalAuthenticationResult, } from './local-authentication';
|
|
21
|
+
export { enumerateMoldableMediaDevices, getMoldableCameraStream, getMoldableDisplayStream, getMoldableMicrophoneStream, stopMoldableMediaStream, } from './media';
|
|
22
|
+
export { NATIVE_SYSTEM_AUDIO_MAX_REPLAY_FRAMES, NATIVE_SYSTEM_AUDIO_PERMISSION_REQUEST_TIMEOUT_MS, getMoldableSystemAudioCapabilities, getMoldableSystemAudioStatus, replayMoldableSystemAudioFrames, requestMoldableSystemAudioPermission, startMoldableSystemAudioCapture, stopMoldableSystemAudioCapture, subscribeMoldableSystemAudioEvents, } from './system-audio';
|
|
23
|
+
export type { MoldableSystemAudioCapabilities, MoldableSystemAudioCapabilityResult, MoldableSystemAudioCaptureMode, MoldableSystemAudioEvent, MoldableSystemAudioEventListener, MoldableSystemAudioReplayOptions, MoldableSystemAudioSource, MoldableSystemAudioSourceState, MoldableSystemAudioStartOptions, MoldableSystemAudioStartResult, MoldableSystemAudioStatus, MoldableSystemAudioStopOptions, SubscribeMoldableSystemAudioEventsOptions, UnsubscribeMoldableSystemAudioEvents, } from './system-audio';
|
|
24
|
+
export { NATIVE_MEDIA_PERMISSION_REQUEST_TIMEOUT_MS, getMoldableMediaPermissionDiagnostics, getMoldableMediaPermissionStatus, requestMoldableMediaPermission, } from './media-permissions';
|
|
25
|
+
export type { MoldableMediaPermission, MoldableMediaPermissionDiagnostics, MoldableMediaPermissionState, MoldableMediaPermissionStatus, } from './media-permissions';
|
|
26
|
+
export { getMoldableMIDIInputs, getMoldableMIDIOutputs, isMoldableMIDISupported, observeMoldableMIDIState, openMoldableMIDIInput, openMoldableMIDIOutput, requestMoldableMIDIAccess, requestMoldableMIDIWithFallback, } from './midi';
|
|
27
|
+
export type { MoldableMIDIAccessOptions, MoldableMIDIConnectionOptions, MoldableMIDIInputConnection, MoldableMIDIOutputConnection, MoldableMIDITransport, MoldableNativeMIDIAccess, MoldableNativeMIDIPort, } from './midi';
|
|
28
|
+
export { NATIVE_NOTIFICATION_MAX_BODY_LENGTH, NATIVE_NOTIFICATION_MAX_TAG_LENGTH, NATIVE_NOTIFICATION_MAX_TITLE_LENGTH, getMoldableNotificationPermission, requestMoldableNotificationPermission, sendMoldableNotification, } from './notifications';
|
|
29
|
+
export type { MoldableNotificationOptions, MoldableNotificationPermission, MoldableNotificationPermissionResult, MoldableNotificationSendResult, } from './notifications';
|
|
30
|
+
export { getMoldableCurrentThermalState, getMoldablePowerState, getMoldableSystemIdleState, getMoldableSystemIdleTime, isMoldableSleepBlockerStarted, isMoldablePowerSessionEvent, startMoldableSleepBlocker, stopMoldableSleepBlocker, watchMoldablePowerSession, } from './power-session';
|
|
31
|
+
export type { MoldableBatteryState, MoldableBatteryStatus, MoldablePowerSessionEvent, MoldablePowerSource, MoldablePowerState, MoldableSleepBlocker, MoldableSleepBlockerType, MoldableSystemIdleResult, MoldableSystemIdleState, MoldableThermalState, StopWatchingMoldablePowerSession, WatchMoldablePowerSessionOptions, } from './power-session';
|
|
32
|
+
export { SECURE_STORAGE_MAX_KEY_LENGTH, SECURE_STORAGE_MAX_VALUE_BYTES, deleteMoldableSecureValue, getMoldableSecureStorageDiagnostics, getMoldableSecureValue, listMoldableSecureValues, setMoldableSecureValue, } from './secure-storage';
|
|
33
|
+
export type { MoldableSecureStorageDeleteResult, MoldableSecureStorageBackend, MoldableSecureStorageDiagnostics, MoldableSecureStorageEntryMetadata, MoldableSecureStorageListResult, MoldableSecureStorageSetResult, MoldableSecureStorageValueResult, } from './secure-storage';
|
|
34
|
+
export { closeMoldableSerialPort, forgetMoldableSerialPort, getMoldableSerialPorts, getMoldableSerialSignals, isMoldableSerialSupported, openMoldableSerialPort, readMoldableSerialPort, requestMoldableSerialPort, setMoldableSerialSignals, writeMoldableSerialPort, } from './serial';
|
|
35
|
+
export type { MoldableBluetoothServiceUuid, MoldableSerialInputSignals, MoldableSerialOpenOptions, MoldableSerialOperationOptions, MoldableSerialOutputSignals, MoldableSerialPort, MoldableSerialPortFilter, MoldableSerialPortInfo, MoldableSerialRequestOptions, } from './serial';
|
|
36
|
+
export { NATIVE_CAPABILITY_IDS, NATIVE_CAPABILITY_MANIFEST_SCHEMA_VERSION, } from './types';
|
|
37
|
+
export type { NativeCapabilityDescriptor, NativeCapabilityId, NativeCapabilityManifest, NativeCapabilityErrorCode, NativeCapabilityErrorPayload, NativeCapabilityPermissionAuthority, NativeCapabilityPermissionMetadata, NativeCapabilityPermissionName, NativeCapabilityPermissionRequest, NativeCapabilityPlatform, NativeCapabilitySupport, NativeCapabilityTransportKind, NativeCapabilityTransportMetadata, } from './types';
|
|
38
|
+
export { clearMoldableUsbHalt, closeMoldableUsbDevice, forgetMoldableUsbDevice, getMoldableUsbDevices, isMoldableUsbSupported, openMoldableUsbDevice, readMoldableUsbControlTransfer, readMoldableUsbEndpoint, requestMoldableUsbDevice, resetMoldableUsbDevice, writeMoldableUsbControlTransfer, writeMoldableUsbEndpoint, } from './usb';
|
|
39
|
+
export type { MoldableUsbConfiguration, MoldableUsbControlTransferParameters, MoldableUsbDevice, MoldableUsbDeviceFilter, MoldableUsbInTransferResult, MoldableUsbOpenOptions, MoldableUsbOperationOptions, MoldableUsbOutTransferResult, MoldableUsbRequestOptions, } from './usb';
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { NativeCapabilityBridgeError, getMoldableNativeCapabilities, toNativeCapabilityBridgeError, } from './bridge';
|
|
2
|
+
export { assertMoldableNativeCapabilityAccess, getMoldableNativeCapabilityAccess, requestMoldableNativeCapabilityAccess, requireMoldableNativeCapabilityAccess, } from './access';
|
|
3
|
+
export { getNativeCapability, isNativeCapabilityDescriptor, isNativeCapabilityId, isNativeCapabilityManifest, supportsNativeCapability, } from './capabilities';
|
|
4
|
+
export { readMoldableClipboardText, writeMoldableClipboardText, } from './clipboard';
|
|
5
|
+
export { MoldableBluetoothConnection, connectMoldableBluetoothDevice, getMoldableBluetoothAvailability, getMoldableBluetoothCharacteristic, isMoldableBluetoothSupported, observeMoldableBluetoothNotifications, readMoldableBluetoothValue, requestMoldableBluetoothDevice, requestMoldableBluetoothWithFallback, writeMoldableBluetoothValue, } from './bluetooth';
|
|
6
|
+
export { getMoldableDisplays } from './displays';
|
|
7
|
+
export { areMoldableGlobalShortcutsSuspended, isMoldableGlobalShortcutRegistered, isMoldableGlobalShortcut, registerAllMoldableGlobalShortcuts, registerMoldableGlobalShortcut, setMoldableGlobalShortcutsSuspended, unregisterAllMoldableGlobalShortcuts, unregisterMoldableGlobalShortcut, } from './global-shortcuts';
|
|
8
|
+
export { getMoldableHapticAvailability, performMoldableHapticFeedback, } from './haptics';
|
|
9
|
+
export { closeMoldableHidDevice, forgetMoldableHidDevice, getMoldableHidDevices, isMoldableHidSupported, listenForMoldableHidInputReports, openMoldableHidDevice, receiveMoldableHidFeatureReport, requestMoldableHidDevices, sendMoldableHidFeatureReport, sendMoldableHidReport, } from './hid';
|
|
10
|
+
export { MOLDABLE_LOCATION_MAX_CACHE_AGE_MS, MOLDABLE_LOCATION_MAX_TIMEOUT_MS, MOLDABLE_LOCATION_MIN_TIMEOUT_MS, getMoldableCurrentPosition, getMoldableLocationAuthorizationStatus, } from './location';
|
|
11
|
+
export { LOCAL_AUTHENTICATION_MAX_REASON_BYTES, authenticateMoldableLocalUser, getMoldableLocalAuthenticationAvailability, } from './local-authentication';
|
|
12
|
+
export { enumerateMoldableMediaDevices, getMoldableCameraStream, getMoldableDisplayStream, getMoldableMicrophoneStream, stopMoldableMediaStream, } from './media';
|
|
13
|
+
export { NATIVE_SYSTEM_AUDIO_MAX_REPLAY_FRAMES, NATIVE_SYSTEM_AUDIO_PERMISSION_REQUEST_TIMEOUT_MS, getMoldableSystemAudioCapabilities, getMoldableSystemAudioStatus, replayMoldableSystemAudioFrames, requestMoldableSystemAudioPermission, startMoldableSystemAudioCapture, stopMoldableSystemAudioCapture, subscribeMoldableSystemAudioEvents, } from './system-audio';
|
|
14
|
+
export { NATIVE_MEDIA_PERMISSION_REQUEST_TIMEOUT_MS, getMoldableMediaPermissionDiagnostics, getMoldableMediaPermissionStatus, requestMoldableMediaPermission, } from './media-permissions';
|
|
15
|
+
export { getMoldableMIDIInputs, getMoldableMIDIOutputs, isMoldableMIDISupported, observeMoldableMIDIState, openMoldableMIDIInput, openMoldableMIDIOutput, requestMoldableMIDIAccess, requestMoldableMIDIWithFallback, } from './midi';
|
|
16
|
+
export { NATIVE_NOTIFICATION_MAX_BODY_LENGTH, NATIVE_NOTIFICATION_MAX_TAG_LENGTH, NATIVE_NOTIFICATION_MAX_TITLE_LENGTH, getMoldableNotificationPermission, requestMoldableNotificationPermission, sendMoldableNotification, } from './notifications';
|
|
17
|
+
export { getMoldableCurrentThermalState, getMoldablePowerState, getMoldableSystemIdleState, getMoldableSystemIdleTime, isMoldableSleepBlockerStarted, isMoldablePowerSessionEvent, startMoldableSleepBlocker, stopMoldableSleepBlocker, watchMoldablePowerSession, } from './power-session';
|
|
18
|
+
export { SECURE_STORAGE_MAX_KEY_LENGTH, SECURE_STORAGE_MAX_VALUE_BYTES, deleteMoldableSecureValue, getMoldableSecureStorageDiagnostics, getMoldableSecureValue, listMoldableSecureValues, setMoldableSecureValue, } from './secure-storage';
|
|
19
|
+
export { closeMoldableSerialPort, forgetMoldableSerialPort, getMoldableSerialPorts, getMoldableSerialSignals, isMoldableSerialSupported, openMoldableSerialPort, readMoldableSerialPort, requestMoldableSerialPort, setMoldableSerialSignals, writeMoldableSerialPort, } from './serial';
|
|
20
|
+
export { NATIVE_CAPABILITY_IDS, NATIVE_CAPABILITY_MANIFEST_SCHEMA_VERSION, } from './types';
|
|
21
|
+
export { clearMoldableUsbHalt, closeMoldableUsbDevice, forgetMoldableUsbDevice, getMoldableUsbDevices, isMoldableUsbSupported, openMoldableUsbDevice, readMoldableUsbControlTransfer, readMoldableUsbEndpoint, requestMoldableUsbDevice, resetMoldableUsbDevice, writeMoldableUsbControlTransfer, writeMoldableUsbEndpoint, } from './usb';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type NativeCapabilityBridgeOptions } from './bridge';
|
|
2
|
+
export declare const NATIVE_LOCAL_AUTHENTICATION_REQUEST_TYPE: "moldable:native-local-authentication";
|
|
3
|
+
export declare const NATIVE_LOCAL_AUTHENTICATION_RESULT_TYPE: "moldable:native-local-authentication-result";
|
|
4
|
+
export declare const LOCAL_AUTHENTICATION_MAX_REASON_BYTES = 160;
|
|
5
|
+
export declare const LOCAL_AUTHENTICATION_TIMEOUT_MS = 125000;
|
|
6
|
+
export type MoldableLocalAuthenticationMethod = 'biometric' | 'device-owner' | 'device-credential' | 'unknown';
|
|
7
|
+
export type MoldableLocalAuthenticationPolicy = 'biometric-only' | 'device-owner';
|
|
8
|
+
export interface MoldableLocalAuthenticationOptions extends NativeCapabilityBridgeOptions {
|
|
9
|
+
/** Defaults to device-owner for compatibility with earlier releases. */
|
|
10
|
+
policy?: MoldableLocalAuthenticationPolicy;
|
|
11
|
+
}
|
|
12
|
+
export type MoldableLocalAuthenticationOutcome = 'authenticated' | 'cancelled' | 'failed' | 'locked-out' | 'unavailable';
|
|
13
|
+
export interface MoldableLocalAuthenticationAvailability {
|
|
14
|
+
available: boolean;
|
|
15
|
+
method: MoldableLocalAuthenticationMethod;
|
|
16
|
+
reason?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface MoldableLocalAuthenticationResult {
|
|
19
|
+
outcome: MoldableLocalAuthenticationOutcome;
|
|
20
|
+
method: MoldableLocalAuthenticationMethod;
|
|
21
|
+
message?: string;
|
|
22
|
+
retryable: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function getMoldableLocalAuthenticationAvailability(options?: NativeCapabilityBridgeOptions): Promise<MoldableLocalAuthenticationAvailability>;
|
|
25
|
+
/**
|
|
26
|
+
* Ask the operating system to verify the current device user.
|
|
27
|
+
*
|
|
28
|
+
* Authentication failures and user cancellation are returned as reasoned
|
|
29
|
+
* outcomes. Bridge failures still reject with NativeCapabilityBridgeError.
|
|
30
|
+
*/
|
|
31
|
+
export declare function authenticateMoldableLocalUser(reason: string, options?: MoldableLocalAuthenticationOptions): Promise<MoldableLocalAuthenticationResult>;
|
|
32
|
+
//# sourceMappingURL=local-authentication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-authentication.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/local-authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,6BAA6B,EAEnC,MAAM,UAAU,CAAA;AAEjB,eAAO,MAAM,wCAAwC,EACnD,sCAA+C,CAAA;AACjD,eAAO,MAAM,uCAAuC,EAClD,6CAAsD,CAAA;AAExD,eAAO,MAAM,qCAAqC,MAAM,CAAA;AACxD,eAAO,MAAM,+BAA+B,SAAU,CAAA;AAEtD,MAAM,MAAM,iCAAiC,GACzC,WAAW,GACX,cAAc,GACd,mBAAmB,GACnB,SAAS,CAAA;AAEb,MAAM,MAAM,iCAAiC,GACzC,gBAAgB,GAChB,cAAc,CAAA;AAElB,MAAM,WAAW,kCACf,SAAQ,6BAA6B;IACrC,wEAAwE;IACxE,MAAM,CAAC,EAAE,iCAAiC,CAAA;CAC3C;AAED,MAAM,MAAM,kCAAkC,GAC1C,eAAe,GACf,WAAW,GACX,QAAQ,GACR,YAAY,GACZ,aAAa,CAAA;AAEjB,MAAM,WAAW,uCAAuC;IACtD,SAAS,EAAE,OAAO,CAAA;IAClB,MAAM,EAAE,iCAAiC,CAAA;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,kCAAkC,CAAA;IAC3C,MAAM,EAAE,iCAAiC,CAAA;IACzC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;CACnB;AASD,wBAAgB,0CAA0C,CACxD,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,uCAAuC,CAAC,CAUlD;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,kCAAuC,GAC/C,OAAO,CAAC,iCAAiC,CAAC,CAiC5C"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { callNativeCapabilityBridge, } from './bridge';
|
|
2
|
+
export const NATIVE_LOCAL_AUTHENTICATION_REQUEST_TYPE = 'moldable:native-local-authentication';
|
|
3
|
+
export const NATIVE_LOCAL_AUTHENTICATION_RESULT_TYPE = 'moldable:native-local-authentication-result';
|
|
4
|
+
export const LOCAL_AUTHENTICATION_MAX_REASON_BYTES = 160;
|
|
5
|
+
export const LOCAL_AUTHENTICATION_TIMEOUT_MS = 125_000;
|
|
6
|
+
function hasControlCharacters(value) {
|
|
7
|
+
return Array.from(value).some((character) => {
|
|
8
|
+
const codePoint = character.codePointAt(0) ?? 0;
|
|
9
|
+
return codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function getMoldableLocalAuthenticationAvailability(options = {}) {
|
|
13
|
+
return callNativeCapabilityBridge({
|
|
14
|
+
type: NATIVE_LOCAL_AUTHENTICATION_REQUEST_TYPE,
|
|
15
|
+
capability: 'local-authentication',
|
|
16
|
+
action: 'getAvailability',
|
|
17
|
+
}, NATIVE_LOCAL_AUTHENTICATION_RESULT_TYPE, options);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Ask the operating system to verify the current device user.
|
|
21
|
+
*
|
|
22
|
+
* Authentication failures and user cancellation are returned as reasoned
|
|
23
|
+
* outcomes. Bridge failures still reject with NativeCapabilityBridgeError.
|
|
24
|
+
*/
|
|
25
|
+
export function authenticateMoldableLocalUser(reason, options = {}) {
|
|
26
|
+
if (reason.trim().length === 0 ||
|
|
27
|
+
hasControlCharacters(reason) ||
|
|
28
|
+
new TextEncoder().encode(reason).byteLength >
|
|
29
|
+
LOCAL_AUTHENTICATION_MAX_REASON_BYTES) {
|
|
30
|
+
return Promise.reject(new TypeError(`Authentication reason must contain 1-${LOCAL_AUTHENTICATION_MAX_REASON_BYTES} UTF-8 bytes and no control characters.`));
|
|
31
|
+
}
|
|
32
|
+
const { policy = 'device-owner', ...bridgeOptions } = options;
|
|
33
|
+
if (policy !== 'biometric-only' && policy !== 'device-owner') {
|
|
34
|
+
return Promise.reject(new TypeError('Invalid local authentication policy.'));
|
|
35
|
+
}
|
|
36
|
+
return callNativeCapabilityBridge({
|
|
37
|
+
type: NATIVE_LOCAL_AUTHENTICATION_REQUEST_TYPE,
|
|
38
|
+
capability: 'local-authentication',
|
|
39
|
+
action: 'authenticate',
|
|
40
|
+
reason,
|
|
41
|
+
policy,
|
|
42
|
+
}, NATIVE_LOCAL_AUTHENTICATION_RESULT_TYPE, {
|
|
43
|
+
...bridgeOptions,
|
|
44
|
+
timeoutMs: bridgeOptions.timeoutMs ?? LOCAL_AUTHENTICATION_TIMEOUT_MS,
|
|
45
|
+
});
|
|
46
|
+
}
|