@moldable-ai/ui 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog/catalog-coverage.d.ts +15 -0
- package/dist/catalog/catalog-coverage.d.ts.map +1 -0
- package/dist/catalog/catalog-coverage.js +44 -0
- 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 +117 -0
- package/dist/catalog/catalog-types.d.ts +64 -0
- package/dist/catalog/catalog-types.d.ts.map +1 -0
- package/dist/catalog/catalog-types.js +20 -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 +49 -0
- package/dist/catalog/core-catalog-exclusions.d.ts +8 -0
- package/dist/catalog/core-catalog-exclusions.d.ts.map +1 -0
- package/dist/catalog/core-catalog-exclusions.js +151 -0
- package/dist/catalog/core-catalog.d.ts +2 -0
- package/dist/catalog/core-catalog.d.ts.map +1 -0
- package/dist/catalog/core-catalog.js +19 -0
- package/dist/catalog/core-collection-stories.d.ts +3 -0
- package/dist/catalog/core-collection-stories.d.ts.map +1 -0
- package/dist/catalog/core-collection-stories.js +42 -0
- package/dist/catalog/core-control-stories.d.ts +3 -0
- package/dist/catalog/core-control-stories.d.ts.map +1 -0
- package/dist/catalog/core-control-stories.js +94 -0
- package/dist/catalog/core-feedback-stories.d.ts +3 -0
- package/dist/catalog/core-feedback-stories.d.ts.map +1 -0
- package/dist/catalog/core-feedback-stories.js +50 -0
- package/dist/catalog/core-foundation-stories.d.ts +3 -0
- package/dist/catalog/core-foundation-stories.d.ts.map +1 -0
- package/dist/catalog/core-foundation-stories.js +53 -0
- package/dist/catalog/core-navigation-stories.d.ts +3 -0
- package/dist/catalog/core-navigation-stories.d.ts.map +1 -0
- package/dist/catalog/core-navigation-stories.js +25 -0
- package/dist/catalog/core-overlay-stories.d.ts +3 -0
- package/dist/catalog/core-overlay-stories.d.ts.map +1 -0
- package/dist/catalog/core-overlay-stories.js +20 -0
- package/dist/catalog/index.d.ts +7 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +6 -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 +49 -6
- package/dist/components/chat/chat-panel.d.ts.map +1 -1
- package/dist/components/chat/chat-panel.js +196 -163
- 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 +2 -2
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +1 -1
- 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/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/alert-dialog.d.ts +7 -3
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +9 -5
- package/dist/components/ui/alert.d.ts +19 -3
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +25 -8
- package/dist/components/ui/app-frame.d.ts +28 -0
- package/dist/components/ui/app-frame.d.ts.map +1 -0
- package/dist/components/ui/app-frame.js +95 -0
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/collapsible.d.ts +9 -1
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +13 -2
- package/dist/components/ui/collection-navigation.d.ts +8 -0
- package/dist/components/ui/collection-navigation.d.ts.map +1 -0
- package/dist/components/ui/collection-navigation.js +19 -0
- 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/command.d.ts +5 -1
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +13 -1
- package/dist/components/ui/confirm-dialog.d.ts +19 -0
- package/dist/components/ui/confirm-dialog.d.ts.map +1 -0
- package/dist/components/ui/confirm-dialog.js +45 -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/date-picker.d.ts +24 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/date-picker.js +92 -0
- package/dist/components/ui/dialog.d.ts +4 -2
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +8 -5
- 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.d.ts +7 -2
- package/dist/components/ui/empty.d.ts.map +1 -1
- package/dist/components/ui/empty.js +20 -7
- 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 +258 -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 +23 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +23 -0
- package/dist/components/ui/input-group.d.ts +1 -1
- 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 +28 -0
- package/dist/components/ui/list.d.ts.map +1 -0
- package/dist/components/ui/list.js +235 -0
- package/dist/components/ui/material.d.ts +34 -0
- package/dist/components/ui/material.d.ts.map +1 -0
- package/dist/components/ui/material.js +34 -0
- package/dist/components/ui/message-scroller-controller.d.ts +162 -0
- package/dist/components/ui/message-scroller-controller.d.ts.map +1 -0
- package/dist/components/ui/message-scroller-controller.js +888 -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-policy.d.ts +74 -0
- package/dist/components/ui/message-scroller-policy.d.ts.map +1 -0
- package/dist/components/ui/message-scroller-policy.js +129 -0
- package/dist/components/ui/message-scroller-primitive.d.ts +55 -0
- package/dist/components/ui/message-scroller-primitive.d.ts.map +1 -0
- package/dist/components/ui/message-scroller-primitive.js +226 -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 +25 -0
- package/dist/components/ui/navigation-button-group.d.ts +16 -0
- package/dist/components/ui/navigation-button-group.d.ts.map +1 -0
- package/dist/components/ui/navigation-button-group.js +9 -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.d.ts +9 -2
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +14 -4
- package/dist/components/ui/scroll-area.d.ts +8 -2
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +6 -3
- 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 +62 -0
- package/dist/components/ui/sheet.d.ts +4 -2
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +12 -9
- package/dist/components/ui/sidebar.js +1 -1
- 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 +33 -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.d.ts +12 -4
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/toggle.js +13 -2
- package/dist/components/ui/toolbar.d.ts +27 -0
- package/dist/components/ui/toolbar.d.ts.map +1 -0
- package/dist/components/ui/toolbar.js +71 -0
- package/dist/components/ui/tooltip.d.ts +8 -3
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +11 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/lib/frame-lifecycle.d.ts +29 -0
- package/dist/lib/frame-lifecycle.d.ts.map +1 -1
- package/dist/lib/frame-lifecycle.js +85 -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/theme.d.ts.map +1 -1
- package/dist/lib/theme.js +2 -1
- package/docs/README.md +39 -0
- package/docs/accessibility.md +32 -0
- package/docs/adaptive-materials.md +79 -0
- package/docs/app-anatomy.md +74 -0
- package/docs/component-catalog.md +82 -0
- package/docs/component-guide-template.md +37 -0
- package/docs/design-tokens.md +185 -0
- package/docs/foundations.md +58 -0
- package/docs/native-integration.md +33 -0
- package/docs/standalone-app-windows.md +136 -0
- package/package.json +8 -3
- package/src/components/ui/alert-dialog.md +31 -0
- package/src/components/ui/alert.md +77 -0
- package/src/components/ui/app-frame.md +38 -0
- package/src/components/ui/badge.md +57 -0
- package/src/components/ui/button.md +76 -0
- package/src/components/ui/collapsible.md +52 -0
- package/src/components/ui/color-well.md +11 -0
- package/src/components/ui/combobox.md +42 -0
- package/src/components/ui/command.md +54 -0
- package/src/components/ui/date-field.md +32 -0
- package/src/components/ui/date-picker.md +55 -0
- package/src/components/ui/dialog.md +40 -0
- package/src/components/ui/edge-fade.md +7 -0
- package/src/components/ui/empty.md +87 -0
- package/src/components/ui/field.md +77 -0
- package/src/components/ui/grid.md +109 -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 +140 -0
- package/src/components/ui/material.md +51 -0
- package/src/components/ui/navigation-button-group.md +46 -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/popover.md +31 -0
- package/src/components/ui/resizable.md +66 -0
- package/src/components/ui/scroll-area.md +72 -0
- package/src/components/ui/search-field.md +33 -0
- package/src/components/ui/segmented-control.md +36 -0
- package/src/components/ui/sheet.md +30 -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 +37 -0
- package/src/components/ui/tabs.md +66 -0
- package/src/components/ui/text.md +17 -0
- package/src/components/ui/toggle-button.md +48 -0
- package/src/components/ui/toggle-group.md +80 -0
- package/src/components/ui/toggle.md +73 -0
- package/src/components/ui/toolbar.md +26 -0
- package/src/components/ui/tooltip.md +31 -0
- package/src/styles/index.css +704 -3
|
@@ -3,13 +3,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
4
4
|
import { cn } from '../../lib/utils';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
|
-
const toggleVariants = cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-
|
|
6
|
+
const toggleVariants = cva("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-control-hover disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=on]:bg-control-selected data-[state=on]:text-control-selected-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[background-color,color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap", {
|
|
7
7
|
variants: {
|
|
8
8
|
variant: {
|
|
9
9
|
default: 'bg-transparent',
|
|
10
10
|
outline: 'border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground',
|
|
11
|
+
filled: 'bg-muted/70 text-foreground shadow-xs',
|
|
11
12
|
},
|
|
12
13
|
size: {
|
|
14
|
+
xs: 'h-6 min-w-6 gap-1 px-1.5 text-xs [&_svg:not([class*="size-"])]:size-3',
|
|
13
15
|
default: 'h-9 px-2 min-w-9',
|
|
14
16
|
sm: 'h-8 px-1.5 min-w-8',
|
|
15
17
|
lg: 'h-10 px-2.5 min-w-10',
|
|
@@ -23,4 +25,13 @@ const toggleVariants = cva("inline-flex items-center justify-center gap-2 rounde
|
|
|
23
25
|
function Toggle({ className, variant, size, ...props }) {
|
|
24
26
|
return (_jsx(TogglePrimitive.Root, { "data-slot": "toggle", className: cn(toggleVariants({ variant, size, className })), ...props }));
|
|
25
27
|
}
|
|
26
|
-
|
|
28
|
+
const iconOnlySizeClasses = {
|
|
29
|
+
xs: 'size-6 min-w-6 p-0',
|
|
30
|
+
sm: 'size-8 min-w-8 p-0',
|
|
31
|
+
default: 'size-9 min-w-9 p-0',
|
|
32
|
+
lg: 'size-10 min-w-10 p-0',
|
|
33
|
+
};
|
|
34
|
+
function ToggleButton({ className, iconOnly = false, size = 'default', ...props }) {
|
|
35
|
+
return (_jsx(Toggle, { "data-slot": "toggle-button", "data-icon-only": iconOnly || undefined, size: size, className: cn(iconOnly && iconOnlySizeClasses[size ?? 'default'], className), ...props }));
|
|
36
|
+
}
|
|
37
|
+
export { Toggle, ToggleButton, toggleVariants, };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MaterialVariant } from './material';
|
|
3
|
+
import { Separator } from './separator';
|
|
4
|
+
import { Text } from './text';
|
|
5
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
6
|
+
declare const toolbarVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "plain" | "panel" | null | undefined;
|
|
8
|
+
material?: "regular" | "clear" | "none" | null | undefined;
|
|
9
|
+
density?: "default" | "compact" | "comfortable" | null | undefined;
|
|
10
|
+
position?: "static" | "top" | "bottom" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
export interface ToolbarProps extends React.ComponentProps<'header'>, VariantProps<typeof toolbarVariants> {
|
|
13
|
+
/**
|
|
14
|
+
* Defaults to regular material for the default toolbar and no material for
|
|
15
|
+
* plain or panel variants.
|
|
16
|
+
*/
|
|
17
|
+
material?: MaterialVariant | 'none';
|
|
18
|
+
}
|
|
19
|
+
declare function Toolbar({ variant, density, position, material, className, ...props }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function ToolbarGroup({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function ToolbarContent({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function ToolbarTitle({ className, ...props }: React.ComponentProps<typeof Text>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function ToolbarDescription({ className, ...props }: React.ComponentProps<typeof Text>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function ToolbarActions({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
declare function ToolbarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export { Toolbar, ToolbarActions, ToolbarContent, ToolbarDescription, ToolbarGroup, ToolbarSeparator, ToolbarTitle, toolbarVariants, };
|
|
27
|
+
//# sourceMappingURL=toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/toolbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAEjE,QAAA,MAAM,eAAe;;;;;8EAsCpB,CAAA;AAED,MAAM,WAAW,YACf,SAAQ,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EACpC,YAAY,CAAC,OAAO,eAAe,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAAA;CACpC;AAED,iBAAS,OAAO,CAAC,EACf,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,YAAY,2CAyBd;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQzE;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQ3E;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,2CAWnC;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,2CAYnC;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQ3E;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,2CASxC;AAED,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,eAAe,GAChB,CAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
import { Separator } from './separator';
|
|
5
|
+
import { Text } from './text';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
7
|
+
const toolbarVariants = cva('z-20 flex w-full shrink-0 items-center gap-2 px-3', {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'border-border/70 border-b',
|
|
11
|
+
plain: 'bg-transparent',
|
|
12
|
+
panel: 'border-border/60 border-b',
|
|
13
|
+
},
|
|
14
|
+
material: {
|
|
15
|
+
regular: 'moldable-material',
|
|
16
|
+
clear: 'moldable-material',
|
|
17
|
+
none: '',
|
|
18
|
+
},
|
|
19
|
+
density: {
|
|
20
|
+
compact: 'min-h-8 py-1',
|
|
21
|
+
default: 'min-h-10 py-1.5',
|
|
22
|
+
comfortable: 'min-h-12 py-2',
|
|
23
|
+
},
|
|
24
|
+
position: {
|
|
25
|
+
static: '',
|
|
26
|
+
top: 'sticky top-0',
|
|
27
|
+
bottom: 'sticky bottom-0 border-t border-b-0',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
compoundVariants: [
|
|
31
|
+
{
|
|
32
|
+
variant: 'panel',
|
|
33
|
+
material: 'none',
|
|
34
|
+
className: 'bg-muted/35',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
variant: 'default',
|
|
39
|
+
density: 'compact',
|
|
40
|
+
position: 'static',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
function Toolbar({ variant, density, position, material, className, ...props }) {
|
|
44
|
+
const resolvedVariant = variant ?? 'default';
|
|
45
|
+
const resolvedMaterial = material ?? (resolvedVariant === 'default' ? 'regular' : 'none');
|
|
46
|
+
return (_jsx("header", { "data-slot": "toolbar", "data-density": density ?? 'compact', "data-position": position ?? 'static', "data-variant": resolvedVariant, "data-material": resolvedMaterial === 'none' ? undefined : resolvedMaterial, "data-material-elevation": resolvedMaterial === 'none' ? undefined : 'none', className: cn(toolbarVariants({
|
|
47
|
+
variant: resolvedVariant,
|
|
48
|
+
material: resolvedMaterial,
|
|
49
|
+
density,
|
|
50
|
+
position,
|
|
51
|
+
}), className), ...props }));
|
|
52
|
+
}
|
|
53
|
+
function ToolbarGroup({ className, ...props }) {
|
|
54
|
+
return (_jsx("div", { "data-slot": "toolbar-group", className: cn('flex min-w-0 items-center gap-1.5', className), ...props }));
|
|
55
|
+
}
|
|
56
|
+
function ToolbarContent({ className, ...props }) {
|
|
57
|
+
return (_jsx("div", { "data-slot": "toolbar-content", className: cn('flex min-w-0 flex-1 flex-col', className), ...props }));
|
|
58
|
+
}
|
|
59
|
+
function ToolbarTitle({ className, ...props }) {
|
|
60
|
+
return (_jsx(Text, { as: "h2", variant: "strong", truncate: true, "data-slot": "toolbar-title", className: className, ...props }));
|
|
61
|
+
}
|
|
62
|
+
function ToolbarDescription({ className, ...props }) {
|
|
63
|
+
return (_jsx(Text, { as: "p", variant: "small", color: "secondary", truncate: true, "data-slot": "toolbar-description", className: className, ...props }));
|
|
64
|
+
}
|
|
65
|
+
function ToolbarActions({ className, ...props }) {
|
|
66
|
+
return (_jsx("div", { "data-slot": "toolbar-actions", className: cn('ml-auto flex shrink-0 items-center gap-1', className), ...props }));
|
|
67
|
+
}
|
|
68
|
+
function ToolbarSeparator({ className, ...props }) {
|
|
69
|
+
return (_jsx(Separator, { orientation: "vertical", "data-slot": "toolbar-separator", className: cn('mx-1 h-4', className), ...props }));
|
|
70
|
+
}
|
|
71
|
+
export { Toolbar, ToolbarActions, ToolbarContent, ToolbarDescription, ToolbarGroup, ToolbarSeparator, ToolbarTitle, toolbarVariants, };
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
|
|
3
|
+
import { KbdGroup } from './kbd';
|
|
4
|
+
import { type MaterialVariant } from './material';
|
|
5
|
+
declare function TooltipProvider({ delayDuration, skipDelayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
|
|
4
6
|
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>
|
|
7
|
-
|
|
8
|
+
declare function TooltipContent({ className, material, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content> & {
|
|
9
|
+
material?: MaterialVariant;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function TooltipShortcut({ className, ...props }: React.ComponentProps<typeof KbdGroup>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipShortcut, TooltipTrigger, };
|
|
8
13
|
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/ui/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/ui/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAE3D,iBAAS,eAAe,CAAC,EACvB,aAAmB,EACnB,iBAAuB,EACvB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,2CASxD;AAED,iBAAS,OAAO,CAAC,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAEpD;AAED,iBAAS,cAAc,CAAC,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,2CAEvD;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,QAAoB,EACpB,UAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,GAAG;IACzD,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC3B,2CAqBA;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,2CAQvC;AAED,OAAO,EACL,OAAO,EACP,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,GACf,CAAA"}
|
|
@@ -2,16 +2,21 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
4
4
|
import { cn } from '../../lib/utils';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { KbdGroup } from './kbd';
|
|
6
|
+
import { Material } from './material';
|
|
7
|
+
function TooltipProvider({ delayDuration = 500, skipDelayDuration = 300, ...props }) {
|
|
8
|
+
return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration: delayDuration, skipDelayDuration: skipDelayDuration, ...props }));
|
|
7
9
|
}
|
|
8
10
|
function Tooltip({ ...props }) {
|
|
9
|
-
return
|
|
11
|
+
return _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
|
|
10
12
|
}
|
|
11
13
|
function TooltipTrigger({ ...props }) {
|
|
12
14
|
return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
13
15
|
}
|
|
14
|
-
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
15
|
-
return (_jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn('
|
|
16
|
+
function TooltipContent({ className, material = 'regular', sideOffset = 0, children, ...props }) {
|
|
17
|
+
return (_jsx(TooltipPrimitive.Portal, { children: _jsx(Material, { variant: material, elevation: "overlay", asChild: true, children: _jsxs(TooltipPrimitive.Content, { "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn('text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95', 'data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1', 'origin-(--radix-tooltip-content-transform-origin) z-50 flex w-fit max-w-80 items-center text-balance px-2.5 py-1.5 text-xs duration-[var(--motion-duration-fast)]', className), ...props, children: [children, _jsx(TooltipPrimitive.Arrow, { className: "fill-surface-overlay z-50" })] }) }) }));
|
|
16
18
|
}
|
|
17
|
-
|
|
19
|
+
function TooltipShortcut({ className, ...props }) {
|
|
20
|
+
return (_jsx(KbdGroup, { "data-slot": "tooltip-shortcut", className: cn('ml-2 text-[0.625rem] opacity-70', className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipShortcut, TooltipTrigger, };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export { cn } from './lib/utils';
|
|
|
2
2
|
export { ThemeProvider, useTheme, themeScript, type Theme } from './lib/theme';
|
|
3
3
|
export { WorkspaceProvider, useWorkspace, WORKSPACE_HEADER, } from './lib/workspace';
|
|
4
4
|
export { useMoldableCommands, useMoldableCommand, useMoldableAppCommands, useMoldableNavigationPop, useMoldableNavigationState, isInMoldable, sendToMoldable, pushMoldableNavigation, popMoldableNavigation, resetMoldableNavigation, downloadFile, publishMoldableArtifact, setMoldableWindowFullscreen, type AppCommand, type CommandAction, type CommandsResponse, type CommandMessage, type MoldableNavigationEntry, type MoldableNavigationPopMessage, type MoldableNavigationStateMessage, type DownloadFileOptions, type MoldableArtifactFile, type MoldableArtifactPublishOptions, type MoldableArtifactPublishResult, type MoldableWindowFullscreenMode, type MoldableWindowFullscreenOptions, type MoldableWindowFullscreenResult, type MoldableWindowFullscreenMessage, type MoldableWindowFullscreenResultMessage, } from './lib/commands';
|
|
5
|
-
export * from './lib/native-
|
|
5
|
+
export * from './lib/native-capabilities';
|
|
6
6
|
export * from './components/ui';
|
|
7
|
-
export * from './components/
|
|
7
|
+
export * from './components/native-capabilities';
|
|
8
8
|
export { TODAY_KIND_RANK, TODAY_KIND_TTL_MS, makeTodayItem, type TodayItem, type TodayItemKind, type TodaySurface, type TodayAction, type TodayResponse, type ResumeState, type HydratedTodayItem, type HydratedResume, } from './lib/today';
|
|
9
9
|
export { useIsMobile } from './hooks/use-mobile';
|
|
10
10
|
export { Markdown } from './components/markdown';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAGhC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AAG9E,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,qCAAqC,GAC3C,MAAM,gBAAgB,CAAA;AAGvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAGhC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AAG9E,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,qCAAqC,GAC3C,MAAM,gBAAgB,CAAA;AAGvB,cAAc,2BAA2B,CAAA;AAGzC,cAAc,iBAAiB,CAAA;AAG/B,cAAc,kCAAkC,CAAA;AAGhD,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGhD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,gCAAgC,CAAA;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,OAAO,EACL,gBAAgB,EAChB,KAAK,cAAc,GACpB,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAA;AAGrE,cAAc,mBAAmB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,12 @@ export { ThemeProvider, useTheme, themeScript } from './lib/theme';
|
|
|
6
6
|
export { WorkspaceProvider, useWorkspace, WORKSPACE_HEADER, } from './lib/workspace';
|
|
7
7
|
// Export commands
|
|
8
8
|
export { useMoldableCommands, useMoldableCommand, useMoldableAppCommands, useMoldableNavigationPop, useMoldableNavigationState, isInMoldable, sendToMoldable, pushMoldableNavigation, popMoldableNavigation, resetMoldableNavigation, downloadFile, publishMoldableArtifact, setMoldableWindowFullscreen, } from './lib/commands';
|
|
9
|
-
// Export typed desktop/native
|
|
10
|
-
export * from './lib/native-
|
|
9
|
+
// Export typed desktop/native capability APIs
|
|
10
|
+
export * from './lib/native-capabilities';
|
|
11
11
|
// Export UI components
|
|
12
12
|
export * from './components/ui';
|
|
13
|
-
// Export native
|
|
14
|
-
export * from './components/
|
|
13
|
+
// Export native capability components (polished wrappers over lib/native-capabilities)
|
|
14
|
+
export * from './components/native-capabilities';
|
|
15
15
|
// Export Today contract
|
|
16
16
|
export { TODAY_KIND_RANK, TODAY_KIND_TTL_MS, makeTodayItem, } from './lib/today';
|
|
17
17
|
// Export hooks
|
|
@@ -1,2 +1,31 @@
|
|
|
1
|
+
export interface MoldableChatStateMessage {
|
|
2
|
+
type: 'moldable:chat-state';
|
|
3
|
+
expanded?: boolean;
|
|
4
|
+
minimized?: boolean;
|
|
5
|
+
safePadding?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface MoldableHostContextMessage {
|
|
8
|
+
type: 'moldable:host-context';
|
|
9
|
+
version: 1;
|
|
10
|
+
displayMode: 'embedded' | 'window';
|
|
11
|
+
titlebar?: 'host' | 'app';
|
|
12
|
+
platform?: 'macos' | 'windows' | 'linux' | 'unknown';
|
|
13
|
+
windowId?: string;
|
|
14
|
+
safeInsets?: {
|
|
15
|
+
top?: unknown;
|
|
16
|
+
inlineStart?: unknown;
|
|
17
|
+
inlineEnd?: unknown;
|
|
18
|
+
bottom?: unknown;
|
|
19
|
+
titlebarHeight?: unknown;
|
|
20
|
+
controlInsetInlineStart?: unknown;
|
|
21
|
+
controlInsetInlineEnd?: unknown;
|
|
22
|
+
cornerRadius?: unknown;
|
|
23
|
+
};
|
|
24
|
+
chat?: {
|
|
25
|
+
presentation?: 'hidden' | 'docked' | 'expanded' | 'minimized';
|
|
26
|
+
safePadding?: unknown;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare function applyMoldableChatSafePadding(safePadding: unknown): boolean;
|
|
1
30
|
export declare function installMoldableFrameLifecycle(): void;
|
|
2
31
|
//# sourceMappingURL=frame-lifecycle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-lifecycle.d.ts","sourceRoot":"","sources":["../../src/lib/frame-lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frame-lifecycle.d.ts","sourceRoot":"","sources":["../../src/lib/frame-lifecycle.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,uBAAuB,CAAA;IAC7B,OAAO,EAAE,CAAC,CAAA;IACV,WAAW,EAAE,UAAU,GAAG,QAAQ,CAAA;IAClC,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACzB,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE;QACX,GAAG,CAAC,EAAE,OAAO,CAAA;QACb,WAAW,CAAC,EAAE,OAAO,CAAA;QACrB,SAAS,CAAC,EAAE,OAAO,CAAA;QACnB,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB,uBAAuB,CAAC,EAAE,OAAO,CAAA;QACjC,qBAAqB,CAAC,EAAE,OAAO,CAAA;QAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;KACvB,CAAA;IACD,IAAI,CAAC,EAAE;QACL,YAAY,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAA;QAC7D,WAAW,CAAC,EAAE,OAAO,CAAA;KACtB,CAAA;CACF;AAwBD,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAa1E;AAwID,wBAAgB,6BAA6B,IAAI,IAAI,CAcpD"}
|
|
@@ -1,4 +1,88 @@
|
|
|
1
1
|
let frameLifecycleInstalled = false;
|
|
2
|
+
export function applyMoldableChatSafePadding(safePadding) {
|
|
3
|
+
if (typeof document === 'undefined')
|
|
4
|
+
return false;
|
|
5
|
+
const value = Number(safePadding);
|
|
6
|
+
if (!Number.isFinite(value))
|
|
7
|
+
return false;
|
|
8
|
+
// Keep a malformed or stale host message from creating an unusable canvas.
|
|
9
|
+
const boundedValue = Math.min(4096, Math.max(0, value));
|
|
10
|
+
document.documentElement.style.setProperty('--chat-safe-padding', `${boundedValue}px`);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
function applyBoundedLength(property, value) {
|
|
14
|
+
const number = Number(value);
|
|
15
|
+
if (!Number.isFinite(number))
|
|
16
|
+
return;
|
|
17
|
+
document.documentElement.style.setProperty(property, `${Math.min(4096, Math.max(0, number))}px`);
|
|
18
|
+
}
|
|
19
|
+
function applyMoldableChatState(message) {
|
|
20
|
+
applyMoldableChatSafePadding(message.safePadding);
|
|
21
|
+
const presentation = message.expanded
|
|
22
|
+
? 'expanded'
|
|
23
|
+
: message.minimized
|
|
24
|
+
? 'minimized'
|
|
25
|
+
: 'docked';
|
|
26
|
+
document.documentElement.dataset.moldableChat = presentation;
|
|
27
|
+
}
|
|
28
|
+
function applyMoldableHostContext(message) {
|
|
29
|
+
const root = document.documentElement;
|
|
30
|
+
root.dataset.moldableDisplayMode = message.displayMode;
|
|
31
|
+
root.dataset.moldableWindowTitlebar = message.titlebar ?? 'host';
|
|
32
|
+
if (message.platform)
|
|
33
|
+
root.dataset.moldablePlatform = message.platform;
|
|
34
|
+
if (message.windowId)
|
|
35
|
+
root.dataset.moldableWindowId = message.windowId;
|
|
36
|
+
const insets = message.safeInsets;
|
|
37
|
+
if (insets) {
|
|
38
|
+
applyBoundedLength('--window-safe-area-top', insets.top);
|
|
39
|
+
applyBoundedLength('--window-safe-area-inline-start', insets.inlineStart);
|
|
40
|
+
applyBoundedLength('--window-safe-area-inline-end', insets.inlineEnd);
|
|
41
|
+
applyBoundedLength('--window-safe-area-bottom', insets.bottom);
|
|
42
|
+
applyBoundedLength('--window-titlebar-height', insets.titlebarHeight);
|
|
43
|
+
applyBoundedLength('--window-control-inset-inline-start', insets.controlInsetInlineStart);
|
|
44
|
+
applyBoundedLength('--window-control-inset-inline-end', insets.controlInsetInlineEnd);
|
|
45
|
+
applyBoundedLength('--window-corner-radius', insets.cornerRadius);
|
|
46
|
+
}
|
|
47
|
+
if (message.chat) {
|
|
48
|
+
applyMoldableChatSafePadding(message.chat.safePadding);
|
|
49
|
+
if (message.chat.presentation) {
|
|
50
|
+
root.dataset.moldableChat = message.chat.presentation;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
window.dispatchEvent(new CustomEvent('moldable:host-context-change', { detail: message }));
|
|
54
|
+
}
|
|
55
|
+
function installHostStateLifecycle() {
|
|
56
|
+
const root = document.documentElement;
|
|
57
|
+
root.dataset.moldableDisplayMode =
|
|
58
|
+
window.parent === window ? 'window' : 'embedded';
|
|
59
|
+
root.dataset.moldableWindowTitlebar = 'host';
|
|
60
|
+
// Standalone windows do not reserve space for the desktop chat dock.
|
|
61
|
+
if (window.parent === window) {
|
|
62
|
+
applyMoldableChatSafePadding(0);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
window.addEventListener('message', (event) => {
|
|
66
|
+
if (event.source !== window.parent)
|
|
67
|
+
return;
|
|
68
|
+
if (typeof event.data !== 'object' ||
|
|
69
|
+
event.data === null ||
|
|
70
|
+
!('type' in event.data) ||
|
|
71
|
+
typeof event.data.type !== 'string') {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (event.data.type === 'moldable:chat-state') {
|
|
75
|
+
applyMoldableChatState(event.data);
|
|
76
|
+
}
|
|
77
|
+
else if (event.data.type === 'moldable:host-context') {
|
|
78
|
+
const message = event.data;
|
|
79
|
+
if (message.version === 1 &&
|
|
80
|
+
(message.displayMode === 'embedded' || message.displayMode === 'window')) {
|
|
81
|
+
applyMoldableHostContext(message);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
2
86
|
function postMoldableFrameMessage(message) {
|
|
3
87
|
if (typeof window === 'undefined' || window.parent === window)
|
|
4
88
|
return;
|
|
@@ -37,6 +121,7 @@ export function installMoldableFrameLifecycle() {
|
|
|
37
121
|
if (typeof window === 'undefined' || frameLifecycleInstalled)
|
|
38
122
|
return;
|
|
39
123
|
frameLifecycleInstalled = true;
|
|
124
|
+
installHostStateLifecycle();
|
|
40
125
|
installViteHmrLifecycle();
|
|
41
126
|
scheduleRenderReady();
|
|
42
127
|
if (document.readyState === 'complete') {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type NativeCapabilityBridgeOptions } from './bridge';
|
|
2
|
+
import type { NativeCapabilityId } from './types';
|
|
3
|
+
export declare const NATIVE_CAPABILITY_ACCESS_REQUEST_TYPE: "moldable:native-capabilities-access-request";
|
|
4
|
+
export declare const NATIVE_CAPABILITY_ACCESS_RESULT_TYPE: "moldable:native-capabilities-access-result";
|
|
5
|
+
export interface MoldableNativeCapabilityAccessState {
|
|
6
|
+
capability: NativeCapabilityId;
|
|
7
|
+
granted: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function getMoldableNativeCapabilityAccess(capability: NativeCapabilityId, options?: NativeCapabilityBridgeOptions): Promise<MoldableNativeCapabilityAccessState>;
|
|
10
|
+
export declare function requestMoldableNativeCapabilityAccess(capability: NativeCapabilityId, options?: NativeCapabilityBridgeOptions): Promise<MoldableNativeCapabilityAccessState>;
|
|
11
|
+
export declare function assertMoldableNativeCapabilityAccess(capability: NativeCapabilityId, options?: NativeCapabilityBridgeOptions): Promise<void>;
|
|
12
|
+
export declare function requireMoldableNativeCapabilityAccess(capability: NativeCapabilityId, options?: NativeCapabilityBridgeOptions): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/access.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,6BAA6B,EAEnC,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,qCAAqC,EAChD,6CAAsD,CAAA;AACxD,eAAO,MAAM,oCAAoC,EAC/C,4CAAqD,CAAA;AAEvD,MAAM,WAAW,mCAAmC;IAClD,UAAU,EAAE,kBAAkB,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;CACjB;AAgBD,wBAAsB,iCAAiC,CACrD,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,mCAAmC,CAAC,CAY9C;AAED,wBAAsB,qCAAqC,CACzD,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,mCAAmC,CAAC,CAY9C;AAED,wBAAsB,oCAAoC,CACxD,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,wBAAsB,qCAAqC,CACzD,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAWf"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { NativeCapabilityBridgeError, callNativeCapabilityBridge, } from './bridge';
|
|
2
|
+
import { isNativeCapabilityId } from './capabilities';
|
|
3
|
+
export const NATIVE_CAPABILITY_ACCESS_REQUEST_TYPE = 'moldable:native-capabilities-access-request';
|
|
4
|
+
export const NATIVE_CAPABILITY_ACCESS_RESULT_TYPE = 'moldable:native-capabilities-access-result';
|
|
5
|
+
function isEmbedded() {
|
|
6
|
+
return typeof window !== 'undefined' && window.parent !== window;
|
|
7
|
+
}
|
|
8
|
+
function validateCapability(capability) {
|
|
9
|
+
if (isNativeCapabilityId(capability))
|
|
10
|
+
return capability;
|
|
11
|
+
throw new NativeCapabilityBridgeError({
|
|
12
|
+
code: 'invalid_request',
|
|
13
|
+
message: 'Unknown native capability.',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export async function getMoldableNativeCapabilityAccess(capability, options = {}) {
|
|
17
|
+
const validated = validateCapability(capability);
|
|
18
|
+
if (!isEmbedded())
|
|
19
|
+
return { capability: validated, granted: true };
|
|
20
|
+
return callNativeCapabilityBridge({
|
|
21
|
+
type: NATIVE_CAPABILITY_ACCESS_REQUEST_TYPE,
|
|
22
|
+
action: 'getStatus',
|
|
23
|
+
capability: validated,
|
|
24
|
+
}, NATIVE_CAPABILITY_ACCESS_RESULT_TYPE, options);
|
|
25
|
+
}
|
|
26
|
+
export async function requestMoldableNativeCapabilityAccess(capability, options = {}) {
|
|
27
|
+
const validated = validateCapability(capability);
|
|
28
|
+
if (!isEmbedded())
|
|
29
|
+
return { capability: validated, granted: true };
|
|
30
|
+
return callNativeCapabilityBridge({
|
|
31
|
+
type: NATIVE_CAPABILITY_ACCESS_REQUEST_TYPE,
|
|
32
|
+
action: 'request',
|
|
33
|
+
capability: validated,
|
|
34
|
+
}, NATIVE_CAPABILITY_ACCESS_RESULT_TYPE, options);
|
|
35
|
+
}
|
|
36
|
+
export async function assertMoldableNativeCapabilityAccess(capability, options = {}) {
|
|
37
|
+
const result = await getMoldableNativeCapabilityAccess(capability, options);
|
|
38
|
+
if (!result.granted) {
|
|
39
|
+
throw new NativeCapabilityBridgeError({
|
|
40
|
+
code: 'permission_denied',
|
|
41
|
+
message: `Access to ${capability} was not approved for this app.`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export async function requireMoldableNativeCapabilityAccess(capability, options = {}) {
|
|
46
|
+
const result = await requestMoldableNativeCapabilityAccess(capability, options);
|
|
47
|
+
if (!result.granted) {
|
|
48
|
+
throw new NativeCapabilityBridgeError({
|
|
49
|
+
code: 'permission_denied',
|
|
50
|
+
message: `Access to ${capability} was not approved for this app.`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MoldableBluetoothAvailability, MoldableBluetoothDevice, MoldableBluetoothOperationOptions, MoldableBluetoothRequestDeviceOptions, MoldableBluetoothRequestOptions } from './bluetooth-types';
|
|
2
|
+
/** Checks only for the standards-based Web Bluetooth entry point. */
|
|
3
|
+
export declare function isMoldableBluetoothSupported(): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Returns adapter availability when the runtime exposes it. `unknown` means the
|
|
6
|
+
* API exists but cannot report adapter state, not that Bluetooth is available.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getMoldableBluetoothAvailability(options?: MoldableBluetoothOperationOptions): Promise<MoldableBluetoothAvailability>;
|
|
9
|
+
/**
|
|
10
|
+
* Opens the browser's device chooser. This must be called directly from a
|
|
11
|
+
* trusted user action; it never silently scans for or selects devices.
|
|
12
|
+
*/
|
|
13
|
+
export declare function requestMoldableBluetoothDevice(deviceOptions: MoldableBluetoothRequestDeviceOptions, options?: MoldableBluetoothRequestOptions): Promise<MoldableBluetoothDevice>;
|
|
14
|
+
//# sourceMappingURL=bluetooth-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bluetooth-access.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/bluetooth-access.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,iCAAiC,EACjC,qCAAqC,EACrC,+BAA+B,EAChC,MAAM,mBAAmB,CAAA;AAE1B,qEAAqE;AACrE,wBAAgB,4BAA4B,IAAI,OAAO,CAGtD;AAED;;;GAGG;AACH,wBAAsB,gCAAgC,CACpD,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,6BAA6B,CAAC,CAgBxC;AAED;;;GAGG;AACH,wBAAsB,8BAA8B,CAClD,aAAa,EAAE,qCAAqC,EACpD,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC,uBAAuB,CAAC,CAgBlC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { assertMoldableNativeCapabilityAccess, requireMoldableNativeCapabilityAccess, } from './access';
|
|
2
|
+
import { abortableBluetooth, assertBluetoothUserGesture, bluetoothError, getBluetoothAPI, getBluetoothNavigator, validateBluetoothRequestOptions, } from './bluetooth-internal';
|
|
3
|
+
/** Checks only for the standards-based Web Bluetooth entry point. */
|
|
4
|
+
export function isMoldableBluetoothSupported() {
|
|
5
|
+
const api = getBluetoothNavigator()?.bluetooth;
|
|
6
|
+
return Boolean(api && typeof api.requestDevice === 'function');
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Returns adapter availability when the runtime exposes it. `unknown` means the
|
|
10
|
+
* API exists but cannot report adapter state, not that Bluetooth is available.
|
|
11
|
+
*/
|
|
12
|
+
export async function getMoldableBluetoothAvailability(options = {}) {
|
|
13
|
+
const operation = 'check Bluetooth availability';
|
|
14
|
+
await assertMoldableNativeCapabilityAccess('bluetooth', options);
|
|
15
|
+
const api = getBluetoothAPI(operation);
|
|
16
|
+
if (typeof api.getAvailability !== 'function')
|
|
17
|
+
return 'unknown';
|
|
18
|
+
try {
|
|
19
|
+
return (await abortableBluetooth(api.getAvailability(), options.signal, operation))
|
|
20
|
+
? 'available'
|
|
21
|
+
: 'unavailable';
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
throw bluetoothError(error, operation);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Opens the browser's device chooser. This must be called directly from a
|
|
29
|
+
* trusted user action; it never silently scans for or selects devices.
|
|
30
|
+
*/
|
|
31
|
+
export async function requestMoldableBluetoothDevice(deviceOptions, options = {}) {
|
|
32
|
+
const operation = 'request a Bluetooth device';
|
|
33
|
+
validateBluetoothRequestOptions(deviceOptions);
|
|
34
|
+
assertBluetoothUserGesture();
|
|
35
|
+
try {
|
|
36
|
+
await requireMoldableNativeCapabilityAccess('bluetooth', options);
|
|
37
|
+
const api = getBluetoothAPI(operation);
|
|
38
|
+
return await abortableBluetooth(api.requestDevice(deviceOptions), options.signal, operation, (device) => device.gatt?.disconnect());
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
throw bluetoothError(error, operation);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MoldableBluetoothConnectionOptions, MoldableBluetoothDevice, MoldableBluetoothOperationOptions, MoldableBluetoothRemoteGATTServer, MoldableBluetoothRemoteGATTService, MoldableBluetoothUUID } from './bluetooth-types';
|
|
2
|
+
export declare class MoldableBluetoothConnection {
|
|
3
|
+
readonly device: MoldableBluetoothDevice;
|
|
4
|
+
readonly server: MoldableBluetoothRemoteGATTServer;
|
|
5
|
+
private readonly abortSignal?;
|
|
6
|
+
private readonly disconnectListeners;
|
|
7
|
+
private isClosed;
|
|
8
|
+
constructor(device: MoldableBluetoothDevice, server: MoldableBluetoothRemoteGATTServer, options?: MoldableBluetoothConnectionOptions);
|
|
9
|
+
get connected(): boolean;
|
|
10
|
+
onDisconnected(listener: () => void, signal?: AbortSignal): () => void;
|
|
11
|
+
getPrimaryService(service: MoldableBluetoothUUID, options?: MoldableBluetoothOperationOptions): Promise<MoldableBluetoothRemoteGATTService>;
|
|
12
|
+
disconnect(): void;
|
|
13
|
+
private readonly handleAbort;
|
|
14
|
+
private readonly handleDisconnected;
|
|
15
|
+
private finish;
|
|
16
|
+
}
|
|
17
|
+
/** Connects a previously user-selected device and owns disconnect cleanup. */
|
|
18
|
+
export declare function connectMoldableBluetoothDevice(device: MoldableBluetoothDevice, options?: MoldableBluetoothConnectionOptions): Promise<MoldableBluetoothConnection>;
|
|
19
|
+
//# sourceMappingURL=bluetooth-connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bluetooth-connection.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/bluetooth-connection.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kCAAkC,EAClC,uBAAuB,EACvB,iCAAiC,EACjC,iCAAiC,EACjC,kCAAkC,EAClC,qBAAqB,EACtB,MAAM,mBAAmB,CAAA;AAE1B,qBAAa,2BAA2B;IACtC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAA;IACxC,QAAQ,CAAC,MAAM,EAAE,iCAAiC,CAAA;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAa;IAC1C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAwB;IAC5D,OAAO,CAAC,QAAQ,CAAQ;gBAGtB,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,iCAAiC,EACzC,OAAO,GAAE,kCAAuC;IASlD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI;IAWhE,iBAAiB,CACrB,OAAO,EAAE,qBAAqB,EAC9B,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,kCAAkC,CAAC;IAmB9C,UAAU,IAAI,IAAI;IAMlB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0B;IACtD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA0B;IAE7D,OAAO,CAAC,MAAM;CAqBf;AAED,8EAA8E;AAC9E,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,uBAAuB,EAC/B,OAAO,GAAE,kCAAuC,GAC/C,OAAO,CAAC,2BAA2B,CAAC,CA0BtC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { abortableBluetooth, bluetoothAborted, bluetoothError, } from './bluetooth-internal';
|
|
2
|
+
export class MoldableBluetoothConnection {
|
|
3
|
+
device;
|
|
4
|
+
server;
|
|
5
|
+
abortSignal;
|
|
6
|
+
disconnectListeners = new Set();
|
|
7
|
+
isClosed = false;
|
|
8
|
+
constructor(device, server, options = {}) {
|
|
9
|
+
this.device = device;
|
|
10
|
+
this.server = server;
|
|
11
|
+
this.abortSignal = options.signal;
|
|
12
|
+
device.addEventListener('gattserverdisconnected', this.handleDisconnected);
|
|
13
|
+
options.signal?.addEventListener('abort', this.handleAbort, { once: true });
|
|
14
|
+
}
|
|
15
|
+
get connected() {
|
|
16
|
+
return !this.isClosed && this.server.connected;
|
|
17
|
+
}
|
|
18
|
+
onDisconnected(listener, signal) {
|
|
19
|
+
if (signal?.aborted || this.isClosed)
|
|
20
|
+
return () => undefined;
|
|
21
|
+
this.disconnectListeners.add(listener);
|
|
22
|
+
const cleanup = () => {
|
|
23
|
+
this.disconnectListeners.delete(listener);
|
|
24
|
+
signal?.removeEventListener('abort', cleanup);
|
|
25
|
+
};
|
|
26
|
+
signal?.addEventListener('abort', cleanup, { once: true });
|
|
27
|
+
return cleanup;
|
|
28
|
+
}
|
|
29
|
+
async getPrimaryService(service, options = {}) {
|
|
30
|
+
const operation = `get Bluetooth service ${String(service)}`;
|
|
31
|
+
if (!this.connected) {
|
|
32
|
+
throw bluetoothError(new DOMException('Bluetooth device is disconnected', 'NetworkError'), operation);
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
return await abortableBluetooth(this.server.getPrimaryService(service), options.signal, operation);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
throw bluetoothError(error, operation);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
disconnect() {
|
|
42
|
+
if (this.isClosed)
|
|
43
|
+
return;
|
|
44
|
+
this.finish(false);
|
|
45
|
+
if (this.server.connected)
|
|
46
|
+
this.server.disconnect();
|
|
47
|
+
}
|
|
48
|
+
handleAbort = () => this.disconnect();
|
|
49
|
+
handleDisconnected = () => this.finish(true);
|
|
50
|
+
finish(notify) {
|
|
51
|
+
if (this.isClosed)
|
|
52
|
+
return;
|
|
53
|
+
this.isClosed = true;
|
|
54
|
+
this.device.removeEventListener('gattserverdisconnected', this.handleDisconnected);
|
|
55
|
+
this.abortSignal?.removeEventListener('abort', this.handleAbort);
|
|
56
|
+
if (notify) {
|
|
57
|
+
const listeners = [...this.disconnectListeners];
|
|
58
|
+
this.disconnectListeners.clear();
|
|
59
|
+
for (const listener of listeners) {
|
|
60
|
+
try {
|
|
61
|
+
listener();
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// A consumer callback must not prevent connection cleanup.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
this.disconnectListeners.clear();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** Connects a previously user-selected device and owns disconnect cleanup. */
|
|
72
|
+
export async function connectMoldableBluetoothDevice(device, options = {}) {
|
|
73
|
+
const operation = `connect to Bluetooth device ${device.id}`;
|
|
74
|
+
if (!device.gatt) {
|
|
75
|
+
throw bluetoothError(new DOMException('Device does not expose a GATT server', 'NotSupportedError'), operation);
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const server = await abortableBluetooth(device.gatt.connect(), options.signal, operation, (lateServer) => lateServer.disconnect());
|
|
79
|
+
if (options.signal?.aborted) {
|
|
80
|
+
server.disconnect();
|
|
81
|
+
throw bluetoothAborted(operation);
|
|
82
|
+
}
|
|
83
|
+
return new MoldableBluetoothConnection(device, server, options);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
throw bluetoothError(error, operation);
|
|
87
|
+
}
|
|
88
|
+
}
|