@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,179 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronDown, Zap } from 'lucide-react';
|
|
4
|
+
import { useEffect, useLayoutEffect, useRef, useState, } from 'react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { Button } from '../ui/button';
|
|
7
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
|
|
8
|
+
import { Slider } from '../ui/slider';
|
|
9
|
+
import { MaxThumbBurst, ModelEffortRangeEffects, } from './model-effort-power-effects';
|
|
10
|
+
const EXPANDED_TRIGGER_WIDTH = 252;
|
|
11
|
+
const TRIGGER_MOTION_MS = 320;
|
|
12
|
+
export function resolveModelEffortPresetIndex(presets, selectedModel, selectedEffort) {
|
|
13
|
+
const exactIndex = presets.findIndex((preset) => preset.modelId === selectedModel && preset.effort === selectedEffort);
|
|
14
|
+
if (exactIndex >= 0)
|
|
15
|
+
return exactIndex;
|
|
16
|
+
const sameModelIndex = presets.findIndex((preset) => preset.modelId === selectedModel);
|
|
17
|
+
return Math.max(sameModelIndex, 0);
|
|
18
|
+
}
|
|
19
|
+
function tickPosition(index, maxIndex) {
|
|
20
|
+
if (maxIndex <= 0)
|
|
21
|
+
return '14px';
|
|
22
|
+
const percentage = (index / maxIndex) * 100;
|
|
23
|
+
const thumbOffset = 14 - 28 * (percentage / 100);
|
|
24
|
+
return `calc(${percentage}% + ${thumbOffset}px)`;
|
|
25
|
+
}
|
|
26
|
+
function fillWidth(index, maxIndex) {
|
|
27
|
+
if (maxIndex <= 0)
|
|
28
|
+
return '13px';
|
|
29
|
+
const percentage = (index / maxIndex) * 100;
|
|
30
|
+
const thumbCenterFromInset = 13 - 28 * (percentage / 100);
|
|
31
|
+
return `calc(${percentage}% + ${thumbCenterFromInset}px)`;
|
|
32
|
+
}
|
|
33
|
+
function getPowerLevel(effort) {
|
|
34
|
+
switch (effort) {
|
|
35
|
+
case 'low':
|
|
36
|
+
return 'light';
|
|
37
|
+
case 'medium':
|
|
38
|
+
return 'medium';
|
|
39
|
+
case 'high':
|
|
40
|
+
return 'high';
|
|
41
|
+
case 'xhigh':
|
|
42
|
+
return 'xhigh';
|
|
43
|
+
case 'max':
|
|
44
|
+
case 'ultra':
|
|
45
|
+
return 'max';
|
|
46
|
+
default:
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function ModelEffortSelector({ providers, presets, selectedModel, selectedReasoningEffort, onSelectionChange, disabled = false, }) {
|
|
51
|
+
const [open, setOpen] = useState(false);
|
|
52
|
+
const [thumbMotionReady, setThumbMotionReady] = useState(false);
|
|
53
|
+
const [previewPresetIndex, setPreviewPresetIndex] = useState(null);
|
|
54
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
55
|
+
const [maxBurstKey, setMaxBurstKey] = useState(0);
|
|
56
|
+
const [revealMax, setRevealMax] = useState(false);
|
|
57
|
+
const triggerRef = useRef(null);
|
|
58
|
+
const triggerAnimationRef = useRef(null);
|
|
59
|
+
const triggerMotionStartWidthRef = useRef(null);
|
|
60
|
+
const matchingPreset = presets.find((preset) => preset.modelId === selectedModel &&
|
|
61
|
+
preset.effort === selectedReasoningEffort) ?? presets.find((preset) => preset.modelId === selectedModel);
|
|
62
|
+
const activeProviderId = matchingPreset?.providerId ?? providers[0]?.id;
|
|
63
|
+
const activePresets = presets.filter((preset) => preset.providerId === activeProviderId);
|
|
64
|
+
const selectedPresetIndex = resolveModelEffortPresetIndex(activePresets, selectedModel, selectedReasoningEffort);
|
|
65
|
+
const visiblePresetIndex = previewPresetIndex !== null && activePresets[previewPresetIndex]
|
|
66
|
+
? previewPresetIndex
|
|
67
|
+
: selectedPresetIndex;
|
|
68
|
+
const currentPreset = activePresets[visiblePresetIndex];
|
|
69
|
+
const isMaxPower = currentPreset?.effort === 'ultra' || currentPreset?.effort === 'max';
|
|
70
|
+
const powerLevel = getPowerLevel(currentPreset?.effort);
|
|
71
|
+
const maxPresetIndex = Math.max(activePresets.length - 1, 0);
|
|
72
|
+
const activeProviderIndex = Math.max(providers.findIndex((provider) => provider.id === activeProviderId), 0);
|
|
73
|
+
const showProviderToggle = providers.length > 1;
|
|
74
|
+
// Codex keeps thumb position motion disabled for the first 16ms after mount.
|
|
75
|
+
// That lets the selected stop render in place instead of sliding in as the
|
|
76
|
+
// popover opens, while retaining the same motion for later interactions.
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (!open)
|
|
79
|
+
return;
|
|
80
|
+
const timeout = window.setTimeout(() => setThumbMotionReady(true), 16);
|
|
81
|
+
return () => window.clearTimeout(timeout);
|
|
82
|
+
}, [open]);
|
|
83
|
+
useLayoutEffect(() => {
|
|
84
|
+
const trigger = triggerRef.current;
|
|
85
|
+
const startWidth = triggerMotionStartWidthRef.current;
|
|
86
|
+
triggerMotionStartWidthRef.current = null;
|
|
87
|
+
if (!trigger || startWidth === null)
|
|
88
|
+
return;
|
|
89
|
+
triggerAnimationRef.current?.cancel();
|
|
90
|
+
const endWidth = trigger.getBoundingClientRect().width;
|
|
91
|
+
if (Math.abs(endWidth - startWidth) < 0.5 ||
|
|
92
|
+
window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const animation = trigger.animate([{ width: `${startWidth}px` }, { width: `${endWidth}px` }], {
|
|
96
|
+
duration: TRIGGER_MOTION_MS,
|
|
97
|
+
easing: 'cubic-bezier(.23,1,.32,1)',
|
|
98
|
+
});
|
|
99
|
+
triggerAnimationRef.current = animation;
|
|
100
|
+
animation.onfinish = () => {
|
|
101
|
+
if (triggerAnimationRef.current === animation) {
|
|
102
|
+
triggerAnimationRef.current = null;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}, [open]);
|
|
106
|
+
useEffect(() => () => {
|
|
107
|
+
triggerAnimationRef.current?.cancel();
|
|
108
|
+
}, []);
|
|
109
|
+
const preparePresetEffects = (nextPreset) => {
|
|
110
|
+
const nextIsMax = nextPreset?.effort === 'ultra' || nextPreset?.effort === 'max';
|
|
111
|
+
if (nextIsMax && !isMaxPower) {
|
|
112
|
+
setMaxBurstKey((key) => key + 1);
|
|
113
|
+
setRevealMax(true);
|
|
114
|
+
}
|
|
115
|
+
else if (!nextIsMax && isMaxPower) {
|
|
116
|
+
setRevealMax(false);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const handleOpenChange = (nextOpen) => {
|
|
120
|
+
const trigger = triggerRef.current;
|
|
121
|
+
if (trigger) {
|
|
122
|
+
triggerMotionStartWidthRef.current = trigger.getBoundingClientRect().width;
|
|
123
|
+
triggerAnimationRef.current?.cancel();
|
|
124
|
+
}
|
|
125
|
+
setThumbMotionReady(false);
|
|
126
|
+
setPreviewPresetIndex(null);
|
|
127
|
+
setIsDragging(false);
|
|
128
|
+
if (!nextOpen)
|
|
129
|
+
setRevealMax(false);
|
|
130
|
+
setOpen(nextOpen);
|
|
131
|
+
};
|
|
132
|
+
const handleProviderChange = (providerId) => {
|
|
133
|
+
if (providerId === activeProviderId)
|
|
134
|
+
return;
|
|
135
|
+
const nextPresets = presets.filter((preset) => preset.providerId === providerId);
|
|
136
|
+
if (nextPresets.length === 0)
|
|
137
|
+
return;
|
|
138
|
+
const progress = maxPresetIndex > 0 ? visiblePresetIndex / maxPresetIndex : 0;
|
|
139
|
+
const nextIndex = Math.round(progress * Math.max(nextPresets.length - 1, 0));
|
|
140
|
+
const nextPreset = nextPresets[nextIndex];
|
|
141
|
+
if (!nextPreset)
|
|
142
|
+
return;
|
|
143
|
+
preparePresetEffects(nextPreset);
|
|
144
|
+
setPreviewPresetIndex(null);
|
|
145
|
+
onSelectionChange(nextPreset.modelId, nextPreset.effort);
|
|
146
|
+
};
|
|
147
|
+
return (_jsxs(Popover, { open: open, onOpenChange: handleOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { ref: triggerRef, type: "button", variant: "ghost", size: "sm", disabled: disabled || !currentPreset, "aria-label": `Model and effort: ${currentPreset?.modelName ?? 'Unavailable'}, ${currentPreset?.effortLabel ?? 'Unavailable'}`, className: cn('text-foreground hover:bg-muted h-8 min-w-0 cursor-pointer gap-1.5 overflow-hidden rounded-full px-2.5 text-xs font-medium transition-colors', open ? 'max-w-none' : 'w-auto max-w-[220px]'), style: { width: open ? EXPANDED_TRIGGER_WIDTH : undefined }, children: [_jsx(Zap, { className: "size-4 shrink-0" }), _jsx("span", { className: "min-w-0 max-w-[110px] truncate", children: currentPreset?.modelName }), _jsx("span", { className: cn('shrink-0 font-normal transition-colors duration-300', isMaxPower ? 'text-model-effort-purple' : 'text-muted-foreground'), children: currentPreset?.effortLabel }), _jsx(ChevronDown, { className: "text-muted-foreground size-3 shrink-0" })] }) }), _jsxs(PopoverContent, { align: "end", side: "top", sideOffset: 8, collisionPadding: 12, className: "model-effort-popover rounded-2xl p-2.5 shadow-xl", style: { width: EXPANDED_TRIGGER_WIDTH }, children: [showProviderToggle ? (_jsxs("div", { className: "border-border bg-muted relative mx-auto mb-2.5 flex w-fit items-center rounded-full border p-0.5", role: "group", "aria-label": "AI provider", children: [_jsx("div", { "aria-hidden": "true", className: "bg-background absolute inset-y-0.5 left-0.5 w-12 rounded-full shadow-sm transition-transform duration-200 ease-out", style: {
|
|
148
|
+
transform: `translateX(${activeProviderIndex * 3}rem)`,
|
|
149
|
+
} }), providers.map((provider) => {
|
|
150
|
+
const active = provider.id === activeProviderId;
|
|
151
|
+
return (_jsx("button", { type: "button", onClick: () => handleProviderChange(provider.id), disabled: disabled, "aria-label": provider.name, "aria-pressed": active, className: cn('relative z-10 inline-flex h-8 w-12 cursor-pointer items-center justify-center rounded-full transition-opacity disabled:cursor-not-allowed disabled:opacity-50', active ? 'opacity-100' : 'opacity-45 hover:opacity-80'), children: _jsx("span", { className: "flex size-4 items-center justify-center [&>img]:size-4", children: provider.icon }) }, provider.id));
|
|
152
|
+
})] })) : null, _jsxs("div", { className: "text-muted-foreground flex items-center justify-between px-1 text-[11px] font-medium", children: [_jsx("span", { children: "Faster" }), _jsx("span", { children: "Smarter" })] }), _jsxs("div", { className: "relative mt-1.5 h-8", children: [_jsx(Slider, { "aria-label": "Model intelligence", value: [visiblePresetIndex], min: 0, max: maxPresetIndex, step: 1, disabled: disabled || activePresets.length === 0, onValueChange: ([nextIndex]) => {
|
|
153
|
+
if (typeof nextIndex === 'number') {
|
|
154
|
+
preparePresetEffects(activePresets[nextIndex]);
|
|
155
|
+
setPreviewPresetIndex(nextIndex);
|
|
156
|
+
}
|
|
157
|
+
}, onValueCommit: ([nextIndex]) => {
|
|
158
|
+
const nextPreset = activePresets[nextIndex ?? -1];
|
|
159
|
+
preparePresetEffects(nextPreset);
|
|
160
|
+
setPreviewPresetIndex(null);
|
|
161
|
+
if (nextPreset) {
|
|
162
|
+
onSelectionChange(nextPreset.modelId, nextPreset.effort);
|
|
163
|
+
}
|
|
164
|
+
}, onPointerDown: () => setIsDragging(true), onPointerUp: () => setIsDragging(false), onPointerCancel: () => setIsDragging(false), thumbContent: isMaxPower && revealMax && maxBurstKey > 0 ? (_jsx(MaxThumbBurst, {}, maxBurstKey)) : null, className: cn('[&_[data-slot=slider-thumb]]:border-foreground/20 [&_[data-slot=slider-track]]:border-border [&_[data-slot=slider-track]]:bg-foreground/10 h-8 [&>span:last-child]:z-20 [&>span:last-child]:transition-[left] [&>span:last-child]:ease-[cubic-bezier(.23,1,.32,1)] [&_[data-slot=slider-range]]:bg-transparent [&_[data-slot=slider-thumb]]:relative [&_[data-slot=slider-thumb]]:isolate [&_[data-slot=slider-thumb]]:z-20 [&_[data-slot=slider-thumb]]:size-7 [&_[data-slot=slider-thumb]]:border-[0.5px] [&_[data-slot=slider-thumb]]:bg-white [&_[data-slot=slider-thumb]]:shadow-[0_1px_4px_rgba(0,0,0,0.18)] [&_[data-slot=slider-thumb]]:hover:ring-0 [&_[data-slot=slider-track]]:h-6 [&_[data-slot=slider-track]]:border', !thumbMotionReady
|
|
165
|
+
? '[&>span:last-child]:duration-0'
|
|
166
|
+
: isDragging
|
|
167
|
+
? '[&>span:last-child]:duration-150'
|
|
168
|
+
: '[&>span:last-child]:duration-300') }), _jsx("div", { "aria-hidden": "true", className: cn('bg-model-effort-blue pointer-events-none absolute left-px top-[5px] z-[1] h-[22px] overflow-hidden rounded-full transition-[width] ease-[cubic-bezier(.23,1,.32,1)]', !thumbMotionReady
|
|
169
|
+
? 'duration-0'
|
|
170
|
+
: isDragging
|
|
171
|
+
? 'duration-150'
|
|
172
|
+
: 'duration-300'), style: { width: fillWidth(visiblePresetIndex, maxPresetIndex) }, children: powerLevel !== null ? (_jsx(ModelEffortRangeEffects, { level: powerLevel, reveal: revealMax }, powerLevel)) : null }), _jsx("div", { className: cn('pointer-events-none absolute inset-0 z-[1] transition-[opacity,transform] ease-[cubic-bezier(.23,1,.32,1)]', isMaxPower
|
|
173
|
+
? 'scale-75 opacity-0 delay-100 duration-[400ms]'
|
|
174
|
+
: 'scale-100 opacity-100 duration-300'), "aria-hidden": true, children: activePresets.map((preset, index) => (_jsx("span", { className: cn('absolute top-1/2 size-1 -translate-x-1/2 -translate-y-1/2 rounded-full transition-[background-color,transform] duration-300 ease-[cubic-bezier(.23,1,.32,1)]', index <= visiblePresetIndex
|
|
175
|
+
? powerLevel === 'light' || powerLevel === 'medium'
|
|
176
|
+
? 'bg-model-effort-blue/45'
|
|
177
|
+
: 'bg-white/55'
|
|
178
|
+
: 'bg-muted-foreground/45'), style: { left: tickPosition(index, maxPresetIndex) } }, preset.id))) })] })] })] }));
|
|
179
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-effort-ultra-effects.d.ts","sourceRoot":"","sources":["../../../src/components/chat/model-effort-ultra-effects.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,2CAgChE;AAED,wBAAgB,eAAe,4CAuB9B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const TRACK_PARTICLES = [
|
|
3
|
+
[6, 72, 3, -4, 2.1, -0.8, 0.72],
|
|
4
|
+
[9, 35, -2, 4, 2.8, -1.9, 0.48],
|
|
5
|
+
[18, 58, 4, -3, 1.9, -0.4, 0.82],
|
|
6
|
+
[29, 26, -3, 5, 3.1, -2.4, 0.56],
|
|
7
|
+
[38, 70, 2, -5, 2.5, -1.1, 0.68],
|
|
8
|
+
[46, 43, -4, 3, 2.9, -2.2, 0.9],
|
|
9
|
+
[55, 72, 3, -4, 2.2, -1.6, 0.58],
|
|
10
|
+
[63, 31, -2, 5, 3.2, -0.7, 0.72],
|
|
11
|
+
[71, 61, 4, -3, 2.4, -1.8, 0.48],
|
|
12
|
+
[78, 27, -3, 4, 2.7, -2.5, 0.86],
|
|
13
|
+
[84, 70, 2, -5, 2, -0.6, 0.62],
|
|
14
|
+
[89, 43, -4, 3, 3, -2.1, 0.9],
|
|
15
|
+
[93, 67, 3, -4, 2.3, -1.3, 0.7],
|
|
16
|
+
[96, 32, -2, 5, 2.8, -0.2, 0.54],
|
|
17
|
+
];
|
|
18
|
+
const BURST_PARTICLES = [
|
|
19
|
+
[-32, -3],
|
|
20
|
+
[-28, -17],
|
|
21
|
+
[-19, -29],
|
|
22
|
+
[-5, -34],
|
|
23
|
+
[10, -32],
|
|
24
|
+
[24, -24],
|
|
25
|
+
[32, -11],
|
|
26
|
+
[35, 4],
|
|
27
|
+
[29, 19],
|
|
28
|
+
[18, 30],
|
|
29
|
+
[3, 35],
|
|
30
|
+
[-12, 32],
|
|
31
|
+
[-25, 24],
|
|
32
|
+
[-34, 11],
|
|
33
|
+
[20, -7],
|
|
34
|
+
[-16, 9],
|
|
35
|
+
];
|
|
36
|
+
export function UltraRangeEffects({ reveal }) {
|
|
37
|
+
return (_jsxs("span", { "aria-hidden": "true", className: "model-effort-ultra-fill", "data-reveal": reveal, children: [_jsx("span", { className: "model-effort-ultra-field" }), _jsx("span", { className: "model-effort-ultra-particles", children: TRACK_PARTICLES.map(([left, top, driftX, driftY, duration, delay, opacity], index) => (_jsx("span", { className: "model-effort-ultra-particle", style: {
|
|
38
|
+
left: `${left}%`,
|
|
39
|
+
top: `${top}%`,
|
|
40
|
+
'--particle-drift-x': `${driftX}px`,
|
|
41
|
+
'--particle-drift-y': `${driftY}px`,
|
|
42
|
+
'--particle-opacity': opacity,
|
|
43
|
+
animationDuration: `${duration}s`,
|
|
44
|
+
animationDelay: `${delay}s`,
|
|
45
|
+
} }, index))) })] }));
|
|
46
|
+
}
|
|
47
|
+
export function UltraThumbBurst() {
|
|
48
|
+
return (_jsx("span", { "aria-hidden": "true", className: "model-effort-ultra-burst", children: BURST_PARTICLES.map(([x, y], index) => (_jsx("span", { className: "model-effort-ultra-burst-particle", style: {
|
|
49
|
+
'--burst-x': `${x}px`,
|
|
50
|
+
'--burst-y': `${y}px`,
|
|
51
|
+
animationDelay: `${(index % 4) * 12}ms`,
|
|
52
|
+
backgroundColor: index % 3 === 0
|
|
53
|
+
? 'var(--model-effort-blue)'
|
|
54
|
+
: 'var(--model-effort-purple)',
|
|
55
|
+
} }, index))) }));
|
|
56
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-handlers.d.ts","sourceRoot":"","sources":["../../../src/components/chat/tool-handlers.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"tool-handlers.d.ts","sourceRoot":"","sources":["../../../src/components/chat/tool-handlers.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAGhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAW5D,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAEtE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,SAAS,GAAG,UAAU,CAAA;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,OAAO,CAAA;CACd;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IAExB,YAAY,EAAE,MAAM,CAAA;IAEpB,MAAM,CAAC,EAAE,sBAAsB,CAAA;IAE/B,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,SAAS,CAAA;IAGhE,aAAa,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,SAAS,CAAA;IAG7C,eAAe,CAAC,EAAE,CAChB,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,qBAAqB,KAC5B,SAAS,CAAA;IAGd,cAAc,CAAC,EAAE,CACf,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,uBAAuB,KAC/B,SAAS,CAAA;CACf,CAAA;AAqSD;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CA81E7D,CAAA;AAoBD;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAmC5D"}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { AlertTriangle, BookOpen, Camera, Check, CheckCheck, Copy, Database, Download, FileCode, FileText, FolderOpen, Globe, Info, Package, Plus, Search, Sparkles, Terminal, Trash2, X, } from 'lucide-react';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
|
+
import { ChatImageLightbox } from './chat-image-lightbox';
|
|
6
7
|
import { ThinkingTimelineMarker } from './thinking-timeline';
|
|
7
8
|
import { ToolApproval, ToolApprovalAction, ToolApprovalActions, ToolApprovalDangerousHelp, ToolApprovalHeader, ToolApprovalHelp, ToolApprovalRequest, ToolApprovalSandboxHelp, } from './tool-approval';
|
|
8
9
|
/**
|
|
@@ -123,11 +124,48 @@ export const DEFAULT_TOOL_HANDLERS = {
|
|
|
123
124
|
if (!result) {
|
|
124
125
|
return (_jsx(LoadingIndicator, { icon: Sparkles, children: "Viewing image..." }, toolCallId));
|
|
125
126
|
}
|
|
127
|
+
const parts = Array.isArray(result.value) ? result.value : [];
|
|
128
|
+
const image = parts.find((part) => (part.type === 'image-data' || part.type === 'media') &&
|
|
129
|
+
part.data &&
|
|
130
|
+
part.mediaType?.startsWith('image/'));
|
|
131
|
+
const imageSrc = result.imageUrl ??
|
|
132
|
+
(image?.data && image.mediaType
|
|
133
|
+
? `data:${image.mediaType};base64,${image.data}`
|
|
134
|
+
: undefined);
|
|
135
|
+
if (imageSrc) {
|
|
136
|
+
return (_jsxs("details", { className: "border-border bg-muted text-muted-foreground my-1 max-w-2xl overflow-hidden rounded-md border text-xs", children: [_jsxs("summary", { className: "flex cursor-pointer list-none items-center gap-2 px-2 py-1.5", children: [_jsx(Sparkles, { className: "size-3.5 shrink-0" }), _jsx("span", { className: "min-w-0 truncate", children: result.imagePath
|
|
137
|
+
? `Viewed ${getFileName(result.imagePath)}`
|
|
138
|
+
: 'Viewed image' })] }), _jsx("div", { className: "border-border border-t p-2", children: _jsx(ChatImageLightbox, { src: imageSrc, alt: result.imagePath
|
|
139
|
+
? getFileName(result.imagePath)
|
|
140
|
+
: 'Image viewed by Moldable', className: "bg-background block size-20 rounded-2xl border", imageClassName: "size-full object-cover" }) })] }, toolCallId));
|
|
141
|
+
}
|
|
126
142
|
return (_jsxs("div", { className: "bg-muted text-muted-foreground my-1 inline-flex max-w-full items-center gap-2 rounded-md px-2 py-1 text-xs", children: [_jsx(Sparkles, { className: "size-3.5 shrink-0" }), _jsx("span", { className: "min-w-0 truncate", children: result.imagePath
|
|
127
143
|
? `Viewed ${getFileName(result.imagePath)}`
|
|
128
144
|
: 'Viewed image' })] }, toolCallId));
|
|
129
145
|
},
|
|
130
146
|
},
|
|
147
|
+
showImages: {
|
|
148
|
+
loadingLabel: 'Showing images...',
|
|
149
|
+
marker: ThinkingTimelineMarker.Default,
|
|
150
|
+
inline: true,
|
|
151
|
+
renderLoading: (args) => {
|
|
152
|
+
const { images } = (args ?? {});
|
|
153
|
+
const count = images?.length ?? 0;
|
|
154
|
+
return (_jsx(LoadingIndicator, { icon: Sparkles, children: count === 1 && images?.[0]?.imagePath
|
|
155
|
+
? `Showing ${getFileName(images[0].imagePath)}...`
|
|
156
|
+
: count > 1
|
|
157
|
+
? `Showing ${count} images...`
|
|
158
|
+
: 'Showing images...' }));
|
|
159
|
+
},
|
|
160
|
+
renderOutput: (output, toolCallId) => {
|
|
161
|
+
const result = output;
|
|
162
|
+
const images = result?.images?.filter((image) => Boolean(image.imageUrl));
|
|
163
|
+
if (!images?.length) {
|
|
164
|
+
return (_jsx(LoadingIndicator, { icon: Sparkles, children: "Showing images..." }, toolCallId));
|
|
165
|
+
}
|
|
166
|
+
return (_jsx("div", { className: "my-2 flex max-w-full gap-2 overflow-x-auto", children: images.map((image, index) => (_jsx(ChatImageLightbox, { src: image.imageUrl, alt: image.altText || image.filename || 'Image shown by Moldable', className: "border-border bg-muted block size-20 shrink-0 rounded-2xl border", imageClassName: "size-full object-cover" }, `${image.imageUrl}-${index}`))) }, toolCallId));
|
|
167
|
+
},
|
|
168
|
+
},
|
|
131
169
|
generateImage: {
|
|
132
170
|
loadingLabel: 'Generating image...',
|
|
133
171
|
marker: ThinkingTimelineMarker.Default,
|
|
@@ -165,7 +203,7 @@ export const DEFAULT_TOOL_HANDLERS = {
|
|
|
165
203
|
? `Generated image saved at ${result.imagePath}.`
|
|
166
204
|
: 'Generated image saved.' })] }, toolCallId));
|
|
167
205
|
}
|
|
168
|
-
return (_jsxs("figure", { className: "my-2 min-w-0 max-w-2xl", children: [_jsx(
|
|
206
|
+
return (_jsxs("figure", { className: "my-2 min-w-0 max-w-2xl", children: [_jsx(ChatImageLightbox, { src: imageSrc, alt: result.prompt || 'Generated image', className: "border-border bg-muted block max-w-full rounded-2xl border", imageClassName: "block max-h-[420px] w-full object-contain" }), _jsxs("figcaption", { className: "text-muted-foreground mt-1 flex min-w-0 items-center gap-1 text-xs", children: [_jsx(Sparkles, { className: "size-3 shrink-0" }), _jsx("span", { className: "truncate", children: result.imagePath
|
|
169
207
|
? `${getFileName(result.imagePath)}${result.size ? ` - ${result.size}` : ''}`
|
|
170
208
|
: result.size || 'Generated image' })] })] }, toolCallId));
|
|
171
209
|
},
|
|
@@ -193,7 +231,7 @@ export const DEFAULT_TOOL_HANDLERS = {
|
|
|
193
231
|
if (!image?.data || !image.mediaType) {
|
|
194
232
|
return (_jsxs("div", { className: "bg-muted text-muted-foreground my-1 inline-flex max-w-full items-center gap-2 rounded-md px-2 py-1 text-xs", children: [_jsx(Camera, { className: "size-3.5 shrink-0" }), _jsx("span", { className: "truncate", children: text || 'Screenshot captured' }), _jsx(Check, { className: "size-3 shrink-0 text-green-600" })] }, toolCallId));
|
|
195
233
|
}
|
|
196
|
-
return (_jsxs("figure", { className: "my-2 min-w-0 max-w-2xl", children: [_jsx(
|
|
234
|
+
return (_jsxs("figure", { className: "my-2 min-w-0 max-w-2xl", children: [_jsx(ChatImageLightbox, { src: `data:${image.mediaType};base64,${image.data}`, alt: "Current app screenshot", className: "border-border bg-muted block max-w-full rounded-2xl border", imageClassName: "block max-h-[420px] w-full object-contain" }), text && (_jsxs("figcaption", { className: "text-muted-foreground mt-1 flex items-center gap-1 text-xs", children: [_jsx(Camera, { className: "size-3" }), _jsx("span", { className: "truncate", children: text })] }))] }, toolCallId));
|
|
197
235
|
},
|
|
198
236
|
},
|
|
199
237
|
listMoldableAppApi: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical-scroll-fade.d.ts","sourceRoot":"","sources":["../../../src/components/chat/vertical-scroll-fade.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,OAAO,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,wBAAgB,qBAAqB,CACnC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,uBAAuB,EACxC,QAAQ,SAAW,GAClB,MAAM,CAWR"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function getVerticalScrollMask({ top, bottom }, fadeSize = '2.5rem') {
|
|
2
|
+
if (top && bottom) {
|
|
3
|
+
return `linear-gradient(to bottom, transparent 0%, black ${fadeSize}, black calc(100% - ${fadeSize}), transparent 100%)`;
|
|
4
|
+
}
|
|
5
|
+
if (top) {
|
|
6
|
+
return `linear-gradient(to bottom, transparent 0%, black ${fadeSize}, black 100%)`;
|
|
7
|
+
}
|
|
8
|
+
if (bottom) {
|
|
9
|
+
return `linear-gradient(to bottom, black 0%, black calc(100% - ${fadeSize}), transparent 100%)`;
|
|
10
|
+
}
|
|
11
|
+
return 'none';
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type BluetoothSubscriptionCleanup = () => Promise<void>;
|
|
2
|
+
/**
|
|
3
|
+
* Stops every active observer before returning. Successful entries are removed,
|
|
4
|
+
* while failed entries stay registered so the caller can retry cleanup.
|
|
5
|
+
*/
|
|
6
|
+
export declare function cleanupBluetoothSubscriptions(subscriptions: Map<string, BluetoothSubscriptionCleanup>): Promise<void>;
|
|
7
|
+
/** Parses a compact or separator-delimited hexadecimal Bluetooth value. */
|
|
8
|
+
export declare function parseBluetoothHexBytes(value: string): Uint8Array<ArrayBuffer>;
|
|
9
|
+
//# sourceMappingURL=bluetooth-panel-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bluetooth-panel-helpers.d.ts","sourceRoot":"","sources":["../../../src/components/hardware/bluetooth-panel-helpers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,4BAA4B,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;AAE9D;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,GACvD,OAAO,CAAC,IAAI,CAAC,CAef;AAED,2EAA2E;AAC3E,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,CAqB7E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stops every active observer before returning. Successful entries are removed,
|
|
3
|
+
* while failed entries stay registered so the caller can retry cleanup.
|
|
4
|
+
*/
|
|
5
|
+
export async function cleanupBluetoothSubscriptions(subscriptions) {
|
|
6
|
+
const failures = [];
|
|
7
|
+
await Promise.all([...subscriptions].map(async ([key, stop]) => {
|
|
8
|
+
try {
|
|
9
|
+
await stop();
|
|
10
|
+
if (subscriptions.get(key) === stop)
|
|
11
|
+
subscriptions.delete(key);
|
|
12
|
+
}
|
|
13
|
+
catch (cause) {
|
|
14
|
+
failures.push(cause);
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
if (failures.length > 0)
|
|
18
|
+
throw failures[0];
|
|
19
|
+
}
|
|
20
|
+
/** Parses a compact or separator-delimited hexadecimal Bluetooth value. */
|
|
21
|
+
export function parseBluetoothHexBytes(value) {
|
|
22
|
+
const normalized = value
|
|
23
|
+
.trim()
|
|
24
|
+
.replace(/0x/gi, '')
|
|
25
|
+
.replace(/[\s,:-]+/g, '');
|
|
26
|
+
if (normalized.length === 0) {
|
|
27
|
+
throw new TypeError('Enter at least one hexadecimal byte.');
|
|
28
|
+
}
|
|
29
|
+
if (normalized.length % 2 !== 0 || !/^[0-9a-f]+$/i.test(normalized)) {
|
|
30
|
+
throw new TypeError('Use complete hexadecimal bytes, such as 01 A0 FF.');
|
|
31
|
+
}
|
|
32
|
+
const bytes = new Uint8Array(new ArrayBuffer(normalized.length / 2));
|
|
33
|
+
for (let index = 0; index < bytes.length; index++) {
|
|
34
|
+
bytes[index] = Number.parseInt(normalized.slice(index * 2, index * 2 + 2), 16);
|
|
35
|
+
}
|
|
36
|
+
return bytes;
|
|
37
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MoldableBluetoothConnection, type MoldableBluetoothDevice, type MoldableBluetoothRemoteGATTCharacteristic, type MoldableNativeBluetoothDevice } from '../../lib/native-hardware';
|
|
3
|
+
export type MoldableBluetoothStatus = 'idle' | 'requesting' | 'connecting' | 'connected' | 'error';
|
|
4
|
+
export interface MoldableBluetoothCharacteristicInfo {
|
|
5
|
+
serviceUuid: string;
|
|
6
|
+
uuid: string;
|
|
7
|
+
/** Property names when the runtime exposes them; empty when unknown. */
|
|
8
|
+
properties: string[];
|
|
9
|
+
/** Web Bluetooth handle; null on the desktop bridge (UUIDs drive I/O). */
|
|
10
|
+
characteristic: MoldableBluetoothRemoteGATTCharacteristic | null;
|
|
11
|
+
}
|
|
12
|
+
export interface MoldableBluetoothServiceInfo {
|
|
13
|
+
uuid: string;
|
|
14
|
+
characteristics: MoldableBluetoothCharacteristicInfo[];
|
|
15
|
+
}
|
|
16
|
+
export interface UseMoldableBluetoothOptions {
|
|
17
|
+
onValue?: (characteristic: MoldableBluetoothCharacteristicInfo, value: DataView) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Bluetooth LE state machine behind `BluetoothPanel`. Handles both transports
|
|
21
|
+
* returned by `requestMoldableBluetoothWithFallback`: Web Bluetooth (GATT
|
|
22
|
+
* connection + service discovery) and the desktop bridge (UUID-addressed I/O
|
|
23
|
+
* on an already-connected device).
|
|
24
|
+
*/
|
|
25
|
+
export declare function useMoldableBluetooth(options?: UseMoldableBluetoothOptions): {
|
|
26
|
+
status: MoldableBluetoothStatus;
|
|
27
|
+
device: MoldableBluetoothDevice | MoldableNativeBluetoothDevice | null;
|
|
28
|
+
connection: MoldableBluetoothConnection | null;
|
|
29
|
+
disconnecting: boolean;
|
|
30
|
+
services: MoldableBluetoothServiceInfo[];
|
|
31
|
+
subscribedUuids: string[];
|
|
32
|
+
error: Error | null;
|
|
33
|
+
entries: import("./stream-log").StreamLogEntry[];
|
|
34
|
+
request: (serviceUuid?: string) => Promise<void>;
|
|
35
|
+
connect: () => Promise<void>;
|
|
36
|
+
disconnect: () => Promise<void>;
|
|
37
|
+
read: (characteristic: MoldableBluetoothCharacteristicInfo) => Promise<void>;
|
|
38
|
+
subscribe: (characteristic: MoldableBluetoothCharacteristicInfo) => Promise<void>;
|
|
39
|
+
unsubscribe: (characteristic: MoldableBluetoothCharacteristicInfo) => Promise<void>;
|
|
40
|
+
write: (characteristic: MoldableBluetoothCharacteristicInfo, bytes: BufferSource) => Promise<void>;
|
|
41
|
+
writeHex: (characteristic: MoldableBluetoothCharacteristicInfo, value: string) => Promise<void>;
|
|
42
|
+
clearEntries: () => void;
|
|
43
|
+
};
|
|
44
|
+
export interface BluetoothPanelProps extends React.ComponentProps<'div'> {
|
|
45
|
+
/** Prefill and scope scanning/discovery to one GATT service UUID. */
|
|
46
|
+
serviceUuid?: string;
|
|
47
|
+
onValue?: (characteristic: MoldableBluetoothCharacteristicInfo, value: DataView) => void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Bluetooth LE panel: scan (optionally scoped to a service UUID), connect,
|
|
51
|
+
* browse discovered characteristics, and read, write, or subscribe to values
|
|
52
|
+
* with a live hex log.
|
|
53
|
+
*/
|
|
54
|
+
declare function BluetoothPanel({ className, serviceUuid, onValue, ...props }: BluetoothPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
export { BluetoothPanel };
|
|
56
|
+
//# sourceMappingURL=bluetooth-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bluetooth-panel.d.ts","sourceRoot":"","sources":["../../../src/components/hardware/bluetooth-panel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,yCAAyC,EAG9C,KAAK,6BAA6B,EAQnC,MAAM,2BAA2B,CAAA;AAqBlC,MAAM,MAAM,uBAAuB,GAC/B,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,OAAO,CAAA;AAgDX,MAAM,WAAW,mCAAmC;IAClD,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,wEAAwE;IACxE,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,0EAA0E;IAC1E,cAAc,EAAE,yCAAyC,GAAG,IAAI,CAAA;CACjE;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,mCAAmC,EAAE,CAAA;CACvD;AA+ED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,CACR,cAAc,EAAE,mCAAmC,EACnD,KAAK,EAAE,QAAQ,KACZ,IAAI,CAAA;CACV;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,2BAAgC;;;;;;;;;4BAkJlB,MAAM;;;2BAiDJ,mCAAmC;gCA0BnC,mCAAmC;kCAqCnC,mCAAmC;4BAqBxC,mCAAmC,SAC5C,YAAY;+BAmCH,mCAAmC,SAC5C,MAAM;;EAsClB;AAED,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACtE,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,CACR,cAAc,EAAE,mCAAmC,EACnD,KAAK,EAAE,QAAQ,KACZ,IAAI,CAAA;CACV;AAED;;;;GAIG;AACH,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,WAAW,EACX,OAAO,EACP,GAAG,KAAK,EACT,EAAE,mBAAmB,2CAiPrB;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|