@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,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type MoldableScreenShareStatus = 'idle' | 'starting' | 'live' | 'muted' | 'denied' | 'error';
|
|
3
|
+
export interface UseMoldableScreenShareOptions {
|
|
4
|
+
/** Also capture audio from the shared source when it provides any. */
|
|
5
|
+
withAudio?: boolean;
|
|
6
|
+
onStreamChange?: (stream: MediaStream | null) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Screen-share state machine behind `ScreenSharePreview`. Use directly to
|
|
10
|
+
* build custom capture UI on the same permission/stream handling. The OS
|
|
11
|
+
* picker owns source selection, so there is no device enumeration.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useMoldableScreenShare(options?: UseMoldableScreenShareOptions): {
|
|
14
|
+
status: MoldableScreenShareStatus;
|
|
15
|
+
stream: MediaStream | null;
|
|
16
|
+
error: Error | null;
|
|
17
|
+
start: () => Promise<void>;
|
|
18
|
+
stop: () => void;
|
|
19
|
+
};
|
|
20
|
+
export interface ScreenSharePreviewProps extends React.ComponentProps<'div'> {
|
|
21
|
+
/** Also capture audio from the shared source. */
|
|
22
|
+
withAudio?: boolean;
|
|
23
|
+
/** Open the source picker on mount. */
|
|
24
|
+
autoStart?: boolean;
|
|
25
|
+
/** When set, shows a shutter button and delivers PNG snapshots. */
|
|
26
|
+
onSnapshot?: (blob: Blob) => void;
|
|
27
|
+
onStreamChange?: (stream: MediaStream | null) => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Full-bleed live screen-share surface: black media well, hover scrim
|
|
31
|
+
* controls, permission and error states, optional snapshots. The OS picker
|
|
32
|
+
* chooses the source, so there is no device select.
|
|
33
|
+
*/
|
|
34
|
+
declare function ScreenSharePreview({ className, withAudio, autoStart, onSnapshot, onStreamChange, ...props }: ScreenSharePreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export { ScreenSharePreview };
|
|
36
|
+
//# sourceMappingURL=screen-share-preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-share-preview.d.ts","sourceRoot":"","sources":["../../../src/components/hardware/screen-share-preview.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAc9B,MAAM,MAAM,yBAAyB,GACjC,MAAM,GACN,UAAU,GACV,MAAM,GACN,OAAO,GACP,QAAQ,GACR,OAAO,CAAA;AAEX,MAAM,WAAW,6BAA6B;IAC5C,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;CACtD;AAuBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,6BAAkC;;;;;;EA+G5C;AAED,MAAM,WAAW,uBAAwB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC1E,iDAAiD;IACjD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,mEAAmE;IACnE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACjC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;CACtD;AAED;;;;GAIG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,SAAiB,EACjB,SAAiB,EACjB,UAAU,EACV,cAAc,EACd,GAAG,KAAK,EACT,EAAE,uBAAuB,2CAiLzB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { MonitorOff, MonitorUp, RefreshCw, Square } from 'lucide-react';
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { NativeHardwareBridgeError, getMoldableDisplayStream, getMoldableMediaPermissionStatus, requestMoldableMediaPermission, stopMoldableMediaStream, } from '../../lib/native-hardware';
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
import { Button } from '../ui/button';
|
|
8
|
+
import { Spinner } from '../ui/spinner';
|
|
9
|
+
import { LiveIndicator } from './live-indicator';
|
|
10
|
+
function isPermissionDenied(error) {
|
|
11
|
+
if (error instanceof NativeHardwareBridgeError) {
|
|
12
|
+
return error.code === 'permission_denied';
|
|
13
|
+
}
|
|
14
|
+
return (error instanceof DOMException &&
|
|
15
|
+
(error.name === 'NotAllowedError' || error.name === 'SecurityError'));
|
|
16
|
+
}
|
|
17
|
+
function assertMediaPermissionGranted(status) {
|
|
18
|
+
if (status.status !== 'denied' && status.status !== 'restricted')
|
|
19
|
+
return;
|
|
20
|
+
throw new NativeHardwareBridgeError({
|
|
21
|
+
code: 'permission_denied',
|
|
22
|
+
message: status.detail ?? 'Screen recording access was denied.',
|
|
23
|
+
retryable: false,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Screen-share state machine behind `ScreenSharePreview`. Use directly to
|
|
28
|
+
* build custom capture UI on the same permission/stream handling. The OS
|
|
29
|
+
* picker owns source selection, so there is no device enumeration.
|
|
30
|
+
*/
|
|
31
|
+
export function useMoldableScreenShare(options = {}) {
|
|
32
|
+
const [status, setStatus] = useState('idle');
|
|
33
|
+
const [stream, setStream] = useState(null);
|
|
34
|
+
const [error, setError] = useState(null);
|
|
35
|
+
const streamRef = useRef(null);
|
|
36
|
+
const tokenRef = useRef(0);
|
|
37
|
+
const withAudioRef = useRef(options.withAudio);
|
|
38
|
+
const onStreamChangeRef = useRef(options.onStreamChange);
|
|
39
|
+
const detachTrackListenersRef = useRef(null);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
withAudioRef.current = options.withAudio;
|
|
42
|
+
onStreamChangeRef.current = options.onStreamChange;
|
|
43
|
+
}, [options.onStreamChange, options.withAudio]);
|
|
44
|
+
const dropStream = useCallback((updateState = true) => {
|
|
45
|
+
detachTrackListenersRef.current?.();
|
|
46
|
+
detachTrackListenersRef.current = null;
|
|
47
|
+
const previousStream = streamRef.current;
|
|
48
|
+
if (!previousStream)
|
|
49
|
+
return false;
|
|
50
|
+
streamRef.current = null;
|
|
51
|
+
stopMoldableMediaStream(previousStream);
|
|
52
|
+
if (updateState)
|
|
53
|
+
setStream(null);
|
|
54
|
+
onStreamChangeRef.current?.(null);
|
|
55
|
+
return true;
|
|
56
|
+
}, []);
|
|
57
|
+
const stop = useCallback(() => {
|
|
58
|
+
tokenRef.current++;
|
|
59
|
+
dropStream();
|
|
60
|
+
setStatus('idle');
|
|
61
|
+
}, [dropStream]);
|
|
62
|
+
const start = useCallback(async () => {
|
|
63
|
+
const token = ++tokenRef.current;
|
|
64
|
+
dropStream();
|
|
65
|
+
setStatus('starting');
|
|
66
|
+
setError(null);
|
|
67
|
+
try {
|
|
68
|
+
// Nudge the native permission first so macOS prompts before the
|
|
69
|
+
// webview does. Outside Moldable this fails and the browser prompt
|
|
70
|
+
// covers it on getDisplayMedia.
|
|
71
|
+
try {
|
|
72
|
+
const permission = await getMoldableMediaPermissionStatus('screen-recording');
|
|
73
|
+
assertMediaPermissionGranted(permission);
|
|
74
|
+
if (permission.status === 'not-determined' && permission.canRequest) {
|
|
75
|
+
assertMediaPermissionGranted(await requestMoldableMediaPermission('screen-recording'));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (cause) {
|
|
79
|
+
if (isPermissionDenied(cause))
|
|
80
|
+
throw cause;
|
|
81
|
+
// Not in Moldable — proceed straight to the picker.
|
|
82
|
+
}
|
|
83
|
+
if (tokenRef.current !== token)
|
|
84
|
+
return;
|
|
85
|
+
const media = await getMoldableDisplayStream({
|
|
86
|
+
video: true,
|
|
87
|
+
audio: withAudioRef.current ?? false,
|
|
88
|
+
});
|
|
89
|
+
if (tokenRef.current !== token) {
|
|
90
|
+
stopMoldableMediaStream(media);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
// The user can end the share from the OS UI at any time; fold that
|
|
94
|
+
// back into a clean idle state.
|
|
95
|
+
const [videoTrack] = media.getVideoTracks();
|
|
96
|
+
if (videoTrack) {
|
|
97
|
+
const handleEnded = () => {
|
|
98
|
+
if (tokenRef.current !== token)
|
|
99
|
+
return;
|
|
100
|
+
tokenRef.current++;
|
|
101
|
+
dropStream();
|
|
102
|
+
setStatus('idle');
|
|
103
|
+
};
|
|
104
|
+
const handleMute = () => {
|
|
105
|
+
if (tokenRef.current === token)
|
|
106
|
+
setStatus('muted');
|
|
107
|
+
};
|
|
108
|
+
const handleUnmute = () => {
|
|
109
|
+
if (tokenRef.current === token)
|
|
110
|
+
setStatus('live');
|
|
111
|
+
};
|
|
112
|
+
videoTrack.addEventListener('ended', handleEnded, { once: true });
|
|
113
|
+
videoTrack.addEventListener('mute', handleMute);
|
|
114
|
+
videoTrack.addEventListener('unmute', handleUnmute);
|
|
115
|
+
detachTrackListenersRef.current = () => {
|
|
116
|
+
videoTrack.removeEventListener('ended', handleEnded);
|
|
117
|
+
videoTrack.removeEventListener('mute', handleMute);
|
|
118
|
+
videoTrack.removeEventListener('unmute', handleUnmute);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
streamRef.current = media;
|
|
122
|
+
setStream(media);
|
|
123
|
+
setStatus('live');
|
|
124
|
+
onStreamChangeRef.current?.(media);
|
|
125
|
+
}
|
|
126
|
+
catch (cause) {
|
|
127
|
+
if (tokenRef.current !== token)
|
|
128
|
+
return;
|
|
129
|
+
setError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
130
|
+
setStatus(isPermissionDenied(cause) ? 'denied' : 'error');
|
|
131
|
+
}
|
|
132
|
+
}, [dropStream]);
|
|
133
|
+
useEffect(() => () => {
|
|
134
|
+
tokenRef.current++;
|
|
135
|
+
dropStream(false);
|
|
136
|
+
}, [dropStream]);
|
|
137
|
+
return { status, stream, error, start, stop };
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Full-bleed live screen-share surface: black media well, hover scrim
|
|
141
|
+
* controls, permission and error states, optional snapshots. The OS picker
|
|
142
|
+
* chooses the source, so there is no device select.
|
|
143
|
+
*/
|
|
144
|
+
function ScreenSharePreview({ className, withAudio = false, autoStart = false, onSnapshot, onStreamChange, ...props }) {
|
|
145
|
+
const share = useMoldableScreenShare({ withAudio, onStreamChange });
|
|
146
|
+
const videoRef = useRef(null);
|
|
147
|
+
const [flash, setFlash] = useState(false);
|
|
148
|
+
const autoStartedRef = useRef(false);
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
if (autoStart && !autoStartedRef.current) {
|
|
151
|
+
autoStartedRef.current = true;
|
|
152
|
+
void share.start();
|
|
153
|
+
}
|
|
154
|
+
}, [autoStart, share]);
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
const video = videoRef.current;
|
|
157
|
+
if (!video)
|
|
158
|
+
return;
|
|
159
|
+
video.srcObject = share.stream;
|
|
160
|
+
if (share.stream) {
|
|
161
|
+
void video.play().catch(() => {
|
|
162
|
+
// Autoplay rejections resolve once the stream attaches.
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}, [share.stream]);
|
|
166
|
+
const capture = () => {
|
|
167
|
+
const video = videoRef.current;
|
|
168
|
+
if (!video || !onSnapshot || video.videoWidth === 0)
|
|
169
|
+
return;
|
|
170
|
+
const canvas = document.createElement('canvas');
|
|
171
|
+
canvas.width = video.videoWidth;
|
|
172
|
+
canvas.height = video.videoHeight;
|
|
173
|
+
const context = canvas.getContext('2d');
|
|
174
|
+
if (!context)
|
|
175
|
+
return;
|
|
176
|
+
context.drawImage(video, 0, 0);
|
|
177
|
+
setFlash(true);
|
|
178
|
+
window.setTimeout(() => setFlash(false), 160);
|
|
179
|
+
canvas.toBlob((blob) => {
|
|
180
|
+
if (blob)
|
|
181
|
+
onSnapshot(blob);
|
|
182
|
+
}, 'image/png');
|
|
183
|
+
};
|
|
184
|
+
const active = share.status === 'live' || share.status === 'muted';
|
|
185
|
+
const videoTrack = active ? share.stream?.getVideoTracks()[0] : undefined;
|
|
186
|
+
const settings = videoTrack?.getSettings();
|
|
187
|
+
const sourceLabel = videoTrack?.label;
|
|
188
|
+
return (_jsxs("div", { "data-slot": "screen-share-preview", "data-status": share.status, className: cn('group relative isolate aspect-video w-full overflow-hidden rounded-xl border', active ? 'bg-black' : 'bg-muted/30', className), ...props, children: [_jsx("video", { ref: videoRef, muted: true, playsInline: true, className: cn('absolute inset-0 size-full object-contain', !active && 'invisible') }), _jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 z-30 bg-white transition-opacity duration-150", style: { opacity: flash ? 0.9 : 0 } }), active ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "absolute left-3 top-3 z-20", children: _jsx(LiveIndicator, { variant: "rec", label: share.status === 'muted' ? 'Paused' : 'Sharing' }) }), _jsxs("div", { className: "absolute right-3 top-3 z-20 flex max-w-[70%] items-center gap-1.5", children: [sourceLabel ? (_jsx("div", { className: "truncate rounded-full border border-white/15 bg-black/60 px-2 py-0.5 font-mono text-[10px] text-white/90 backdrop-blur-sm", children: sourceLabel })) : null, settings?.width && settings.height ? (_jsxs("div", { className: "shrink-0 rounded-full border border-white/15 bg-black/60 px-2 py-0.5 font-mono text-[10px] tabular-nums text-white/90 backdrop-blur-sm", children: [settings.width, "\u00D7", settings.height] })) : null] }), _jsxs("div", { className: "absolute inset-x-0 bottom-0 z-20 flex items-end justify-end gap-2 bg-gradient-to-t from-black/70 via-black/25 to-transparent p-3 pt-10 opacity-0 transition-opacity duration-200 focus-within:opacity-100 group-hover:opacity-100", children: [onSnapshot ? (_jsx("button", { type: "button", onClick: capture, "aria-label": "Take snapshot", className: "size-9 rounded-full border-2 border-white/40 bg-white shadow-md transition-transform duration-150 hover:scale-105 active:scale-95 motion-reduce:transition-none" })) : null, _jsx(Button, { variant: "secondary", size: "icon-sm", "aria-label": "Stop sharing", onClick: share.stop, className: "border border-white/15 bg-white/10 text-white backdrop-blur-md hover:bg-white/20", children: _jsx(Square, { className: "fill-current" }) })] })] })) : (_jsx("div", { className: "animate-in fade-in absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 p-6 text-center duration-300 motion-reduce:animate-none", children: share.status === 'starting' ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { className: "text-muted-foreground" }), _jsx("p", { className: "text-muted-foreground text-xs", children: "Waiting for the source picker\u2026" })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-muted-foreground bg-background shadow-xs flex size-10 items-center justify-center rounded-lg border [&_svg]:size-5", children: share.status === 'idle' ? _jsx(MonitorUp, {}) : _jsx(MonitorOff, {}) }), share.status === 'idle' ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-muted-foreground text-sm", children: "Nothing is being shared" }), _jsxs(Button, { size: "sm", onClick: () => void share.start(), children: [_jsx(MonitorUp, {}), " Share screen"] })] })) : share.status === 'denied' ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm font-medium", children: "Screen recording access denied" }), _jsx("p", { className: "text-muted-foreground max-w-64 text-xs", children: "Enable screen recording for Moldable in System Settings, then try again." }), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => void share.start(), children: [_jsx(RefreshCw, {}), " Try again"] })] })) : (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm font-medium", children: "Screen share unavailable" }), _jsx("p", { className: "text-muted-foreground max-w-64 text-xs", children: share.error?.message ??
|
|
189
|
+
'The screen share could not be started.' }), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => void share.start(), children: [_jsx(RefreshCw, {}), " Try again"] })] }))] })) }))] }));
|
|
190
|
+
}
|
|
191
|
+
export { ScreenSharePreview };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MoldableSecureStorageDiagnostics, type MoldableSecureStorageEntryMetadata } from '../../lib/native-hardware';
|
|
3
|
+
export type MoldableSecureStorageStatus = 'loading' | 'ready' | 'error';
|
|
4
|
+
export interface MoldableSecureEntryValidation {
|
|
5
|
+
valid: boolean;
|
|
6
|
+
/** Human-readable reason when invalid; `null` for empty keys and valid entries. */
|
|
7
|
+
message: string | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Client-side mirror of the library's secure-storage constraints. Returns a
|
|
11
|
+
* result instead of throwing so composers can render inline hints.
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateMoldableSecureEntry(key: string, value?: string): MoldableSecureEntryValidation;
|
|
14
|
+
/**
|
|
15
|
+
* Secure-storage state machine behind `SecureStoragePanel`: entry metadata,
|
|
16
|
+
* backend diagnostics, and set/get/remove flows. Values are only fetched on
|
|
17
|
+
* explicit `get` calls.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useMoldableSecureStorage(): {
|
|
20
|
+
keys: MoldableSecureStorageEntryMetadata[];
|
|
21
|
+
diagnostics: MoldableSecureStorageDiagnostics | null;
|
|
22
|
+
status: MoldableSecureStorageStatus;
|
|
23
|
+
error: Error | null;
|
|
24
|
+
refresh: () => Promise<void>;
|
|
25
|
+
set: (key: string, value: string) => Promise<boolean>;
|
|
26
|
+
get: (key: string) => Promise<string | null>;
|
|
27
|
+
remove: (key: string) => Promise<boolean>;
|
|
28
|
+
validate: typeof validateMoldableSecureEntry;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* OS keychain panel: store key/value secrets, list entry metadata, reveal
|
|
32
|
+
* values explicitly, and delete entries. Values never render until revealed.
|
|
33
|
+
*/
|
|
34
|
+
declare function SecureStoragePanel({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export { SecureStoragePanel };
|
|
36
|
+
//# sourceMappingURL=secure-storage-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secure-storage-panel.d.ts","sourceRoot":"","sources":["../../../src/components/hardware/secure-storage-panel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,kCAAkC,EAQxC,MAAM,2BAA2B,CAAA;AAiBlC,MAAM,MAAM,2BAA2B,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;AAIvE,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,OAAO,CAAA;IACd,mFAAmF;IACnF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,MAAM,EACX,KAAK,SAAK,GACT,6BAA6B,CAwB/B;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB;;;;;;eAqCxB,MAAM,SAAS,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;eAgBlB,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;kBAcrD,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;;EA2BxC;AAWD;;;GAGG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CA0K7B;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Eye, EyeOff, KeyRound, Trash2 } from 'lucide-react';
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { SECURE_STORAGE_MAX_KEY_LENGTH, SECURE_STORAGE_MAX_VALUE_BYTES, deleteMoldableSecureValue, getMoldableSecureStorageDiagnostics, getMoldableSecureValue, listMoldableSecureValues, setMoldableSecureValue, } from '../../lib/native-hardware';
|
|
6
|
+
import { Badge } from '../ui/badge';
|
|
7
|
+
import { Button } from '../ui/button';
|
|
8
|
+
import { Input } from '../ui/input';
|
|
9
|
+
import { Skeleton } from '../ui/skeleton';
|
|
10
|
+
import { Spinner } from '../ui/spinner';
|
|
11
|
+
import { CapabilityBadge } from './capability-badge';
|
|
12
|
+
import { DeviceList, DeviceListEmpty, DeviceListItem } from './device-list';
|
|
13
|
+
import { HardwarePanel, HardwarePanelAction, HardwarePanelContent, HardwarePanelHeader, HardwarePanelIcon, HardwarePanelTitle, } from './hardware-panel';
|
|
14
|
+
const SECURE_STORAGE_KEY_PATTERN = /^[A-Za-z0-9._-]+$/;
|
|
15
|
+
/**
|
|
16
|
+
* Client-side mirror of the library's secure-storage constraints. Returns a
|
|
17
|
+
* result instead of throwing so composers can render inline hints.
|
|
18
|
+
*/
|
|
19
|
+
export function validateMoldableSecureEntry(key, value = '') {
|
|
20
|
+
if (key.length === 0)
|
|
21
|
+
return { valid: false, message: null };
|
|
22
|
+
if (key.length > SECURE_STORAGE_MAX_KEY_LENGTH) {
|
|
23
|
+
return {
|
|
24
|
+
valid: false,
|
|
25
|
+
message: `Keys are limited to ${SECURE_STORAGE_MAX_KEY_LENGTH} characters.`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (!SECURE_STORAGE_KEY_PATTERN.test(key)) {
|
|
29
|
+
return {
|
|
30
|
+
valid: false,
|
|
31
|
+
message: 'Keys may only contain letters, numbers, dots, underscores, and hyphens.',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (new TextEncoder().encode(value).byteLength > SECURE_STORAGE_MAX_VALUE_BYTES) {
|
|
35
|
+
return {
|
|
36
|
+
valid: false,
|
|
37
|
+
message: `Values are limited to ${SECURE_STORAGE_MAX_VALUE_BYTES} UTF-8 bytes.`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return { valid: true, message: null };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Secure-storage state machine behind `SecureStoragePanel`: entry metadata,
|
|
44
|
+
* backend diagnostics, and set/get/remove flows. Values are only fetched on
|
|
45
|
+
* explicit `get` calls.
|
|
46
|
+
*/
|
|
47
|
+
export function useMoldableSecureStorage() {
|
|
48
|
+
const [keys, setKeys] = useState([]);
|
|
49
|
+
const [diagnostics, setDiagnostics] = useState(null);
|
|
50
|
+
const [status, setStatus] = useState('loading');
|
|
51
|
+
const [error, setError] = useState(null);
|
|
52
|
+
const generationRef = useRef(0);
|
|
53
|
+
const refresh = useCallback(async () => {
|
|
54
|
+
const generation = ++generationRef.current;
|
|
55
|
+
setError(null);
|
|
56
|
+
setStatus((previous) => (previous === 'ready' ? previous : 'loading'));
|
|
57
|
+
try {
|
|
58
|
+
const [list, currentDiagnostics] = await Promise.all([
|
|
59
|
+
listMoldableSecureValues(),
|
|
60
|
+
getMoldableSecureStorageDiagnostics(),
|
|
61
|
+
]);
|
|
62
|
+
if (generationRef.current !== generation)
|
|
63
|
+
return;
|
|
64
|
+
setKeys(list.entries);
|
|
65
|
+
setDiagnostics(currentDiagnostics);
|
|
66
|
+
setStatus('ready');
|
|
67
|
+
}
|
|
68
|
+
catch (cause) {
|
|
69
|
+
if (generationRef.current !== generation)
|
|
70
|
+
return;
|
|
71
|
+
setError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
72
|
+
setStatus('error');
|
|
73
|
+
}
|
|
74
|
+
}, []);
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
void refresh();
|
|
77
|
+
const liveGeneration = generationRef;
|
|
78
|
+
return () => {
|
|
79
|
+
liveGeneration.current++;
|
|
80
|
+
};
|
|
81
|
+
}, [refresh]);
|
|
82
|
+
const set = useCallback(async (key, value) => {
|
|
83
|
+
const generation = generationRef.current;
|
|
84
|
+
try {
|
|
85
|
+
await setMoldableSecureValue(key, value);
|
|
86
|
+
}
|
|
87
|
+
catch (cause) {
|
|
88
|
+
if (generationRef.current === generation) {
|
|
89
|
+
setError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
await refresh();
|
|
94
|
+
return true;
|
|
95
|
+
}, [refresh]);
|
|
96
|
+
const get = useCallback(async (key) => {
|
|
97
|
+
const generation = generationRef.current;
|
|
98
|
+
try {
|
|
99
|
+
const result = await getMoldableSecureValue(key);
|
|
100
|
+
return result.value;
|
|
101
|
+
}
|
|
102
|
+
catch (cause) {
|
|
103
|
+
if (generationRef.current === generation) {
|
|
104
|
+
setError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}, []);
|
|
109
|
+
const remove = useCallback(async (key) => {
|
|
110
|
+
const generation = generationRef.current;
|
|
111
|
+
try {
|
|
112
|
+
await deleteMoldableSecureValue(key);
|
|
113
|
+
}
|
|
114
|
+
catch (cause) {
|
|
115
|
+
if (generationRef.current === generation) {
|
|
116
|
+
setError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
await refresh();
|
|
121
|
+
return true;
|
|
122
|
+
}, [refresh]);
|
|
123
|
+
return {
|
|
124
|
+
keys,
|
|
125
|
+
diagnostics,
|
|
126
|
+
status,
|
|
127
|
+
error,
|
|
128
|
+
refresh,
|
|
129
|
+
set,
|
|
130
|
+
get,
|
|
131
|
+
remove,
|
|
132
|
+
validate: validateMoldableSecureEntry,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function formatEntryTimestamp(ms) {
|
|
136
|
+
return new Date(ms).toLocaleString(undefined, {
|
|
137
|
+
month: 'short',
|
|
138
|
+
day: 'numeric',
|
|
139
|
+
hour: '2-digit',
|
|
140
|
+
minute: '2-digit',
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* OS keychain panel: store key/value secrets, list entry metadata, reveal
|
|
145
|
+
* values explicitly, and delete entries. Values never render until revealed.
|
|
146
|
+
*/
|
|
147
|
+
function SecureStoragePanel({ className, ...props }) {
|
|
148
|
+
const storage = useMoldableSecureStorage();
|
|
149
|
+
const [draftKey, setDraftKey] = useState('');
|
|
150
|
+
const [draftValue, setDraftValue] = useState('');
|
|
151
|
+
const [storing, setStoring] = useState(false);
|
|
152
|
+
const [revealed, setRevealed] = useState({});
|
|
153
|
+
const [revealingKey, setRevealingKey] = useState(null);
|
|
154
|
+
const validation = validateMoldableSecureEntry(draftKey, draftValue);
|
|
155
|
+
const canStore = validation.valid && draftValue.length > 0 && !storing;
|
|
156
|
+
const store = async () => {
|
|
157
|
+
setStoring(true);
|
|
158
|
+
const stored = await storage.set(draftKey, draftValue);
|
|
159
|
+
setStoring(false);
|
|
160
|
+
if (stored) {
|
|
161
|
+
setDraftKey('');
|
|
162
|
+
setDraftValue('');
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const hide = (key) => {
|
|
166
|
+
setRevealed((previous) => {
|
|
167
|
+
const next = { ...previous };
|
|
168
|
+
delete next[key];
|
|
169
|
+
return next;
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
const reveal = async (key) => {
|
|
173
|
+
setRevealingKey(key);
|
|
174
|
+
const value = await storage.get(key);
|
|
175
|
+
setRevealingKey((current) => (current === key ? null : current));
|
|
176
|
+
if (value !== null) {
|
|
177
|
+
setRevealed((previous) => ({ ...previous, [key]: value }));
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const removeEntry = async (key) => {
|
|
181
|
+
hide(key);
|
|
182
|
+
await storage.remove(key);
|
|
183
|
+
};
|
|
184
|
+
return (_jsxs(HardwarePanel, { "data-slot": "secure-storage-panel", "data-status": storage.status, className: className, ...props, children: [_jsxs(HardwarePanelHeader, { children: [_jsx(HardwarePanelIcon, { children: _jsx(KeyRound, {}) }), _jsx(HardwarePanelTitle, { children: "Secure Storage" }), _jsx(CapabilityBadge, { capability: "secure-storage" }), _jsx(HardwarePanelAction, { children: storage.diagnostics ? (_jsx(Badge, { variant: "outline", className: "font-mono text-[10px]", children: storage.diagnostics.backend })) : null })] }), _jsxs(HardwarePanelContent, { className: "space-y-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { value: draftKey, placeholder: "key", maxLength: SECURE_STORAGE_MAX_KEY_LENGTH, "aria-label": "Secret key", autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", spellCheck: false, className: "font-mono", onChange: (event) => setDraftKey(event.target.value) }), _jsx(Input, { value: draftValue, type: "password", placeholder: "value", "aria-label": "Secret value", autoComplete: "new-password", onChange: (event) => setDraftValue(event.target.value) }), _jsxs(Button, { disabled: !canStore, onClick: () => void store(), children: [storing ? _jsx(Spinner, {}) : null, "Store"] })] }), validation.message ? (_jsx("p", { className: "text-status-error text-xs", children: validation.message })) : null, storage.error ? (_jsx("p", { className: "text-status-error text-xs", children: storage.error.message })) : null, storage.status === 'loading' && storage.keys.length === 0 ? (_jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton, { className: "h-12 w-full rounded-lg" }), _jsx(Skeleton, { className: "h-12 w-full rounded-lg" })] })) : storage.keys.length === 0 ? (_jsx(DeviceList, { children: _jsxs(DeviceListEmpty, { icon: _jsx(KeyRound, {}), children: [_jsx("span", { className: "text-sm font-medium", children: "Nothing stored" }), _jsx("span", { className: "text-xs", children: "Values are encrypted by the OS keychain." })] }) })) : (_jsx(DeviceList, { children: storage.keys.map((entry) => {
|
|
185
|
+
const revealedValue = revealed[entry.key];
|
|
186
|
+
return (_jsx(DeviceListItem, { icon: _jsx(KeyRound, {}), name: _jsx("span", { className: "font-mono text-xs", children: entry.key }), description: revealedValue !== undefined
|
|
187
|
+
? revealedValue
|
|
188
|
+
: entry.updatedAtMs > entry.createdAtMs
|
|
189
|
+
? `Updated ${formatEntryTimestamp(entry.updatedAtMs)}`
|
|
190
|
+
: `Created ${formatEntryTimestamp(entry.createdAtMs)}`, action: _jsxs(_Fragment, { children: [revealedValue !== undefined ? (_jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": `Hide value for ${entry.key}`, onClick: () => hide(entry.key), children: _jsx(EyeOff, {}) })) : (_jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": `Reveal value for ${entry.key}`, disabled: revealingKey === entry.key, onClick: () => void reveal(entry.key), children: revealingKey === entry.key ? _jsx(Spinner, {}) : _jsx(Eye, {}) })), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": `Delete ${entry.key}`, className: "hover:text-destructive", onClick: () => void removeEntry(entry.key), children: _jsx(Trash2, {}) })] }) }, entry.key));
|
|
191
|
+
}) }))] })] }));
|
|
192
|
+
}
|
|
193
|
+
export { SecureStoragePanel };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MoldableSerialInputSignals, type MoldableSerialOutputSignals, type MoldableSerialPort, type MoldableSerialPortFilter, type MoldableSerialPortInfo, type MoldableSerialRequestOptions } from '../../lib/native-hardware';
|
|
3
|
+
export type MoldableSerialStatus = 'idle' | 'connecting' | 'connected' | 'error';
|
|
4
|
+
export interface UseMoldableSerialOptions {
|
|
5
|
+
/** Baud rate used when `connect` does not override it. Defaults to 115200. */
|
|
6
|
+
baudRate?: number;
|
|
7
|
+
/** Port filters passed to the chooser. */
|
|
8
|
+
filters?: readonly MoldableSerialPortFilter[];
|
|
9
|
+
/** Chooses among native fallback ports. Required when multiple ports match. */
|
|
10
|
+
selectNativePort?: MoldableSerialRequestOptions['selectNativePort'];
|
|
11
|
+
/** Raw bytes for every received chunk. */
|
|
12
|
+
onData?: (bytes: Uint8Array) => void;
|
|
13
|
+
/** Rolling cap for the RX/TX log. Defaults to 500 entries. */
|
|
14
|
+
maxEntries?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface MoldableSerialConnectOptions {
|
|
17
|
+
baudRate?: number;
|
|
18
|
+
filters?: readonly MoldableSerialPortFilter[];
|
|
19
|
+
}
|
|
20
|
+
export interface MoldableSerialSignalsState {
|
|
21
|
+
dataTerminalReady: boolean;
|
|
22
|
+
requestToSend: boolean;
|
|
23
|
+
break: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Serial state machine behind `SerialConsole`: request → open → streaming
|
|
27
|
+
* read loop with UTF-8 decode, line sends, DTR/RTS control, RX/TX log.
|
|
28
|
+
* Use directly to build custom serial UI on the same lifecycle handling.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useMoldableSerial(options?: UseMoldableSerialOptions): {
|
|
31
|
+
status: MoldableSerialStatus;
|
|
32
|
+
port: MoldableSerialPort | null;
|
|
33
|
+
portInfo: MoldableSerialPortInfo | null;
|
|
34
|
+
error: Error | null;
|
|
35
|
+
signals: MoldableSerialSignalsState;
|
|
36
|
+
inputSignals: MoldableSerialInputSignals | null;
|
|
37
|
+
entries: import("./stream-log").StreamLogEntry[];
|
|
38
|
+
rxBytes: number;
|
|
39
|
+
txBytes: number;
|
|
40
|
+
connect: (overrides?: MoldableSerialConnectOptions) => Promise<void>;
|
|
41
|
+
disconnect: () => Promise<void>;
|
|
42
|
+
forget: () => Promise<void>;
|
|
43
|
+
send: (data: string | Uint8Array) => Promise<void>;
|
|
44
|
+
setSignals: (next: MoldableSerialOutputSignals) => Promise<void>;
|
|
45
|
+
refreshSignals: () => Promise<void>;
|
|
46
|
+
clearEntries: () => void;
|
|
47
|
+
};
|
|
48
|
+
export interface SerialConsoleProps extends React.ComponentProps<'div'> {
|
|
49
|
+
/** Baud rate preselected in the header chooser. Defaults to 115200. */
|
|
50
|
+
baudRate?: number;
|
|
51
|
+
/** Port filters passed to the chooser. */
|
|
52
|
+
filters?: readonly MoldableSerialPortFilter[];
|
|
53
|
+
/** Overrides the built-in native fallback port chooser. */
|
|
54
|
+
selectNativePort?: MoldableSerialRequestOptions['selectNativePort'];
|
|
55
|
+
/** Raw bytes for every received chunk. */
|
|
56
|
+
onData?: (bytes: Uint8Array) => void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Serial console panel: baud-rate chooser, connect/disconnect lifecycle,
|
|
60
|
+
* auto-following RX/TX log, line composer, signal controls, byte counters.
|
|
61
|
+
*/
|
|
62
|
+
declare function SerialConsole({ className, baudRate, filters, selectNativePort, onData, ...props }: SerialConsoleProps): import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
export { SerialConsole };
|
|
64
|
+
//# sourceMappingURL=serial-console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serial-console.d.ts","sourceRoot":"","sources":["../../../src/components/hardware/serial-console.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EASlC,MAAM,2BAA2B,CAAA;AAyBlC,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,CAAA;AA2BhF,MAAM,WAAW,wBAAwB;IACvC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,SAAS,wBAAwB,EAAE,CAAA;IAC7C,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,4BAA4B,CAAC,kBAAkB,CAAC,CAAA;IACnE,0CAA0C;IAC1C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,SAAS,wBAAwB,EAAE,CAAA;CAC9C;AAED,MAAM,WAAW,0BAA0B;IACzC,iBAAiB,EAAE,OAAO,CAAA;IAC1B,aAAa,EAAE,OAAO,CAAA;IACtB,KAAK,EAAE,OAAO,CAAA;CACf;AAQD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B;;;;;;;;;;0BAkHlD,4BAA4B;;;iBA0HjC,MAAM,GAAG,UAAU;uBAsBnB,2BAA2B;;;EAiE3C;AAED,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACrE,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,SAAS,wBAAwB,EAAE,CAAA;IAC7C,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,4BAA4B,CAAC,kBAAkB,CAAC,CAAA;IACnE,0CAA0C;IAC1C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;CACrC;AAED;;;GAGG;AACH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAA4B,EAC5B,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,GAAG,KAAK,EACT,EAAE,kBAAkB,2CAsSpB;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|