@moldable-ai/ui 0.2.21 → 0.2.24
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-coverage.d.ts +1 -1
- package/dist/catalog/catalog-manifest.d.ts +1 -1
- package/dist/catalog/catalog-manifest.js +1 -1
- package/dist/catalog/catalog-types.d.ts +7 -0
- package/dist/catalog/catalog-types.d.ts.map +1 -1
- package/dist/catalog/catalog-types.js +1 -0
- package/dist/catalog/component-catalog.d.ts +1 -1
- package/dist/catalog/component-catalog.js +2 -2
- package/dist/catalog/core-catalog-exclusions.d.ts +1 -1
- package/dist/catalog/core-catalog-exclusions.d.ts.map +1 -1
- package/dist/catalog/core-catalog-exclusions.js +1 -146
- package/dist/catalog/core-catalog.d.ts +1 -1
- package/dist/catalog/core-catalog.d.ts.map +1 -1
- package/dist/catalog/core-catalog.js +11 -7
- package/dist/catalog/core-collection-stories.d.ts +1 -1
- package/dist/catalog/core-collection-stories.d.ts.map +1 -1
- package/dist/catalog/core-collection-stories.js +41 -9
- package/dist/catalog/core-control-stories.d.ts +1 -1
- package/dist/catalog/core-control-stories.d.ts.map +1 -1
- package/dist/catalog/core-control-stories.js +53 -22
- package/dist/catalog/core-feedback-stories.d.ts +1 -1
- package/dist/catalog/core-feedback-stories.d.ts.map +1 -1
- package/dist/catalog/core-feedback-stories.js +89 -10
- package/dist/catalog/core-form-stories.d.ts +3 -0
- package/dist/catalog/core-form-stories.d.ts.map +1 -0
- package/dist/catalog/core-form-stories.js +56 -0
- package/dist/catalog/core-foundation-stories.d.ts +1 -1
- package/dist/catalog/core-foundation-stories.js +7 -7
- package/dist/catalog/core-layout-stories.d.ts +3 -0
- package/dist/catalog/core-layout-stories.d.ts.map +1 -0
- package/dist/catalog/core-layout-stories.js +78 -0
- package/dist/catalog/core-navigation-stories.d.ts +1 -1
- package/dist/catalog/core-navigation-stories.d.ts.map +1 -1
- package/dist/catalog/core-navigation-stories.js +25 -3
- package/dist/catalog/core-overlay-stories.d.ts +1 -1
- package/dist/catalog/core-overlay-stories.d.ts.map +1 -1
- package/dist/catalog/core-overlay-stories.js +113 -8
- package/dist/catalog/index.d.ts +6 -6
- package/dist/catalog/index.js +6 -6
- package/dist/components/app-error-boundary.d.ts.map +1 -1
- package/dist/components/app-error-boundary.js +4 -3
- package/dist/components/chat/chat-image-lightbox.js +3 -3
- package/dist/components/chat/chat-input.js +5 -5
- package/dist/components/chat/chat-message.js +17 -17
- package/dist/components/chat/chat-messages.d.ts +1 -1
- package/dist/components/chat/chat-messages.js +3 -3
- package/dist/components/chat/chat-panel.d.ts +6 -6
- package/dist/components/chat/chat-panel.d.ts.map +1 -1
- package/dist/components/chat/chat-panel.js +33 -33
- package/dist/components/chat/checkpoint-badge.js +3 -3
- package/dist/components/chat/conversation-history.d.ts.map +1 -1
- package/dist/components/chat/conversation-history.js +13 -13
- package/dist/components/chat/index.d.ts +20 -15
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +20 -15
- package/dist/components/chat/markdown.js +1 -1
- package/dist/components/chat/model-effort-selector.js +10 -10
- package/dist/components/chat/model-selector.js +4 -4
- package/dist/components/chat/reasoning-effort-selector.js +4 -4
- package/dist/components/chat/restore-dialog.js +3 -3
- package/dist/components/chat/thinking-timeline.js +2 -2
- package/dist/components/chat/tool-approval.d.ts +1 -1
- package/dist/components/chat/tool-approval.d.ts.map +1 -1
- package/dist/components/chat/tool-approval.js +9 -9
- package/dist/components/chat/tool-handlers.d.ts +2 -2
- package/dist/components/chat/tool-handlers.js +90 -90
- package/dist/components/chat/voice-orb-audio.d.ts +16 -0
- package/dist/components/chat/voice-orb-audio.d.ts.map +1 -0
- package/dist/components/chat/voice-orb-audio.js +110 -0
- package/dist/components/chat/voice-orb-renderer.d.ts +51 -0
- package/dist/components/chat/voice-orb-renderer.d.ts.map +1 -0
- package/dist/components/chat/voice-orb-renderer.js +410 -0
- package/dist/components/chat/voice-orb-shaders.d.ts +3 -0
- package/dist/components/chat/voice-orb-shaders.d.ts.map +1 -0
- package/dist/components/chat/voice-orb-shaders.js +355 -0
- package/dist/components/chat/voice-orb-types.d.ts +24 -0
- package/dist/components/chat/voice-orb-types.d.ts.map +1 -0
- package/dist/components/chat/voice-orb-types.js +73 -0
- package/dist/components/chat/voice-orb.d.ts +20 -0
- package/dist/components/chat/voice-orb.d.ts.map +1 -0
- package/dist/components/chat/voice-orb.js +67 -0
- package/dist/components/code-block.js +1 -1
- package/dist/components/hardware/bluetooth-panel.d.ts +2 -2
- package/dist/components/hardware/bluetooth-panel.js +10 -10
- package/dist/components/hardware/camera-preview.js +6 -6
- package/dist/components/hardware/capability-badge.d.ts +2 -2
- package/dist/components/hardware/capability-badge.js +2 -2
- package/dist/components/hardware/capability-matrix.d.ts +1 -1
- package/dist/components/hardware/capability-matrix.js +5 -5
- package/dist/components/hardware/clipboard-button.d.ts +1 -1
- package/dist/components/hardware/clipboard-button.js +2 -2
- package/dist/components/hardware/device-list.js +1 -1
- package/dist/components/hardware/display-map.d.ts +1 -1
- package/dist/components/hardware/display-map.js +7 -7
- package/dist/components/hardware/haptic-button.d.ts +2 -2
- package/dist/components/hardware/haptic-button.js +3 -3
- package/dist/components/hardware/hardware-panel.js +1 -1
- package/dist/components/hardware/hid-panel.d.ts +2 -2
- package/dist/components/hardware/hid-panel.js +10 -10
- package/dist/components/hardware/index.d.ts +26 -26
- package/dist/components/hardware/index.js +26 -26
- package/dist/components/hardware/live-indicator.js +1 -1
- package/dist/components/hardware/local-auth-button.d.ts +2 -2
- package/dist/components/hardware/local-auth-button.js +4 -4
- package/dist/components/hardware/location-panel.d.ts +1 -1
- package/dist/components/hardware/location-panel.js +6 -6
- package/dist/components/hardware/microphone-meter.js +7 -7
- package/dist/components/hardware/midi-monitor.d.ts +2 -2
- package/dist/components/hardware/midi-monitor.js +9 -9
- package/dist/components/hardware/notification-panel.d.ts +1 -1
- package/dist/components/hardware/notification-panel.js +8 -8
- package/dist/components/hardware/power-blocker-controller.d.ts +1 -1
- package/dist/components/hardware/power-blocker-controller.js +1 -1
- package/dist/components/hardware/power-panel.d.ts +1 -1
- package/dist/components/hardware/power-panel.js +9 -9
- package/dist/components/hardware/readout.js +1 -1
- package/dist/components/hardware/screen-share-preview.js +5 -5
- package/dist/components/hardware/secure-storage-panel.d.ts +1 -1
- package/dist/components/hardware/secure-storage-panel.js +9 -9
- package/dist/components/hardware/serial-console.d.ts +2 -2
- package/dist/components/hardware/serial-console.js +10 -10
- package/dist/components/hardware/shortcut-recorder.d.ts +1 -1
- package/dist/components/hardware/shortcut-recorder.js +4 -4
- package/dist/components/hardware/stream-log.js +1 -1
- package/dist/components/hardware/system-audio-monitor.d.ts +1 -1
- package/dist/components/hardware/system-audio-monitor.js +9 -9
- package/dist/components/hardware/usb-panel.d.ts +5 -5
- package/dist/components/hardware/usb-panel.js +10 -10
- package/dist/components/hardware/use-capability.d.ts +1 -1
- package/dist/components/hardware/use-capability.js +1 -1
- package/dist/components/markdown.js +5 -5
- package/dist/components/native-capabilities/bluetooth-panel.d.ts +2 -2
- package/dist/components/native-capabilities/bluetooth-panel.d.ts.map +1 -1
- package/dist/components/native-capabilities/bluetooth-panel.js +17 -17
- package/dist/components/native-capabilities/camera-preview.d.ts.map +1 -1
- package/dist/components/native-capabilities/camera-preview.js +7 -7
- package/dist/components/native-capabilities/capability-badge.d.ts +2 -2
- package/dist/components/native-capabilities/capability-badge.js +4 -4
- package/dist/components/native-capabilities/capability-matrix.d.ts +1 -1
- package/dist/components/native-capabilities/capability-matrix.js +7 -7
- package/dist/components/native-capabilities/clipboard-button.d.ts +1 -1
- package/dist/components/native-capabilities/clipboard-button.js +2 -2
- package/dist/components/native-capabilities/device-list.js +4 -4
- package/dist/components/native-capabilities/display-map.d.ts +1 -1
- package/dist/components/native-capabilities/display-map.d.ts.map +1 -1
- package/dist/components/native-capabilities/display-map.js +11 -11
- package/dist/components/native-capabilities/haptic-button.d.ts +2 -2
- package/dist/components/native-capabilities/haptic-button.js +3 -3
- package/dist/components/native-capabilities/hid-panel.d.ts +2 -2
- package/dist/components/native-capabilities/hid-panel.d.ts.map +1 -1
- package/dist/components/native-capabilities/hid-panel.js +14 -14
- package/dist/components/native-capabilities/index.d.ts +26 -26
- package/dist/components/native-capabilities/index.js +26 -26
- package/dist/components/native-capabilities/live-indicator.js +3 -3
- package/dist/components/native-capabilities/local-auth-button.d.ts +2 -2
- package/dist/components/native-capabilities/local-auth-button.js +4 -4
- package/dist/components/native-capabilities/location-panel.d.ts +1 -1
- package/dist/components/native-capabilities/location-panel.d.ts.map +1 -1
- package/dist/components/native-capabilities/location-panel.js +8 -8
- package/dist/components/native-capabilities/microphone-meter.js +9 -9
- package/dist/components/native-capabilities/midi-monitor.d.ts +2 -2
- package/dist/components/native-capabilities/midi-monitor.d.ts.map +1 -1
- package/dist/components/native-capabilities/midi-monitor.js +11 -11
- package/dist/components/native-capabilities/native-capability-panel.js +6 -6
- package/dist/components/native-capabilities/notification-panel.d.ts +1 -1
- package/dist/components/native-capabilities/notification-panel.js +9 -9
- package/dist/components/native-capabilities/power-blocker-controller.d.ts +1 -1
- package/dist/components/native-capabilities/power-blocker-controller.js +1 -1
- package/dist/components/native-capabilities/power-panel.d.ts +1 -1
- package/dist/components/native-capabilities/power-panel.d.ts.map +1 -1
- package/dist/components/native-capabilities/power-panel.js +12 -12
- package/dist/components/native-capabilities/readout.d.ts.map +1 -1
- package/dist/components/native-capabilities/readout.js +2 -2
- package/dist/components/native-capabilities/screen-share-preview.js +6 -6
- package/dist/components/native-capabilities/secure-storage-panel.d.ts +1 -1
- package/dist/components/native-capabilities/secure-storage-panel.d.ts.map +1 -1
- package/dist/components/native-capabilities/secure-storage-panel.js +11 -11
- package/dist/components/native-capabilities/serial-console.d.ts +2 -2
- package/dist/components/native-capabilities/serial-console.d.ts.map +1 -1
- package/dist/components/native-capabilities/serial-console.js +11 -11
- package/dist/components/native-capabilities/shortcut-recorder.d.ts +1 -1
- package/dist/components/native-capabilities/shortcut-recorder.js +5 -5
- package/dist/components/native-capabilities/stream-log.js +3 -3
- package/dist/components/native-capabilities/system-audio-monitor.d.ts +1 -1
- package/dist/components/native-capabilities/system-audio-monitor.js +12 -12
- package/dist/components/native-capabilities/usb-panel.d.ts +5 -5
- package/dist/components/native-capabilities/usb-panel.js +15 -15
- package/dist/components/native-capabilities/use-capability.d.ts +1 -1
- package/dist/components/native-capabilities/use-capability.js +1 -1
- package/dist/components/rich-media-player.js +3 -3
- package/dist/components/ui/accordion.js +3 -3
- package/dist/components/ui/alert-dialog.d.ts +5 -3
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +20 -10
- package/dist/components/ui/alert.d.ts +2 -2
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +11 -11
- package/dist/components/ui/app-frame.d.ts +7 -1
- package/dist/components/ui/app-frame.d.ts.map +1 -1
- package/dist/components/ui/app-frame.js +52 -16
- package/dist/components/ui/avatar.js +5 -5
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/badge.js +4 -4
- package/dist/components/ui/breadcrumb.js +2 -2
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button-group.js +4 -4
- package/dist/components/ui/button.d.ts +6 -4
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +50 -18
- package/dist/components/ui/calendar.d.ts +1 -1
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar.js +15 -15
- package/dist/components/ui/card.js +3 -3
- package/dist/components/ui/carousel.d.ts +1 -1
- package/dist/components/ui/carousel.js +4 -4
- package/dist/components/ui/chart.js +5 -5
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +2 -2
- package/dist/components/ui/collapsible.js +3 -3
- package/dist/components/ui/color-well.js +2 -2
- package/dist/components/ui/combobox.js +9 -9
- package/dist/components/ui/command.d.ts +1 -1
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +9 -9
- package/dist/components/ui/confirm-dialog.d.ts +1 -1
- package/dist/components/ui/confirm-dialog.d.ts.map +1 -1
- package/dist/components/ui/confirm-dialog.js +2 -2
- package/dist/components/ui/context-menu.d.ts +16 -5
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu.js +92 -16
- package/dist/components/ui/date-field.d.ts.map +1 -1
- package/dist/components/ui/date-field.js +8 -8
- package/dist/components/ui/date-picker.d.ts +2 -2
- package/dist/components/ui/date-picker.js +7 -7
- package/dist/components/ui/dialog-primary-action.d.ts +4 -0
- package/dist/components/ui/dialog-primary-action.d.ts.map +1 -0
- package/dist/components/ui/dialog-primary-action.js +37 -0
- package/dist/components/ui/dialog.d.ts +6 -2
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +20 -7
- package/dist/components/ui/drawer.js +4 -4
- package/dist/components/ui/dropdown-menu.d.ts +15 -5
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +98 -16
- package/dist/components/ui/edge-fade.js +1 -1
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/empty.js +5 -5
- package/dist/components/ui/error-boundary-view.d.ts +12 -0
- package/dist/components/ui/error-boundary-view.d.ts.map +1 -0
- package/dist/components/ui/error-boundary-view.js +8 -0
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.d.ts.map +1 -1
- package/dist/components/ui/field.js +9 -9
- package/dist/components/ui/form.js +4 -4
- package/dist/components/ui/grid.d.ts.map +1 -1
- package/dist/components/ui/grid.js +5 -5
- package/dist/components/ui/hover-card.js +2 -2
- package/dist/components/ui/icon-button.d.ts +1 -1
- package/dist/components/ui/icon-button.d.ts.map +1 -1
- package/dist/components/ui/icon-button.js +3 -4
- package/dist/components/ui/index.d.ts +77 -76
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +77 -76
- package/dist/components/ui/input-group.d.ts +3 -3
- package/dist/components/ui/input-group.js +14 -14
- package/dist/components/ui/input-otp.js +3 -3
- package/dist/components/ui/input.js +2 -2
- package/dist/components/ui/inspector.d.ts +1 -1
- package/dist/components/ui/inspector.js +6 -6
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/item.js +7 -7
- package/dist/components/ui/kbd.js +2 -2
- package/dist/components/ui/label.js +2 -2
- package/dist/components/ui/list.d.ts.map +1 -1
- package/dist/components/ui/list.js +5 -5
- package/dist/components/ui/material.js +3 -3
- package/dist/components/ui/menu-items.d.ts +28 -0
- package/dist/components/ui/menu-items.d.ts.map +1 -0
- package/dist/components/ui/menu-items.js +111 -0
- package/dist/components/ui/menubar.js +11 -11
- package/dist/components/ui/message-scroller-controller.d.ts +1 -1
- package/dist/components/ui/message-scroller-controller.js +1 -1
- package/dist/components/ui/message-scroller-primitive.d.ts +1 -1
- package/dist/components/ui/message-scroller-primitive.js +1 -1
- package/dist/components/ui/message-scroller.d.ts +2 -2
- package/dist/components/ui/message-scroller.js +3 -3
- package/dist/components/ui/navigation-button-group.d.ts +2 -2
- package/dist/components/ui/navigation-button-group.js +2 -2
- package/dist/components/ui/navigation-menu.js +6 -6
- package/dist/components/ui/notification-dot.js +2 -2
- package/dist/components/ui/number-input.js +8 -8
- package/dist/components/ui/pagination.d.ts +1 -1
- package/dist/components/ui/pagination.js +2 -2
- package/dist/components/ui/panel.d.ts +1 -1
- package/dist/components/ui/panel.js +3 -3
- package/dist/components/ui/popover.d.ts +1 -1
- package/dist/components/ui/popover.js +3 -3
- package/dist/components/ui/progress.js +2 -2
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group.js +2 -2
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable.js +15 -4
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +3 -3
- package/dist/components/ui/search-field.js +7 -7
- package/dist/components/ui/segmented-control.js +9 -9
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +6 -6
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/sheet.js +4 -4
- package/dist/components/ui/sidebar.d.ts +5 -5
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +111 -24
- package/dist/components/ui/skeleton.js +2 -2
- package/dist/components/ui/slider.d.ts +3 -1
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/slider.js +3 -3
- package/dist/components/ui/sonner.js +1 -1
- package/dist/components/ui/spinner.d.ts.map +1 -1
- package/dist/components/ui/spinner.js +2 -2
- package/dist/components/ui/split-view.js +1 -1
- package/dist/components/ui/status.d.ts +1 -1
- package/dist/components/ui/status.d.ts.map +1 -1
- package/dist/components/ui/status.js +10 -9
- package/dist/components/ui/switch.js +2 -2
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +7 -7
- package/dist/components/ui/tabs.js +3 -3
- package/dist/components/ui/text.d.ts +2 -2
- package/dist/components/ui/text.js +19 -19
- package/dist/components/ui/textarea.js +2 -2
- package/dist/components/ui/toggle-group.d.ts +1 -1
- package/dist/components/ui/toggle-group.js +4 -4
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/toggle.js +10 -10
- package/dist/components/ui/toolbar.d.ts +7 -7
- package/dist/components/ui/toolbar.js +7 -7
- package/dist/components/ui/tooltip.d.ts +2 -2
- package/dist/components/ui/tooltip.js +5 -5
- package/dist/index.d.ts +21 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -15
- package/dist/lib/frame-lifecycle.d.ts +49 -0
- package/dist/lib/frame-lifecycle.d.ts.map +1 -1
- package/dist/lib/frame-lifecycle.js +163 -1
- package/dist/lib/host-date-time-picker.d.ts +36 -0
- package/dist/lib/host-date-time-picker.d.ts.map +1 -0
- package/dist/lib/host-date-time-picker.js +162 -0
- package/dist/lib/host-file-dialog.d.ts +66 -0
- package/dist/lib/host-file-dialog.d.ts.map +1 -0
- package/dist/lib/host-file-dialog.js +221 -0
- package/dist/lib/host-native-menu.d.ts +116 -0
- package/dist/lib/host-native-menu.d.ts.map +1 -0
- package/dist/lib/host-native-menu.js +242 -0
- package/dist/lib/host-services.d.ts +13 -0
- package/dist/lib/host-services.d.ts.map +1 -0
- package/dist/lib/host-services.js +161 -0
- package/dist/lib/host-share.d.ts +39 -0
- package/dist/lib/host-share.d.ts.map +1 -0
- package/dist/lib/host-share.js +161 -0
- package/dist/lib/host-web-surface.d.ts +31 -0
- package/dist/lib/host-web-surface.d.ts.map +1 -0
- package/dist/lib/host-web-surface.js +116 -0
- package/dist/lib/native-capabilities/access.d.ts +2 -2
- package/dist/lib/native-capabilities/access.js +2 -2
- package/dist/lib/native-capabilities/bluetooth-access.d.ts +1 -1
- package/dist/lib/native-capabilities/bluetooth-access.js +2 -2
- package/dist/lib/native-capabilities/bluetooth-connection.d.ts +1 -1
- package/dist/lib/native-capabilities/bluetooth-connection.js +1 -1
- package/dist/lib/native-capabilities/bluetooth-gatt.d.ts +1 -1
- package/dist/lib/native-capabilities/bluetooth-gatt.js +1 -1
- package/dist/lib/native-capabilities/bluetooth-internal.d.ts +2 -2
- package/dist/lib/native-capabilities/bluetooth-internal.js +1 -1
- package/dist/lib/native-capabilities/bluetooth-native-fallback.d.ts +2 -2
- package/dist/lib/native-capabilities/bluetooth-native-fallback.js +2 -2
- package/dist/lib/native-capabilities/bluetooth.d.ts +6 -6
- package/dist/lib/native-capabilities/bluetooth.js +4 -4
- package/dist/lib/native-capabilities/bridge.d.ts +1 -1
- package/dist/lib/native-capabilities/bridge.js +2 -2
- package/dist/lib/native-capabilities/capabilities.d.ts +1 -1
- package/dist/lib/native-capabilities/capabilities.js +1 -1
- package/dist/lib/native-capabilities/clipboard.js +2 -2
- package/dist/lib/native-capabilities/device-io-errors.d.ts +1 -1
- package/dist/lib/native-capabilities/device-io-errors.js +1 -1
- package/dist/lib/native-capabilities/displays.d.ts +1 -1
- package/dist/lib/native-capabilities/displays.js +1 -1
- package/dist/lib/native-capabilities/global-shortcuts.d.ts +2 -2
- package/dist/lib/native-capabilities/global-shortcuts.js +1 -1
- package/dist/lib/native-capabilities/haptics.d.ts +1 -1
- package/dist/lib/native-capabilities/haptics.js +1 -1
- package/dist/lib/native-capabilities/hid-native.d.ts +2 -2
- package/dist/lib/native-capabilities/hid-native.js +3 -3
- package/dist/lib/native-capabilities/hid.js +5 -5
- package/dist/lib/native-capabilities/index.d.ts +39 -39
- package/dist/lib/native-capabilities/index.js +21 -21
- package/dist/lib/native-capabilities/local-authentication.d.ts +1 -1
- package/dist/lib/native-capabilities/local-authentication.js +1 -1
- package/dist/lib/native-capabilities/location.js +1 -1
- package/dist/lib/native-capabilities/media-permissions.d.ts +1 -1
- package/dist/lib/native-capabilities/media-permissions.js +1 -1
- package/dist/lib/native-capabilities/media.d.ts +1 -1
- package/dist/lib/native-capabilities/media.js +2 -2
- package/dist/lib/native-capabilities/midi-access.d.ts +1 -1
- package/dist/lib/native-capabilities/midi-access.js +3 -3
- package/dist/lib/native-capabilities/midi-internal.d.ts +1 -1
- package/dist/lib/native-capabilities/midi-internal.js +1 -1
- package/dist/lib/native-capabilities/midi-native-fallback.d.ts +1 -1
- package/dist/lib/native-capabilities/midi-native-fallback.js +2 -2
- package/dist/lib/native-capabilities/midi-ports.d.ts +1 -1
- package/dist/lib/native-capabilities/midi-ports.js +1 -1
- package/dist/lib/native-capabilities/midi.d.ts +5 -5
- package/dist/lib/native-capabilities/midi.js +3 -3
- package/dist/lib/native-capabilities/native-device-io.d.ts +1 -1
- package/dist/lib/native-capabilities/native-device-io.js +1 -1
- package/dist/lib/native-capabilities/native-device-lifecycle.js +1 -1
- package/dist/lib/native-capabilities/notifications.d.ts +2 -2
- package/dist/lib/native-capabilities/notifications.js +1 -1
- package/dist/lib/native-capabilities/power-session.d.ts +2 -2
- package/dist/lib/native-capabilities/power-session.js +1 -1
- package/dist/lib/native-capabilities/secure-storage.d.ts +1 -1
- package/dist/lib/native-capabilities/secure-storage.js +1 -1
- package/dist/lib/native-capabilities/serial-native.d.ts +2 -2
- package/dist/lib/native-capabilities/serial-native.js +3 -3
- package/dist/lib/native-capabilities/serial.js +5 -5
- package/dist/lib/native-capabilities/system-audio.d.ts +1 -1
- package/dist/lib/native-capabilities/system-audio.js +1 -1
- package/dist/lib/native-capabilities/usb-native.d.ts +2 -2
- package/dist/lib/native-capabilities/usb-native.js +3 -3
- package/dist/lib/native-capabilities/usb.js +5 -5
- package/dist/lib/native-hardware/bluetooth-access.d.ts +1 -1
- package/dist/lib/native-hardware/bluetooth-access.js +1 -1
- package/dist/lib/native-hardware/bluetooth-connection.d.ts +1 -1
- package/dist/lib/native-hardware/bluetooth-connection.js +1 -1
- package/dist/lib/native-hardware/bluetooth-gatt.d.ts +1 -1
- package/dist/lib/native-hardware/bluetooth-gatt.js +1 -1
- package/dist/lib/native-hardware/bluetooth-internal.d.ts +2 -2
- package/dist/lib/native-hardware/bluetooth-internal.js +1 -1
- package/dist/lib/native-hardware/bluetooth-native-fallback.d.ts +2 -2
- package/dist/lib/native-hardware/bluetooth-native-fallback.js +2 -2
- package/dist/lib/native-hardware/bluetooth.d.ts +6 -6
- package/dist/lib/native-hardware/bluetooth.js +4 -4
- package/dist/lib/native-hardware/bridge.d.ts +1 -1
- package/dist/lib/native-hardware/bridge.js +2 -2
- package/dist/lib/native-hardware/capabilities.d.ts +1 -1
- package/dist/lib/native-hardware/capabilities.js +1 -1
- package/dist/lib/native-hardware/clipboard.js +1 -1
- package/dist/lib/native-hardware/device-io-errors.d.ts +1 -1
- package/dist/lib/native-hardware/device-io-errors.js +1 -1
- package/dist/lib/native-hardware/displays.d.ts +1 -1
- package/dist/lib/native-hardware/displays.js +1 -1
- package/dist/lib/native-hardware/global-shortcuts.d.ts +2 -2
- package/dist/lib/native-hardware/global-shortcuts.js +1 -1
- package/dist/lib/native-hardware/haptics.d.ts +1 -1
- package/dist/lib/native-hardware/haptics.js +1 -1
- package/dist/lib/native-hardware/hid-native.d.ts +2 -2
- package/dist/lib/native-hardware/hid-native.js +3 -3
- package/dist/lib/native-hardware/hid.js +4 -4
- package/dist/lib/native-hardware/index.d.ts +37 -37
- package/dist/lib/native-hardware/index.js +20 -20
- package/dist/lib/native-hardware/local-authentication.d.ts +1 -1
- package/dist/lib/native-hardware/local-authentication.js +1 -1
- package/dist/lib/native-hardware/location.js +1 -1
- package/dist/lib/native-hardware/media-permissions.d.ts +1 -1
- package/dist/lib/native-hardware/media-permissions.js +1 -1
- package/dist/lib/native-hardware/media.d.ts +1 -1
- package/dist/lib/native-hardware/media.js +1 -1
- package/dist/lib/native-hardware/midi-access.d.ts +1 -1
- package/dist/lib/native-hardware/midi-access.js +2 -2
- package/dist/lib/native-hardware/midi-internal.d.ts +1 -1
- package/dist/lib/native-hardware/midi-internal.js +1 -1
- package/dist/lib/native-hardware/midi-native-fallback.d.ts +1 -1
- package/dist/lib/native-hardware/midi-native-fallback.js +2 -2
- package/dist/lib/native-hardware/midi-ports.d.ts +1 -1
- package/dist/lib/native-hardware/midi-ports.js +1 -1
- package/dist/lib/native-hardware/midi.d.ts +5 -5
- package/dist/lib/native-hardware/midi.js +3 -3
- package/dist/lib/native-hardware/native-device-io.d.ts +1 -1
- package/dist/lib/native-hardware/native-device-io.js +1 -1
- package/dist/lib/native-hardware/native-device-lifecycle.js +1 -1
- package/dist/lib/native-hardware/notifications.d.ts +2 -2
- package/dist/lib/native-hardware/notifications.js +1 -1
- package/dist/lib/native-hardware/power-session.d.ts +2 -2
- package/dist/lib/native-hardware/power-session.js +1 -1
- package/dist/lib/native-hardware/secure-storage.d.ts +1 -1
- package/dist/lib/native-hardware/secure-storage.js +1 -1
- package/dist/lib/native-hardware/serial-native.d.ts +2 -2
- package/dist/lib/native-hardware/serial-native.js +3 -3
- package/dist/lib/native-hardware/serial.js +4 -4
- package/dist/lib/native-hardware/system-audio.d.ts +1 -1
- package/dist/lib/native-hardware/system-audio.js +1 -1
- package/dist/lib/native-hardware/usb-native.d.ts +2 -2
- package/dist/lib/native-hardware/usb-native.js +3 -3
- package/dist/lib/native-hardware/usb.js +4 -4
- package/dist/lib/theme.js +1 -1
- package/docs/README.md +1 -0
- package/docs/design-tokens.md +28 -6
- package/docs/foundations.md +4 -2
- package/docs/visual-regression.md +78 -0
- package/package.json +15 -4
- package/src/components/ui/alert-dialog.md +27 -0
- package/src/components/ui/button.md +10 -3
- package/src/components/ui/confirm-dialog.md +97 -0
- package/src/components/ui/context-menu.md +158 -0
- package/src/components/ui/dialog.md +23 -4
- package/src/components/ui/dropdown-menu.md +165 -0
- package/src/components/ui/error-boundary-view.md +98 -0
- package/src/components/ui/hover-card.md +90 -0
- package/src/components/ui/select.md +111 -0
- package/src/lib/host-date-time-picker.md +29 -0
- package/src/lib/host-file-dialog.md +76 -0
- package/src/lib/host-native-menu.md +67 -0
- package/src/lib/host-share.md +36 -0
- package/src/lib/host-web-surface.md +66 -0
- package/src/styles/index.css +141 -68
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { getMoldableHostServices } from './frame-lifecycle.js';
|
|
2
|
+
const HOST_SERVICE_REQUEST_TYPE = 'moldable:service-request';
|
|
3
|
+
const HOST_SERVICE_RESPONSE_TYPE = 'moldable:service-response';
|
|
4
|
+
const HOST_SERVICE_CANCEL_TYPE = 'moldable:service-cancel';
|
|
5
|
+
const HOST_SERVICE_DEFAULT_TIMEOUT_MS = 15_000;
|
|
6
|
+
const HOST_SERVICE_CLIENT_TIMEOUT_GRACE_MS = 500;
|
|
7
|
+
export class HostServiceRequestError extends Error {
|
|
8
|
+
status;
|
|
9
|
+
code;
|
|
10
|
+
constructor(status, message, code) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'HostServiceRequestError';
|
|
13
|
+
this.status = status;
|
|
14
|
+
this.code = code;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const pendingRequests = new Map();
|
|
18
|
+
let responseListenerInstalled = false;
|
|
19
|
+
function isServiceResponse(value) {
|
|
20
|
+
if (typeof value !== 'object' ||
|
|
21
|
+
value === null ||
|
|
22
|
+
!('type' in value) ||
|
|
23
|
+
value.type !== HOST_SERVICE_RESPONSE_TYPE ||
|
|
24
|
+
!('requestId' in value) ||
|
|
25
|
+
typeof value.requestId !== 'string' ||
|
|
26
|
+
!('status' in value)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return (value.status === 'completed' ||
|
|
30
|
+
value.status === 'cancelled' ||
|
|
31
|
+
value.status === 'error' ||
|
|
32
|
+
value.status === 'timeout');
|
|
33
|
+
}
|
|
34
|
+
function removePending(requestId) {
|
|
35
|
+
const pending = pendingRequests.get(requestId);
|
|
36
|
+
if (!pending)
|
|
37
|
+
return null;
|
|
38
|
+
pendingRequests.delete(requestId);
|
|
39
|
+
window.clearTimeout(pending.timeoutId);
|
|
40
|
+
if (pending.signal && pending.abortHandler) {
|
|
41
|
+
pending.signal.removeEventListener('abort', pending.abortHandler);
|
|
42
|
+
}
|
|
43
|
+
return pending;
|
|
44
|
+
}
|
|
45
|
+
function responseError(response, status) {
|
|
46
|
+
const code = typeof response.error === 'object' &&
|
|
47
|
+
response.error !== null &&
|
|
48
|
+
typeof response.error.code === 'string'
|
|
49
|
+
? response.error.code
|
|
50
|
+
: undefined;
|
|
51
|
+
const message = typeof response.error === 'string'
|
|
52
|
+
? response.error
|
|
53
|
+
: typeof response.error === 'object' &&
|
|
54
|
+
response.error !== null &&
|
|
55
|
+
typeof response.error.message === 'string'
|
|
56
|
+
? response.error.message
|
|
57
|
+
: status === 'cancelled'
|
|
58
|
+
? 'The host service request was cancelled.'
|
|
59
|
+
: status === 'timeout'
|
|
60
|
+
? 'The host service request timed out.'
|
|
61
|
+
: 'The host service request failed.';
|
|
62
|
+
return new HostServiceRequestError(status, message, code);
|
|
63
|
+
}
|
|
64
|
+
function installResponseListener() {
|
|
65
|
+
if (responseListenerInstalled || typeof window === 'undefined')
|
|
66
|
+
return;
|
|
67
|
+
responseListenerInstalled = true;
|
|
68
|
+
window.addEventListener('message', (event) => {
|
|
69
|
+
if (event.source !== window.parent || !isServiceResponse(event.data)) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const pending = removePending(event.data.requestId);
|
|
73
|
+
if (!pending)
|
|
74
|
+
return;
|
|
75
|
+
if (event.data.status === 'completed') {
|
|
76
|
+
pending.resolve(event.data.result);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
pending.reject(responseError(event.data, event.data.status));
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function createRequestId() {
|
|
84
|
+
if (typeof globalThis.crypto !== 'undefined' &&
|
|
85
|
+
typeof globalThis.crypto.randomUUID === 'function') {
|
|
86
|
+
return globalThis.crypto.randomUUID();
|
|
87
|
+
}
|
|
88
|
+
return `host-service-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
89
|
+
}
|
|
90
|
+
function abortError() {
|
|
91
|
+
return new DOMException('The host service request was aborted.', 'AbortError');
|
|
92
|
+
}
|
|
93
|
+
function postCancel(requestId) {
|
|
94
|
+
window.parent.postMessage({
|
|
95
|
+
type: HOST_SERVICE_CANCEL_TYPE,
|
|
96
|
+
requestId,
|
|
97
|
+
}, '*');
|
|
98
|
+
}
|
|
99
|
+
export function isHostServiceAvailable(name) {
|
|
100
|
+
const advertisement = getMoldableHostServices();
|
|
101
|
+
return Boolean(advertisement &&
|
|
102
|
+
Object.prototype.hasOwnProperty.call(advertisement.services, name));
|
|
103
|
+
}
|
|
104
|
+
export function requestHostService(name, payload, options = {}) {
|
|
105
|
+
if (typeof window === 'undefined' || !isHostServiceAvailable(name)) {
|
|
106
|
+
return Promise.reject(new HostServiceRequestError('error', `Host service "${name}" is not available.`, 'service_not_available'));
|
|
107
|
+
}
|
|
108
|
+
if (options.signal?.aborted) {
|
|
109
|
+
return Promise.reject(abortError());
|
|
110
|
+
}
|
|
111
|
+
if (options.timeoutMs !== undefined &&
|
|
112
|
+
(!Number.isFinite(options.timeoutMs) || options.timeoutMs <= 0)) {
|
|
113
|
+
return Promise.reject(new TypeError('timeoutMs must be a positive finite number.'));
|
|
114
|
+
}
|
|
115
|
+
installResponseListener();
|
|
116
|
+
const requestId = createRequestId();
|
|
117
|
+
const hostTimeoutMs = Math.min(HOST_SERVICE_DEFAULT_TIMEOUT_MS, options.timeoutMs ?? HOST_SERVICE_DEFAULT_TIMEOUT_MS);
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
const timeoutId = window.setTimeout(() => {
|
|
120
|
+
const pending = removePending(requestId);
|
|
121
|
+
if (!pending)
|
|
122
|
+
return;
|
|
123
|
+
postCancel(requestId);
|
|
124
|
+
pending.reject(new HostServiceRequestError('timeout', 'The host service response did not arrive before the client timeout.', 'client_timeout'));
|
|
125
|
+
}, hostTimeoutMs + HOST_SERVICE_CLIENT_TIMEOUT_GRACE_MS);
|
|
126
|
+
const pending = {
|
|
127
|
+
resolve: (value) => resolve(value),
|
|
128
|
+
reject,
|
|
129
|
+
timeoutId,
|
|
130
|
+
signal: options.signal,
|
|
131
|
+
};
|
|
132
|
+
if (options.signal) {
|
|
133
|
+
pending.abortHandler = () => {
|
|
134
|
+
const active = removePending(requestId);
|
|
135
|
+
if (!active)
|
|
136
|
+
return;
|
|
137
|
+
postCancel(requestId);
|
|
138
|
+
active.reject(abortError());
|
|
139
|
+
};
|
|
140
|
+
options.signal.addEventListener('abort', pending.abortHandler, {
|
|
141
|
+
once: true,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
pendingRequests.set(requestId, pending);
|
|
145
|
+
try {
|
|
146
|
+
window.parent.postMessage({
|
|
147
|
+
type: HOST_SERVICE_REQUEST_TYPE,
|
|
148
|
+
service: name,
|
|
149
|
+
requestId,
|
|
150
|
+
payload,
|
|
151
|
+
...(options.timeoutMs === undefined
|
|
152
|
+
? {}
|
|
153
|
+
: { timeoutMs: options.timeoutMs }),
|
|
154
|
+
}, '*');
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
removePending(requestId);
|
|
158
|
+
reject(error);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type HostServiceRequestOptions } from './host-services.js';
|
|
2
|
+
export type HostShareItem = {
|
|
3
|
+
kind: 'text';
|
|
4
|
+
text: string;
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'url';
|
|
7
|
+
url: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'fileReference';
|
|
10
|
+
path: string;
|
|
11
|
+
};
|
|
12
|
+
export interface HostShareAnchorRect {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}
|
|
18
|
+
export interface HostShareOptions extends HostServiceRequestOptions {
|
|
19
|
+
anchor?: Element | HostShareAnchorRect;
|
|
20
|
+
}
|
|
21
|
+
export type HostShareResult = {
|
|
22
|
+
status: 'completed';
|
|
23
|
+
method: 'native' | 'web';
|
|
24
|
+
} | {
|
|
25
|
+
status: 'cancelled';
|
|
26
|
+
method: 'native' | 'web';
|
|
27
|
+
} | {
|
|
28
|
+
status: 'fallback';
|
|
29
|
+
method: 'portable';
|
|
30
|
+
items: HostShareItem[];
|
|
31
|
+
reason: 'web_share_unavailable' | 'file_references_unsupported';
|
|
32
|
+
};
|
|
33
|
+
export interface HostShare {
|
|
34
|
+
available: boolean;
|
|
35
|
+
share: (items: HostShareItem[], options?: HostShareOptions) => Promise<HostShareResult>;
|
|
36
|
+
}
|
|
37
|
+
export declare function shareWithHost(items: HostShareItem[], options?: HostShareOptions): Promise<HostShareResult>;
|
|
38
|
+
export declare function useHostShare(): HostShare;
|
|
39
|
+
//# sourceMappingURL=host-share.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-share.d.ts","sourceRoot":"","sources":["../../src/lib/host-share.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,iBAAiB,CAAA;AAOxB,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC5B;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3C,MAAM,WAAW,mBAAmB;IAClC,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,gBAAiB,SAAQ,yBAAyB;IACjE,MAAM,CAAC,EAAE,OAAO,GAAG,mBAAmB,CAAA;CACvC;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,KAAK,CAAA;CAAE,GACjD;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,KAAK,CAAA;CAAE,GACjD;IACE,MAAM,EAAE,UAAU,CAAA;IAClB,MAAM,EAAE,UAAU,CAAA;IAClB,KAAK,EAAE,aAAa,EAAE,CAAA;IACtB,MAAM,EAAE,uBAAuB,GAAG,6BAA6B,CAAA;CAChE,CAAA;AAML,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,CACL,KAAK,EAAE,aAAa,EAAE,EACtB,OAAO,CAAC,EAAE,gBAAgB,KACvB,OAAO,CAAC,eAAe,CAAC,CAAA;CAC9B;AA2HD,wBAAsB,aAAa,CACjC,KAAK,EAAE,aAAa,EAAE,EACtB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAuD1B;AAED,wBAAgB,YAAY,IAAI,SAAS,CAoBxC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { HostServiceRequestError, isHostServiceAvailable, requestHostService, } from './host-services.js';
|
|
3
|
+
const HOST_CONTEXT_CHANGE_EVENT = 'moldable:host-context-change';
|
|
4
|
+
const SHARE_SERVICE_NAME = 'share';
|
|
5
|
+
const MAX_SHARE_ITEMS = 64;
|
|
6
|
+
const MAX_SHARE_ITEM_LENGTH = 256 * 1024;
|
|
7
|
+
function isAllowedShareUrl(value) {
|
|
8
|
+
try {
|
|
9
|
+
const protocol = new URL(value).protocol;
|
|
10
|
+
return (protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:');
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function validateItems(items) {
|
|
17
|
+
if (!Array.isArray(items) ||
|
|
18
|
+
items.length === 0 ||
|
|
19
|
+
items.length > MAX_SHARE_ITEMS) {
|
|
20
|
+
throw new TypeError('Share requests require 1–64 items.');
|
|
21
|
+
}
|
|
22
|
+
for (const item of items) {
|
|
23
|
+
if (!item || typeof item !== 'object') {
|
|
24
|
+
throw new TypeError('Share items must be objects.');
|
|
25
|
+
}
|
|
26
|
+
if (item.kind === 'text' &&
|
|
27
|
+
(typeof item.text !== 'string' ||
|
|
28
|
+
item.text.length === 0 ||
|
|
29
|
+
item.text.length > MAX_SHARE_ITEM_LENGTH)) {
|
|
30
|
+
throw new TypeError('Text share items require non-empty text.');
|
|
31
|
+
}
|
|
32
|
+
if (item.kind === 'url' &&
|
|
33
|
+
(typeof item.url !== 'string' ||
|
|
34
|
+
item.url.length > MAX_SHARE_ITEM_LENGTH ||
|
|
35
|
+
!isAllowedShareUrl(item.url))) {
|
|
36
|
+
throw new TypeError('URL share items must use http, https, or mailto.');
|
|
37
|
+
}
|
|
38
|
+
if (item.kind === 'fileReference' &&
|
|
39
|
+
(typeof item.path !== 'string' ||
|
|
40
|
+
item.path.length === 0 ||
|
|
41
|
+
item.path.length > MAX_SHARE_ITEM_LENGTH ||
|
|
42
|
+
item.path.includes('\0') ||
|
|
43
|
+
item.path.split(/[\\/]/).includes('..'))) {
|
|
44
|
+
throw new TypeError('File-reference share items require a non-traversing path.');
|
|
45
|
+
}
|
|
46
|
+
if (item.kind !== 'text' &&
|
|
47
|
+
item.kind !== 'url' &&
|
|
48
|
+
item.kind !== 'fileReference') {
|
|
49
|
+
throw new TypeError('Share items contain an unsupported kind.');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function anchorRect(anchor) {
|
|
54
|
+
if (!anchor)
|
|
55
|
+
return undefined;
|
|
56
|
+
const rect = typeof Element !== 'undefined' && anchor instanceof Element
|
|
57
|
+
? anchor.getBoundingClientRect()
|
|
58
|
+
: anchor;
|
|
59
|
+
if (!Number.isFinite(rect.x) ||
|
|
60
|
+
!Number.isFinite(rect.y) ||
|
|
61
|
+
!Number.isFinite(rect.width) ||
|
|
62
|
+
!Number.isFinite(rect.height) ||
|
|
63
|
+
rect.width < 0 ||
|
|
64
|
+
rect.height < 0) {
|
|
65
|
+
throw new TypeError('Share anchors require a finite, non-negative rect.');
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
x: rect.x,
|
|
69
|
+
y: rect.y,
|
|
70
|
+
width: rect.width,
|
|
71
|
+
height: rect.height,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function webShareData(items) {
|
|
75
|
+
if (items.some((item) => item.kind === 'fileReference'))
|
|
76
|
+
return null;
|
|
77
|
+
const textParts = [];
|
|
78
|
+
let url;
|
|
79
|
+
for (const item of items) {
|
|
80
|
+
if (item.kind === 'text') {
|
|
81
|
+
textParts.push(item.text);
|
|
82
|
+
}
|
|
83
|
+
else if (item.kind === 'url' && !url) {
|
|
84
|
+
url = item.url;
|
|
85
|
+
}
|
|
86
|
+
else if (item.kind === 'url') {
|
|
87
|
+
textParts.push(item.url);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
...(textParts.length > 0 ? { text: textParts.join('\n') } : {}),
|
|
92
|
+
...(url ? { url } : {}),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function abortError() {
|
|
96
|
+
return new DOMException('The share request was aborted.', 'AbortError');
|
|
97
|
+
}
|
|
98
|
+
function isCancelledError(error) {
|
|
99
|
+
return ((error instanceof HostServiceRequestError &&
|
|
100
|
+
error.status === 'cancelled') ||
|
|
101
|
+
(error instanceof DOMException && error.name === 'AbortError'));
|
|
102
|
+
}
|
|
103
|
+
export async function shareWithHost(items, options = {}) {
|
|
104
|
+
validateItems(items);
|
|
105
|
+
if (options.signal?.aborted)
|
|
106
|
+
throw abortError();
|
|
107
|
+
if (isHostServiceAvailable(SHARE_SERVICE_NAME)) {
|
|
108
|
+
try {
|
|
109
|
+
const result = await requestHostService(SHARE_SERVICE_NAME, {
|
|
110
|
+
items,
|
|
111
|
+
...(options.anchor ? { anchor: anchorRect(options.anchor) } : {}),
|
|
112
|
+
}, {
|
|
113
|
+
signal: options.signal,
|
|
114
|
+
timeoutMs: options.timeoutMs,
|
|
115
|
+
});
|
|
116
|
+
if (result?.status !== 'completed') {
|
|
117
|
+
throw new Error('The native share service returned an invalid result.');
|
|
118
|
+
}
|
|
119
|
+
return { status: 'completed', method: 'native' };
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
if (error instanceof HostServiceRequestError &&
|
|
123
|
+
error.status === 'cancelled') {
|
|
124
|
+
return { status: 'cancelled', method: 'native' };
|
|
125
|
+
}
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const shareData = webShareData(items);
|
|
130
|
+
if (shareData &&
|
|
131
|
+
typeof navigator !== 'undefined' &&
|
|
132
|
+
typeof navigator.share === 'function') {
|
|
133
|
+
try {
|
|
134
|
+
await navigator.share(shareData);
|
|
135
|
+
return { status: 'completed', method: 'web' };
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
if (isCancelledError(error)) {
|
|
139
|
+
return { status: 'cancelled', method: 'web' };
|
|
140
|
+
}
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
status: 'fallback',
|
|
146
|
+
method: 'portable',
|
|
147
|
+
items,
|
|
148
|
+
reason: shareData ? 'web_share_unavailable' : 'file_references_unsupported',
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export function useHostShare() {
|
|
152
|
+
const [available, setAvailable] = useState(() => isHostServiceAvailable(SHARE_SERVICE_NAME));
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
const update = () => setAvailable(isHostServiceAvailable(SHARE_SERVICE_NAME));
|
|
155
|
+
update();
|
|
156
|
+
window.addEventListener(HOST_CONTEXT_CHANGE_EVENT, update);
|
|
157
|
+
return () => window.removeEventListener(HOST_CONTEXT_CHANGE_EVENT, update);
|
|
158
|
+
}, []);
|
|
159
|
+
const share = useCallback((items, options) => shareWithHost(items, options), []);
|
|
160
|
+
return { available, share };
|
|
161
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type HostServiceRequestOptions } from './host-services.js';
|
|
2
|
+
export interface HostWebSurfaceBounds {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export interface HostWebSurfaceNavigationState {
|
|
9
|
+
surfaceId: string;
|
|
10
|
+
url: string;
|
|
11
|
+
title: string;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
canGoBack: boolean;
|
|
14
|
+
canGoForward: boolean;
|
|
15
|
+
faviconUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
export type HostWebSurfaceNavigationSubscriber = (state: HostWebSurfaceNavigationState) => void;
|
|
18
|
+
export interface HostWebSurface {
|
|
19
|
+
available: boolean;
|
|
20
|
+
create: (surfaceId: string, url: string, bounds: HostWebSurfaceBounds, options?: HostServiceRequestOptions) => Promise<void>;
|
|
21
|
+
navigate: (surfaceId: string, url: string, options?: HostServiceRequestOptions) => Promise<void>;
|
|
22
|
+
reload: (surfaceId: string, options?: HostServiceRequestOptions) => Promise<void>;
|
|
23
|
+
goBack: (surfaceId: string, options?: HostServiceRequestOptions) => Promise<void>;
|
|
24
|
+
goForward: (surfaceId: string, options?: HostServiceRequestOptions) => Promise<void>;
|
|
25
|
+
setBounds: (surfaceId: string, bounds: HostWebSurfaceBounds, options?: HostServiceRequestOptions) => Promise<void>;
|
|
26
|
+
setVisible: (surfaceId: string, visible: boolean, options?: HostServiceRequestOptions) => Promise<void>;
|
|
27
|
+
destroy: (surfaceId: string, options?: HostServiceRequestOptions) => Promise<void>;
|
|
28
|
+
onNavState: (subscribe: HostWebSurfaceNavigationSubscriber) => () => void;
|
|
29
|
+
}
|
|
30
|
+
export declare function useHostWebSurface(): HostWebSurface;
|
|
31
|
+
//# sourceMappingURL=host-web-surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-web-surface.d.ts","sourceRoot":"","sources":["../../src/lib/host-web-surface.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,yBAAyB,EAG/B,MAAM,iBAAiB,CAAA;AAQxB,MAAM,WAAW,oBAAoB;IACnC,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,6BAA6B;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,OAAO,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,kCAAkC,GAAG,CAC/C,KAAK,EAAE,6BAA6B,KACjC,IAAI,CAAA;AAET,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAA;IAClB,MAAM,EAAE,CACN,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE,yBAAyB,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,QAAQ,EAAE,CACR,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,yBAAyB,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,MAAM,EAAE,CACN,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,yBAAyB,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,MAAM,EAAE,CACN,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,yBAAyB,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,SAAS,EAAE,CACT,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,yBAAyB,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,SAAS,EAAE,CACT,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE,yBAAyB,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,UAAU,EAAE,CACV,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,yBAAyB,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,OAAO,EAAE,CACP,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,yBAAyB,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,UAAU,EAAE,CAAC,SAAS,EAAE,kCAAkC,KAAK,MAAM,IAAI,CAAA;CAC1E;AAmID,wBAAgB,iBAAiB,IAAI,cAAc,CAmElD"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { isHostServiceAvailable, requestHostService, } from './host-services.js';
|
|
3
|
+
const HOST_CONTEXT_CHANGE_EVENT = 'moldable:host-context-change';
|
|
4
|
+
const HOST_SERVICE_EVENT_TYPE = 'moldable:service-event';
|
|
5
|
+
const WEB_SURFACE_SERVICE_NAME = 'webSurface';
|
|
6
|
+
const SURFACE_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
7
|
+
const MAX_URL_LENGTH = 4096;
|
|
8
|
+
function isRecord(value) {
|
|
9
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
10
|
+
}
|
|
11
|
+
function validateSurfaceId(surfaceId) {
|
|
12
|
+
if (!SURFACE_ID.test(surfaceId)) {
|
|
13
|
+
throw new TypeError('surfaceId must be 1–64 ASCII letters, numbers, underscores, or hyphens.');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function validateUrl(url) {
|
|
17
|
+
if (typeof url !== 'string' ||
|
|
18
|
+
url.length === 0 ||
|
|
19
|
+
url.length > MAX_URL_LENGTH) {
|
|
20
|
+
throw new TypeError('Web-surface URLs must be 1–4096 characters.');
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const protocol = new URL(url).protocol;
|
|
24
|
+
if (protocol !== 'http:' && protocol !== 'https:')
|
|
25
|
+
throw new Error();
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
throw new TypeError('Web-surface URLs must be valid http or https URLs.');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function validateBounds(bounds) {
|
|
32
|
+
if (!bounds ||
|
|
33
|
+
!Number.isFinite(bounds.x) ||
|
|
34
|
+
!Number.isFinite(bounds.y) ||
|
|
35
|
+
!Number.isFinite(bounds.width) ||
|
|
36
|
+
!Number.isFinite(bounds.height) ||
|
|
37
|
+
bounds.width < 0 ||
|
|
38
|
+
bounds.height < 0) {
|
|
39
|
+
throw new TypeError('Web-surface bounds require finite coordinates and non-negative dimensions.');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function validatePayload(payload) {
|
|
43
|
+
validateSurfaceId(payload.surfaceId);
|
|
44
|
+
if (payload.method === 'create' || payload.method === 'navigate') {
|
|
45
|
+
validateUrl(payload.url);
|
|
46
|
+
}
|
|
47
|
+
if (payload.method === 'create' || payload.method === 'setBounds') {
|
|
48
|
+
validateBounds(payload.bounds);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function requestWebSurface(payload, options) {
|
|
52
|
+
validatePayload(payload);
|
|
53
|
+
const result = await requestHostService(WEB_SURFACE_SERVICE_NAME, payload, options);
|
|
54
|
+
if (result?.status !== 'completed') {
|
|
55
|
+
throw new Error('The host web-surface service returned an invalid result.');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function isNavigationState(value) {
|
|
59
|
+
return (isRecord(value) &&
|
|
60
|
+
typeof value.surfaceId === 'string' &&
|
|
61
|
+
SURFACE_ID.test(value.surfaceId) &&
|
|
62
|
+
typeof value.url === 'string' &&
|
|
63
|
+
value.url.length <= MAX_URL_LENGTH &&
|
|
64
|
+
typeof value.title === 'string' &&
|
|
65
|
+
typeof value.loading === 'boolean' &&
|
|
66
|
+
typeof value.canGoBack === 'boolean' &&
|
|
67
|
+
typeof value.canGoForward === 'boolean' &&
|
|
68
|
+
(value.faviconUrl === undefined || typeof value.faviconUrl === 'string'));
|
|
69
|
+
}
|
|
70
|
+
function subscribeToNavigationState(subscribe) {
|
|
71
|
+
if (typeof window === 'undefined')
|
|
72
|
+
return () => undefined;
|
|
73
|
+
const handler = (event) => {
|
|
74
|
+
if (event.source !== window.parent || !isRecord(event.data))
|
|
75
|
+
return;
|
|
76
|
+
if (event.data.type !== HOST_SERVICE_EVENT_TYPE ||
|
|
77
|
+
event.data.service !== WEB_SURFACE_SERVICE_NAME ||
|
|
78
|
+
event.data.event !== 'navigationState' ||
|
|
79
|
+
!isNavigationState(event.data.payload)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
subscribe(event.data.payload);
|
|
83
|
+
};
|
|
84
|
+
window.addEventListener('message', handler);
|
|
85
|
+
return () => window.removeEventListener('message', handler);
|
|
86
|
+
}
|
|
87
|
+
export function useHostWebSurface() {
|
|
88
|
+
const [available, setAvailable] = useState(() => isHostServiceAvailable(WEB_SURFACE_SERVICE_NAME));
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
const update = () => setAvailable(isHostServiceAvailable(WEB_SURFACE_SERVICE_NAME));
|
|
91
|
+
update();
|
|
92
|
+
window.addEventListener(HOST_CONTEXT_CHANGE_EVENT, update);
|
|
93
|
+
return () => window.removeEventListener(HOST_CONTEXT_CHANGE_EVENT, update);
|
|
94
|
+
}, []);
|
|
95
|
+
const create = useCallback((surfaceId, url, bounds, options) => requestWebSurface({ method: 'create', surfaceId, url, bounds }, options), []);
|
|
96
|
+
const navigate = useCallback((surfaceId, url, options) => requestWebSurface({ method: 'navigate', surfaceId, url }, options), []);
|
|
97
|
+
const reload = useCallback((surfaceId, options) => requestWebSurface({ method: 'reload', surfaceId }, options), []);
|
|
98
|
+
const goBack = useCallback((surfaceId, options) => requestWebSurface({ method: 'goBack', surfaceId }, options), []);
|
|
99
|
+
const goForward = useCallback((surfaceId, options) => requestWebSurface({ method: 'goForward', surfaceId }, options), []);
|
|
100
|
+
const setBounds = useCallback((surfaceId, bounds, options) => requestWebSurface({ method: 'setBounds', surfaceId, bounds }, options), []);
|
|
101
|
+
const setVisible = useCallback((surfaceId, visible, options) => requestWebSurface({ method: 'setVisible', surfaceId, visible }, options), []);
|
|
102
|
+
const destroy = useCallback((surfaceId, options) => requestWebSurface({ method: 'destroy', surfaceId }, options), []);
|
|
103
|
+
const onNavState = useCallback(subscribeToNavigationState, []);
|
|
104
|
+
return {
|
|
105
|
+
available,
|
|
106
|
+
create,
|
|
107
|
+
navigate,
|
|
108
|
+
reload,
|
|
109
|
+
goBack,
|
|
110
|
+
goForward,
|
|
111
|
+
setBounds,
|
|
112
|
+
setVisible,
|
|
113
|
+
destroy,
|
|
114
|
+
onNavState,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type NativeCapabilityBridgeOptions } from './bridge';
|
|
2
|
-
import type { NativeCapabilityId } from './types';
|
|
1
|
+
import { type NativeCapabilityBridgeOptions } from './bridge.js';
|
|
2
|
+
import type { NativeCapabilityId } from './types.js';
|
|
3
3
|
export declare const NATIVE_CAPABILITY_ACCESS_REQUEST_TYPE: "moldable:native-capabilities-access-request";
|
|
4
4
|
export declare const NATIVE_CAPABILITY_ACCESS_RESULT_TYPE: "moldable:native-capabilities-access-result";
|
|
5
5
|
export interface MoldableNativeCapabilityAccessState {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NativeCapabilityBridgeError, callNativeCapabilityBridge, } from './bridge';
|
|
2
|
-
import { isNativeCapabilityId } from './capabilities';
|
|
1
|
+
import { NativeCapabilityBridgeError, callNativeCapabilityBridge, } from './bridge.js';
|
|
2
|
+
import { isNativeCapabilityId } from './capabilities.js';
|
|
3
3
|
export const NATIVE_CAPABILITY_ACCESS_REQUEST_TYPE = 'moldable:native-capabilities-access-request';
|
|
4
4
|
export const NATIVE_CAPABILITY_ACCESS_RESULT_TYPE = 'moldable:native-capabilities-access-result';
|
|
5
5
|
function isEmbedded() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MoldableBluetoothAvailability, MoldableBluetoothDevice, MoldableBluetoothOperationOptions, MoldableBluetoothRequestDeviceOptions, MoldableBluetoothRequestOptions } from './bluetooth-types';
|
|
1
|
+
import type { MoldableBluetoothAvailability, MoldableBluetoothDevice, MoldableBluetoothOperationOptions, MoldableBluetoothRequestDeviceOptions, MoldableBluetoothRequestOptions } from './bluetooth-types.js';
|
|
2
2
|
/** Checks only for the standards-based Web Bluetooth entry point. */
|
|
3
3
|
export declare function isMoldableBluetoothSupported(): boolean;
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { assertMoldableNativeCapabilityAccess, requireMoldableNativeCapabilityAccess, } from './access';
|
|
2
|
-
import { abortableBluetooth, assertBluetoothUserGesture, bluetoothError, getBluetoothAPI, getBluetoothNavigator, validateBluetoothRequestOptions, } from './bluetooth-internal';
|
|
1
|
+
import { assertMoldableNativeCapabilityAccess, requireMoldableNativeCapabilityAccess, } from './access.js';
|
|
2
|
+
import { abortableBluetooth, assertBluetoothUserGesture, bluetoothError, getBluetoothAPI, getBluetoothNavigator, validateBluetoothRequestOptions, } from './bluetooth-internal.js';
|
|
3
3
|
/** Checks only for the standards-based Web Bluetooth entry point. */
|
|
4
4
|
export function isMoldableBluetoothSupported() {
|
|
5
5
|
const api = getBluetoothNavigator()?.bluetooth;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MoldableBluetoothConnectionOptions, MoldableBluetoothDevice, MoldableBluetoothOperationOptions, MoldableBluetoothRemoteGATTServer, MoldableBluetoothRemoteGATTService, MoldableBluetoothUUID } from './bluetooth-types';
|
|
1
|
+
import type { MoldableBluetoothConnectionOptions, MoldableBluetoothDevice, MoldableBluetoothOperationOptions, MoldableBluetoothRemoteGATTServer, MoldableBluetoothRemoteGATTService, MoldableBluetoothUUID } from './bluetooth-types.js';
|
|
2
2
|
export declare class MoldableBluetoothConnection {
|
|
3
3
|
readonly device: MoldableBluetoothDevice;
|
|
4
4
|
readonly server: MoldableBluetoothRemoteGATTServer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MoldableBluetoothOperationOptions, MoldableBluetoothRemoteGATTCharacteristic, MoldableBluetoothRemoteGATTService, MoldableBluetoothUUID, MoldableBluetoothWriteMode } from './bluetooth-types';
|
|
1
|
+
import type { MoldableBluetoothOperationOptions, MoldableBluetoothRemoteGATTCharacteristic, MoldableBluetoothRemoteGATTService, MoldableBluetoothUUID, MoldableBluetoothWriteMode } from './bluetooth-types.js';
|
|
2
2
|
export declare function getMoldableBluetoothCharacteristic(service: MoldableBluetoothRemoteGATTService, characteristic: MoldableBluetoothUUID, options?: MoldableBluetoothOperationOptions): Promise<MoldableBluetoothRemoteGATTCharacteristic>;
|
|
3
3
|
export declare function readMoldableBluetoothValue(characteristic: MoldableBluetoothRemoteGATTCharacteristic, options?: MoldableBluetoothOperationOptions): Promise<DataView>;
|
|
4
4
|
/** Starts notifications and returns async, idempotent subscription cleanup. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { abortableBluetooth, bluetoothAborted, bluetoothError, } from './bluetooth-internal';
|
|
1
|
+
import { abortableBluetooth, bluetoothAborted, bluetoothError, } from './bluetooth-internal.js';
|
|
2
2
|
export async function getMoldableBluetoothCharacteristic(service, characteristic, options = {}) {
|
|
3
3
|
const operation = `get Bluetooth characteristic ${String(characteristic)}`;
|
|
4
4
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MoldableBluetoothAPI, MoldableBluetoothNavigator, MoldableBluetoothRequestDeviceOptions } from './bluetooth-types';
|
|
2
|
-
import { NativeCapabilityBridgeError } from './bridge';
|
|
1
|
+
import type { MoldableBluetoothAPI, MoldableBluetoothNavigator, MoldableBluetoothRequestDeviceOptions } from './bluetooth-types.js';
|
|
2
|
+
import { NativeCapabilityBridgeError } from './bridge.js';
|
|
3
3
|
export declare function bluetoothError(error: unknown, operation: string): NativeCapabilityBridgeError;
|
|
4
4
|
export declare function bluetoothAborted(operation: string): NativeCapabilityBridgeError;
|
|
5
5
|
export declare function getBluetoothNavigator(): MoldableBluetoothNavigator | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeCapabilityBridgeError, toNativeCapabilityBridgeError, } from './bridge';
|
|
1
|
+
import { NativeCapabilityBridgeError, toNativeCapabilityBridgeError, } from './bridge.js';
|
|
2
2
|
export function bluetoothError(error, operation) {
|
|
3
3
|
if (error instanceof NativeCapabilityBridgeError)
|
|
4
4
|
return error;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MoldableBluetoothDevice, MoldableBluetoothRequestDeviceOptions } from './bluetooth-types';
|
|
2
|
-
import { type NativeCapabilityBridgeOptions } from './bridge';
|
|
1
|
+
import type { MoldableBluetoothDevice, MoldableBluetoothRequestDeviceOptions } from './bluetooth-types.js';
|
|
2
|
+
import { type NativeCapabilityBridgeOptions } from './bridge.js';
|
|
3
3
|
export type MoldableBluetoothTransport = {
|
|
4
4
|
kind: 'web-bluetooth';
|
|
5
5
|
device: MoldableBluetoothDevice;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isMoldableBluetoothSupported, requestMoldableBluetoothDevice, } from './bluetooth-access';
|
|
2
|
-
import { callNativeCapabilityBridge, } from './bridge';
|
|
1
|
+
import { isMoldableBluetoothSupported, requestMoldableBluetoothDevice, } from './bluetooth-access.js';
|
|
2
|
+
import { callNativeCapabilityBridge, } from './bridge.js';
|
|
3
3
|
const REQUEST_TYPE = 'moldable:native-bluetooth';
|
|
4
4
|
const RESULT_TYPE = 'moldable:native-bluetooth-result';
|
|
5
5
|
const EVENT_TYPE = 'moldable:native-bluetooth-event';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { getMoldableBluetoothAvailability, isMoldableBluetoothSupported, requestMoldableBluetoothDevice, } from './bluetooth-access';
|
|
2
|
-
export { connectMoldableBluetoothDevice, MoldableBluetoothConnection, } from './bluetooth-connection';
|
|
3
|
-
export { getMoldableBluetoothCharacteristic, observeMoldableBluetoothNotifications, readMoldableBluetoothValue, writeMoldableBluetoothValue, } from './bluetooth-gatt';
|
|
4
|
-
export type * from './bluetooth-types';
|
|
5
|
-
export { requestMoldableBluetoothWithFallback } from './bluetooth-native-fallback';
|
|
6
|
-
export type { MoldableBluetoothTransport, MoldableNativeBluetoothDevice, MoldableNativeBluetoothService, } from './bluetooth-native-fallback';
|
|
1
|
+
export { getMoldableBluetoothAvailability, isMoldableBluetoothSupported, requestMoldableBluetoothDevice, } from './bluetooth-access.js';
|
|
2
|
+
export { connectMoldableBluetoothDevice, MoldableBluetoothConnection, } from './bluetooth-connection.js';
|
|
3
|
+
export { getMoldableBluetoothCharacteristic, observeMoldableBluetoothNotifications, readMoldableBluetoothValue, writeMoldableBluetoothValue, } from './bluetooth-gatt.js';
|
|
4
|
+
export type * from './bluetooth-types.js';
|
|
5
|
+
export { requestMoldableBluetoothWithFallback } from './bluetooth-native-fallback.js';
|
|
6
|
+
export type { MoldableBluetoothTransport, MoldableNativeBluetoothDevice, MoldableNativeBluetoothService, } from './bluetooth-native-fallback.js';
|
|
7
7
|
//# sourceMappingURL=bluetooth.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getMoldableBluetoothAvailability, isMoldableBluetoothSupported, requestMoldableBluetoothDevice, } from './bluetooth-access';
|
|
2
|
-
export { connectMoldableBluetoothDevice, MoldableBluetoothConnection, } from './bluetooth-connection';
|
|
3
|
-
export { getMoldableBluetoothCharacteristic, observeMoldableBluetoothNotifications, readMoldableBluetoothValue, writeMoldableBluetoothValue, } from './bluetooth-gatt';
|
|
4
|
-
export { requestMoldableBluetoothWithFallback } from './bluetooth-native-fallback';
|
|
1
|
+
export { getMoldableBluetoothAvailability, isMoldableBluetoothSupported, requestMoldableBluetoothDevice, } from './bluetooth-access.js';
|
|
2
|
+
export { connectMoldableBluetoothDevice, MoldableBluetoothConnection, } from './bluetooth-connection.js';
|
|
3
|
+
export { getMoldableBluetoothCharacteristic, observeMoldableBluetoothNotifications, readMoldableBluetoothValue, writeMoldableBluetoothValue, } from './bluetooth-gatt.js';
|
|
4
|
+
export { requestMoldableBluetoothWithFallback } from './bluetooth-native-fallback.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type NativeCapabilityErrorCode, type NativeCapabilityErrorPayload, type NativeCapabilityManifest } from './types';
|
|
1
|
+
import { type NativeCapabilityErrorCode, type NativeCapabilityErrorPayload, type NativeCapabilityManifest } from './types.js';
|
|
2
2
|
export declare const NATIVE_CAPABILITY_CANCEL_REQUEST_TYPE: "moldable:native-capabilities-cancel";
|
|
3
3
|
export interface NativeCapabilityBridgeOptions {
|
|
4
4
|
timeoutMs?: number;
|