@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
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { NativeCapabilityBridgeError } from './bridge';
|
|
2
|
+
import { bytesFromNativeDeviceResult, bytesWrittenFromNativeDeviceResult, closeMoldableNativeDevice, executeMoldableNativeDeviceOperation, openMoldableNativeDevice, } from './native-device-io';
|
|
3
|
+
import { NativeDeviceLifecycle, isNativeDeviceDisconnect, } from './native-device-lifecycle';
|
|
4
|
+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
5
|
+
export class NativeMoldableUsbDevice extends EventTarget {
|
|
6
|
+
descriptor;
|
|
7
|
+
vendorId;
|
|
8
|
+
productId;
|
|
9
|
+
productName;
|
|
10
|
+
manufacturerName = null;
|
|
11
|
+
serialNumber = null;
|
|
12
|
+
configuration = null;
|
|
13
|
+
handle;
|
|
14
|
+
closing;
|
|
15
|
+
lifecycle = new NativeDeviceLifecycle();
|
|
16
|
+
constructor(descriptor) {
|
|
17
|
+
super();
|
|
18
|
+
this.descriptor = descriptor;
|
|
19
|
+
this.vendorId = descriptor.vendorId ?? 0;
|
|
20
|
+
this.productId = descriptor.productId ?? 0;
|
|
21
|
+
this.productName = descriptor.label;
|
|
22
|
+
}
|
|
23
|
+
get opened() {
|
|
24
|
+
return this.lifecycle.opened;
|
|
25
|
+
}
|
|
26
|
+
async openWithOptions(options) {
|
|
27
|
+
if (this.closing)
|
|
28
|
+
await this.closing;
|
|
29
|
+
if (this.handle && this.lifecycle.disconnected)
|
|
30
|
+
await this.close();
|
|
31
|
+
if (this.opened)
|
|
32
|
+
return;
|
|
33
|
+
const opened = await openMoldableNativeDevice('usb', this.descriptor.selector, {
|
|
34
|
+
...(options.configurationValue === undefined
|
|
35
|
+
? {}
|
|
36
|
+
: { usbConfiguration: options.configurationValue }),
|
|
37
|
+
usbInterfaces: [...(options.claimInterfaces ?? [])],
|
|
38
|
+
});
|
|
39
|
+
if (opened.kind !== 'usb')
|
|
40
|
+
throw new Error('Native device kind mismatch.');
|
|
41
|
+
this.handle = opened.handle;
|
|
42
|
+
this.lifecycle.didOpen();
|
|
43
|
+
if (options.configurationValue !== undefined) {
|
|
44
|
+
this.configuration = { configurationValue: options.configurationValue };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async open() {
|
|
48
|
+
await this.openWithOptions({});
|
|
49
|
+
}
|
|
50
|
+
async close() {
|
|
51
|
+
if (this.closing)
|
|
52
|
+
return this.closing;
|
|
53
|
+
if (!this.handle)
|
|
54
|
+
return;
|
|
55
|
+
const handle = this.handle;
|
|
56
|
+
const closing = closeMoldableNativeDevice('usb', handle)
|
|
57
|
+
.then(() => {
|
|
58
|
+
if (this.handle === handle) {
|
|
59
|
+
this.handle = undefined;
|
|
60
|
+
this.configuration = null;
|
|
61
|
+
this.lifecycle.didClose();
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
.finally(() => {
|
|
65
|
+
if (this.closing === closing)
|
|
66
|
+
this.closing = undefined;
|
|
67
|
+
});
|
|
68
|
+
this.closing = closing;
|
|
69
|
+
return closing;
|
|
70
|
+
}
|
|
71
|
+
async forget() {
|
|
72
|
+
await this.close();
|
|
73
|
+
}
|
|
74
|
+
async selectConfiguration() {
|
|
75
|
+
throw this.reopenRequired('select a USB configuration');
|
|
76
|
+
}
|
|
77
|
+
async claimInterface() {
|
|
78
|
+
throw this.reopenRequired('claim a USB interface');
|
|
79
|
+
}
|
|
80
|
+
async releaseInterface() {
|
|
81
|
+
throw this.reopenRequired('release a USB interface');
|
|
82
|
+
}
|
|
83
|
+
async transferIn(endpointNumber, length) {
|
|
84
|
+
return this.transferInWithOptions(endpointNumber, length);
|
|
85
|
+
}
|
|
86
|
+
async transferInWithOptions(endpointNumber, length, options = {}) {
|
|
87
|
+
const result = await this.execute({
|
|
88
|
+
action: 'read',
|
|
89
|
+
endpoint: nativeUsbEndpointAddress(endpointNumber, 'in'),
|
|
90
|
+
length,
|
|
91
|
+
timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
92
|
+
bulk: options.transferType === 'bulk',
|
|
93
|
+
}, options.signal);
|
|
94
|
+
const bytes = bytesFromNativeDeviceResult(result);
|
|
95
|
+
return {
|
|
96
|
+
status: 'ok',
|
|
97
|
+
data: new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
async transferOut(endpointNumber, data) {
|
|
101
|
+
return this.transferOutWithOptions(endpointNumber, data);
|
|
102
|
+
}
|
|
103
|
+
async transferOutWithOptions(endpointNumber, data, options = {}) {
|
|
104
|
+
const result = await this.execute({
|
|
105
|
+
action: 'write',
|
|
106
|
+
endpoint: nativeUsbEndpointAddress(endpointNumber, 'out'),
|
|
107
|
+
data: [...asBytes(data)],
|
|
108
|
+
timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
109
|
+
bulk: options.transferType === 'bulk',
|
|
110
|
+
}, options.signal);
|
|
111
|
+
return {
|
|
112
|
+
status: 'ok',
|
|
113
|
+
bytesWritten: bytesWrittenFromNativeDeviceResult(result),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async controlTransferIn(setup, length) {
|
|
117
|
+
return this.controlTransferInWithOptions(setup, length);
|
|
118
|
+
}
|
|
119
|
+
async controlTransferInWithOptions(setup, length, options = {}) {
|
|
120
|
+
const result = await this.execute({
|
|
121
|
+
action: 'usbControlIn',
|
|
122
|
+
requestType: controlRequestType(setup, true),
|
|
123
|
+
request: setup.request,
|
|
124
|
+
value: setup.value,
|
|
125
|
+
index: setup.index,
|
|
126
|
+
length,
|
|
127
|
+
timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
128
|
+
}, options.signal);
|
|
129
|
+
const bytes = bytesFromNativeDeviceResult(result);
|
|
130
|
+
return {
|
|
131
|
+
status: 'ok',
|
|
132
|
+
data: new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
async controlTransferOut(setup, data = new Uint8Array()) {
|
|
136
|
+
return this.controlTransferOutWithOptions(setup, data);
|
|
137
|
+
}
|
|
138
|
+
async controlTransferOutWithOptions(setup, data = new Uint8Array(), options = {}) {
|
|
139
|
+
const result = await this.execute({
|
|
140
|
+
action: 'usbControlOut',
|
|
141
|
+
requestType: controlRequestType(setup, false),
|
|
142
|
+
request: setup.request,
|
|
143
|
+
value: setup.value,
|
|
144
|
+
index: setup.index,
|
|
145
|
+
data: [...asBytes(data)],
|
|
146
|
+
timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
147
|
+
}, options.signal);
|
|
148
|
+
return {
|
|
149
|
+
status: 'ok',
|
|
150
|
+
bytesWritten: bytesWrittenFromNativeDeviceResult(result),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
async clearHalt(direction, endpointNumber) {
|
|
154
|
+
await this.execute({
|
|
155
|
+
action: 'clearUsbHalt',
|
|
156
|
+
endpoint: nativeUsbEndpointAddress(endpointNumber, direction),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
async reset() {
|
|
160
|
+
await this.execute({ action: 'resetUsb' });
|
|
161
|
+
}
|
|
162
|
+
async execute(operation, signal) {
|
|
163
|
+
if (!this.handle) {
|
|
164
|
+
throw new NativeCapabilityBridgeError({
|
|
165
|
+
code: 'invalid_request',
|
|
166
|
+
message: 'USB device is not open.',
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (this.lifecycle.disconnected) {
|
|
170
|
+
throw new NativeCapabilityBridgeError({
|
|
171
|
+
code: 'unavailable',
|
|
172
|
+
message: 'USB device is disconnected.',
|
|
173
|
+
retryable: true,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
return await executeMoldableNativeDeviceOperation('usb', this.handle, operation, { signal });
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
if (isNativeDeviceDisconnect(error)) {
|
|
181
|
+
this.lifecycle.didDisconnect(this, error);
|
|
182
|
+
}
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
reopenRequired(action) {
|
|
187
|
+
return new NativeCapabilityBridgeError({
|
|
188
|
+
code: 'invalid_request',
|
|
189
|
+
message: `Close and reopen the native USB device to ${action}.`,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
export function isNativeMoldableUsbDevice(device) {
|
|
194
|
+
return device instanceof NativeMoldableUsbDevice;
|
|
195
|
+
}
|
|
196
|
+
function asBytes(data) {
|
|
197
|
+
return data instanceof ArrayBuffer
|
|
198
|
+
? new Uint8Array(data)
|
|
199
|
+
: new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
200
|
+
}
|
|
201
|
+
function nativeUsbEndpointAddress(endpointNumber, direction) {
|
|
202
|
+
if (!Number.isInteger(endpointNumber) ||
|
|
203
|
+
endpointNumber < 1 ||
|
|
204
|
+
endpointNumber > 15) {
|
|
205
|
+
throw new NativeCapabilityBridgeError({
|
|
206
|
+
code: 'invalid_request',
|
|
207
|
+
message: 'USB endpointNumber must be an integer between 1 and 15.',
|
|
208
|
+
retryable: false,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return direction === 'in' ? endpointNumber | 0x80 : endpointNumber;
|
|
212
|
+
}
|
|
213
|
+
function controlRequestType(setup, input) {
|
|
214
|
+
const type = { standard: 0, class: 1, vendor: 2 }[setup.requestType] << 5;
|
|
215
|
+
const recipient = { device: 0, interface: 1, endpoint: 2, other: 3 }[setup.recipient];
|
|
216
|
+
return (input ? 0x80 : 0) | type | recipient;
|
|
217
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export interface MoldableUsbOperationOptions {
|
|
2
|
+
signal?: AbortSignal;
|
|
3
|
+
timeoutMs?: number;
|
|
4
|
+
transferType?: 'interrupt' | 'bulk';
|
|
5
|
+
}
|
|
6
|
+
export interface MoldableUsbDeviceFilter {
|
|
7
|
+
vendorId?: number;
|
|
8
|
+
productId?: number;
|
|
9
|
+
classCode?: number;
|
|
10
|
+
subclassCode?: number;
|
|
11
|
+
protocolCode?: number;
|
|
12
|
+
serialNumber?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MoldableUsbConfiguration {
|
|
15
|
+
configurationValue: number;
|
|
16
|
+
}
|
|
17
|
+
export interface MoldableUsbInTransferResult {
|
|
18
|
+
data?: DataView | null;
|
|
19
|
+
status: 'ok' | 'stall' | 'babble';
|
|
20
|
+
}
|
|
21
|
+
export interface MoldableUsbOutTransferResult {
|
|
22
|
+
bytesWritten?: number;
|
|
23
|
+
status: 'ok' | 'stall' | 'babble';
|
|
24
|
+
}
|
|
25
|
+
export interface MoldableUsbControlTransferParameters {
|
|
26
|
+
requestType: 'standard' | 'class' | 'vendor';
|
|
27
|
+
recipient: 'device' | 'interface' | 'endpoint' | 'other';
|
|
28
|
+
request: number;
|
|
29
|
+
value: number;
|
|
30
|
+
index: number;
|
|
31
|
+
}
|
|
32
|
+
/** Structural subset of the standard USBDevice interface used by the helpers. */
|
|
33
|
+
export interface MoldableUsbDevice extends EventTarget {
|
|
34
|
+
readonly opened: boolean;
|
|
35
|
+
readonly vendorId: number;
|
|
36
|
+
readonly productId: number;
|
|
37
|
+
readonly productName?: string | null;
|
|
38
|
+
readonly manufacturerName?: string | null;
|
|
39
|
+
readonly serialNumber?: string | null;
|
|
40
|
+
readonly configuration?: MoldableUsbConfiguration | null;
|
|
41
|
+
open(): Promise<void>;
|
|
42
|
+
close(): Promise<void>;
|
|
43
|
+
forget?(): Promise<void>;
|
|
44
|
+
selectConfiguration(configurationValue: number): Promise<void>;
|
|
45
|
+
claimInterface(interfaceNumber: number): Promise<void>;
|
|
46
|
+
releaseInterface(interfaceNumber: number): Promise<void>;
|
|
47
|
+
transferIn(endpointNumber: number, length: number): Promise<MoldableUsbInTransferResult>;
|
|
48
|
+
transferOut(endpointNumber: number, data: BufferSource): Promise<MoldableUsbOutTransferResult>;
|
|
49
|
+
controlTransferIn(setup: MoldableUsbControlTransferParameters, length: number): Promise<MoldableUsbInTransferResult>;
|
|
50
|
+
controlTransferOut(setup: MoldableUsbControlTransferParameters, data?: BufferSource): Promise<MoldableUsbOutTransferResult>;
|
|
51
|
+
clearHalt(direction: 'in' | 'out', endpointNumber: number): Promise<void>;
|
|
52
|
+
reset(): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
export interface MoldableUsbRequestOptions extends MoldableUsbOperationOptions {
|
|
55
|
+
filters: readonly MoldableUsbDeviceFilter[];
|
|
56
|
+
exclusionFilters?: readonly MoldableUsbDeviceFilter[];
|
|
57
|
+
/** Required when multiple native fallback devices match. Render a user choice. */
|
|
58
|
+
selectNativeDevice?: (devices: readonly MoldableUsbDevice[]) => MoldableUsbDevice | Promise<MoldableUsbDevice>;
|
|
59
|
+
}
|
|
60
|
+
export interface MoldableUsbOpenOptions {
|
|
61
|
+
configurationValue?: number;
|
|
62
|
+
claimInterfaces?: readonly number[];
|
|
63
|
+
}
|
|
64
|
+
/** Returns true only when this WebView exposes the WebUSB entry point. */
|
|
65
|
+
export declare function isMoldableUsbSupported(): boolean;
|
|
66
|
+
/** Lists devices previously authorized through WebUSB. */
|
|
67
|
+
export declare function getMoldableUsbDevices(): Promise<MoldableUsbDevice[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Shows the browser's USB chooser. Call this directly from a user gesture.
|
|
70
|
+
* Aborting stops awaiting the result but cannot dismiss every browser chooser.
|
|
71
|
+
*/
|
|
72
|
+
export declare function requestMoldableUsbDevice(options: MoldableUsbRequestOptions): Promise<MoldableUsbDevice>;
|
|
73
|
+
/** Opens, optionally configures, and claims interfaces on a USB device. */
|
|
74
|
+
export declare function openMoldableUsbDevice(device: MoldableUsbDevice, options?: MoldableUsbOpenOptions): Promise<void>;
|
|
75
|
+
/** Releases the selected interfaces and closes an open USB device. */
|
|
76
|
+
export declare function closeMoldableUsbDevice(device: MoldableUsbDevice, releaseInterfaces?: readonly number[]): Promise<void>;
|
|
77
|
+
/** Revokes the saved permission when the runtime supports USBDevice.forget(). */
|
|
78
|
+
export declare function forgetMoldableUsbDevice(device: MoldableUsbDevice): Promise<void>;
|
|
79
|
+
export declare function readMoldableUsbEndpoint(device: MoldableUsbDevice, endpointNumber: number, length: number, options?: MoldableUsbOperationOptions): Promise<MoldableUsbInTransferResult>;
|
|
80
|
+
export declare function writeMoldableUsbEndpoint(device: MoldableUsbDevice, endpointNumber: number, data: BufferSource, options?: MoldableUsbOperationOptions): Promise<MoldableUsbOutTransferResult>;
|
|
81
|
+
export declare function readMoldableUsbControlTransfer(device: MoldableUsbDevice, setup: MoldableUsbControlTransferParameters, length: number, options?: MoldableUsbOperationOptions): Promise<MoldableUsbInTransferResult>;
|
|
82
|
+
export declare function writeMoldableUsbControlTransfer(device: MoldableUsbDevice, setup: MoldableUsbControlTransferParameters, data?: BufferSource, options?: MoldableUsbOperationOptions): Promise<MoldableUsbOutTransferResult>;
|
|
83
|
+
export declare function clearMoldableUsbHalt(device: MoldableUsbDevice, direction: 'in' | 'out', endpointNumber: number): Promise<void>;
|
|
84
|
+
export declare function resetMoldableUsbDevice(device: MoldableUsbDevice): Promise<void>;
|
|
85
|
+
//# sourceMappingURL=usb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usb.d.ts","sourceRoot":"","sources":["../../../src/lib/native-capabilities/usb.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { assertMoldableNativeCapabilityAccess, requireMoldableNativeCapabilityAccess, } from './access';
|
|
2
|
+
import { NativeCapabilityBridgeError } from './bridge';
|
|
3
|
+
import { awaitDeviceIoWithAbort, deviceIoError, unsupportedDeviceIoError, } from './device-io-errors';
|
|
4
|
+
import { listMoldableNativeDevices } from './native-device-io';
|
|
5
|
+
import { NativeMoldableUsbDevice, isNativeMoldableUsbDevice, } from './usb-native';
|
|
6
|
+
function assertNativeUsbFiltersSupported(filters) {
|
|
7
|
+
if (filters?.some((filter) => filter.classCode !== undefined ||
|
|
8
|
+
filter.subclassCode !== undefined ||
|
|
9
|
+
filter.protocolCode !== undefined ||
|
|
10
|
+
filter.serialNumber !== undefined)) {
|
|
11
|
+
throw new NativeCapabilityBridgeError({
|
|
12
|
+
code: 'unsupported',
|
|
13
|
+
message: 'The native USB fallback can only match vendorId and productId filters on this platform.',
|
|
14
|
+
retryable: false,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function usbApi() {
|
|
19
|
+
const api = typeof navigator === 'undefined'
|
|
20
|
+
? undefined
|
|
21
|
+
: navigator.usb;
|
|
22
|
+
if (!api)
|
|
23
|
+
throw unsupportedDeviceIoError('usb');
|
|
24
|
+
return api;
|
|
25
|
+
}
|
|
26
|
+
/** Returns true only when this WebView exposes the WebUSB entry point. */
|
|
27
|
+
export function isMoldableUsbSupported() {
|
|
28
|
+
return (typeof navigator !== 'undefined' && !!navigator.usb);
|
|
29
|
+
}
|
|
30
|
+
/** Lists devices previously authorized through WebUSB. */
|
|
31
|
+
export async function getMoldableUsbDevices() {
|
|
32
|
+
await assertMoldableNativeCapabilityAccess('usb');
|
|
33
|
+
if (!isMoldableUsbSupported()) {
|
|
34
|
+
throw unsupportedDeviceIoError('usb');
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
return await usbApi().getDevices();
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw deviceIoError('usb', 'enumerate', error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Shows the browser's USB chooser. Call this directly from a user gesture.
|
|
45
|
+
* Aborting stops awaiting the result but cannot dismiss every browser chooser.
|
|
46
|
+
*/
|
|
47
|
+
export async function requestMoldableUsbDevice(options) {
|
|
48
|
+
await requireMoldableNativeCapabilityAccess('usb', options);
|
|
49
|
+
if (!isMoldableUsbSupported()) {
|
|
50
|
+
assertNativeUsbFiltersSupported(options.filters);
|
|
51
|
+
assertNativeUsbFiltersSupported(options.exclusionFilters);
|
|
52
|
+
const descriptors = await listMoldableNativeDevices('usb', {
|
|
53
|
+
signal: options.signal,
|
|
54
|
+
filters: options.filters.map(({ vendorId, productId }) => ({
|
|
55
|
+
vendorId,
|
|
56
|
+
productId,
|
|
57
|
+
})),
|
|
58
|
+
...(options.exclusionFilters
|
|
59
|
+
? {
|
|
60
|
+
exclusionFilters: options.exclusionFilters.map(({ vendorId, productId }) => ({ vendorId, productId })),
|
|
61
|
+
}
|
|
62
|
+
: {}),
|
|
63
|
+
});
|
|
64
|
+
const devices = descriptors
|
|
65
|
+
.filter((descriptor) => options.filters.length === 0
|
|
66
|
+
? true
|
|
67
|
+
: options.filters.some((filter) => (filter.vendorId === undefined ||
|
|
68
|
+
filter.vendorId === descriptor.vendorId) &&
|
|
69
|
+
(filter.productId === undefined ||
|
|
70
|
+
filter.productId === descriptor.productId)))
|
|
71
|
+
.filter((descriptor) => !options.exclusionFilters?.some((filter) => (filter.vendorId === undefined ||
|
|
72
|
+
filter.vendorId === descriptor.vendorId) &&
|
|
73
|
+
(filter.productId === undefined ||
|
|
74
|
+
filter.productId === descriptor.productId)))
|
|
75
|
+
.map((descriptor) => new NativeMoldableUsbDevice(descriptor));
|
|
76
|
+
if (devices.length === 0) {
|
|
77
|
+
throw deviceIoError('usb', 'request', new DOMException('No matching USB device is available.', 'NotFoundError'));
|
|
78
|
+
}
|
|
79
|
+
if (devices.length === 1)
|
|
80
|
+
return devices[0];
|
|
81
|
+
if (!options.selectNativeDevice) {
|
|
82
|
+
throw deviceIoError('usb', 'request', new TypeError('A native device selector is required when multiple USB devices match.'));
|
|
83
|
+
}
|
|
84
|
+
const selected = await options.selectNativeDevice(devices);
|
|
85
|
+
if (!devices.includes(selected)) {
|
|
86
|
+
throw deviceIoError('usb', 'request', new TypeError('Invalid native USB selection.'));
|
|
87
|
+
}
|
|
88
|
+
return selected;
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
return await awaitDeviceIoWithAbort(usbApi().requestDevice({
|
|
92
|
+
filters: [...options.filters],
|
|
93
|
+
...(options.exclusionFilters
|
|
94
|
+
? { exclusionFilters: [...options.exclusionFilters] }
|
|
95
|
+
: {}),
|
|
96
|
+
}), 'usb', 'request', options.signal);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
throw deviceIoError('usb', 'request', error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** Opens, optionally configures, and claims interfaces on a USB device. */
|
|
103
|
+
export async function openMoldableUsbDevice(device, options = {}) {
|
|
104
|
+
if (isNativeMoldableUsbDevice(device)) {
|
|
105
|
+
await device.openWithOptions(options);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const openedHere = !device.opened;
|
|
109
|
+
const claimed = [];
|
|
110
|
+
try {
|
|
111
|
+
if (openedHere)
|
|
112
|
+
await device.open();
|
|
113
|
+
if (options.configurationValue !== undefined &&
|
|
114
|
+
device.configuration?.configurationValue !== options.configurationValue) {
|
|
115
|
+
await device.selectConfiguration(options.configurationValue);
|
|
116
|
+
}
|
|
117
|
+
for (const interfaceNumber of options.claimInterfaces ?? []) {
|
|
118
|
+
await device.claimInterface(interfaceNumber);
|
|
119
|
+
claimed.push(interfaceNumber);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
await Promise.allSettled(claimed.map((interfaceNumber) => device.releaseInterface(interfaceNumber)));
|
|
124
|
+
if (openedHere)
|
|
125
|
+
await device.close().catch(() => undefined);
|
|
126
|
+
throw deviceIoError('usb', 'open', error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** Releases the selected interfaces and closes an open USB device. */
|
|
130
|
+
export async function closeMoldableUsbDevice(device, releaseInterfaces = []) {
|
|
131
|
+
if (isNativeMoldableUsbDevice(device)) {
|
|
132
|
+
await device.close();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
let firstError;
|
|
136
|
+
for (const interfaceNumber of releaseInterfaces) {
|
|
137
|
+
try {
|
|
138
|
+
await device.releaseInterface(interfaceNumber);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
firstError ??= error;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
if (device.opened)
|
|
146
|
+
await device.close();
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
firstError ??= error;
|
|
150
|
+
}
|
|
151
|
+
if (firstError)
|
|
152
|
+
throw deviceIoError('usb', 'close', firstError);
|
|
153
|
+
}
|
|
154
|
+
/** Revokes the saved permission when the runtime supports USBDevice.forget(). */
|
|
155
|
+
export async function forgetMoldableUsbDevice(device) {
|
|
156
|
+
if (typeof device.forget !== 'function') {
|
|
157
|
+
throw unsupportedDeviceIoError('usb');
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
await device.forget();
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
throw deviceIoError('usb', 'close', error);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export async function readMoldableUsbEndpoint(device, endpointNumber, length, options = {}) {
|
|
167
|
+
if (isNativeMoldableUsbDevice(device)) {
|
|
168
|
+
return device.transferInWithOptions(endpointNumber, length, options);
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
return await awaitDeviceIoWithAbort(device.transferIn(endpointNumber, length), 'usb', 'read', options.signal);
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
throw deviceIoError('usb', 'read', error);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export async function writeMoldableUsbEndpoint(device, endpointNumber, data, options = {}) {
|
|
178
|
+
if (isNativeMoldableUsbDevice(device)) {
|
|
179
|
+
return device.transferOutWithOptions(endpointNumber, data, options);
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
return await awaitDeviceIoWithAbort(device.transferOut(endpointNumber, data), 'usb', 'write', options.signal);
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
throw deviceIoError('usb', 'write', error);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
export async function readMoldableUsbControlTransfer(device, setup, length, options = {}) {
|
|
189
|
+
if (isNativeMoldableUsbDevice(device)) {
|
|
190
|
+
return device.controlTransferInWithOptions(setup, length, options);
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
return await awaitDeviceIoWithAbort(device.controlTransferIn(setup, length), 'usb', 'read', options.signal);
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
throw deviceIoError('usb', 'read', error);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
export async function writeMoldableUsbControlTransfer(device, setup, data, options = {}) {
|
|
200
|
+
if (isNativeMoldableUsbDevice(device)) {
|
|
201
|
+
return device.controlTransferOutWithOptions(setup, data, options);
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
return await awaitDeviceIoWithAbort(device.controlTransferOut(setup, data), 'usb', 'write', options.signal);
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
throw deviceIoError('usb', 'write', error);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
export async function clearMoldableUsbHalt(device, direction, endpointNumber) {
|
|
211
|
+
try {
|
|
212
|
+
await device.clearHalt(direction, endpointNumber);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
throw deviceIoError('usb', 'write', error);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
export async function resetMoldableUsbDevice(device) {
|
|
219
|
+
try {
|
|
220
|
+
await device.reset();
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
throw deviceIoError('usb', 'close', error);
|
|
224
|
+
}
|
|
225
|
+
}
|
package/dist/lib/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lib/theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lib/theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAGd,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAC/C,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAA;AAErC,UAAU,iBAAiB;IACzB,KAAK,EAAE,KAAK,CAAA;IACZ,aAAa,EAAE,aAAa,CAAA;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACjC;AA6CD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CA0ClE;AAED,wBAAgB,QAAQ,sBAMvB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,kYAYvB,CAAA"}
|
package/dist/lib/theme.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useCallback, useContext, useEffect, useState, } from 'react';
|
|
4
|
+
import { TooltipProvider } from '../components/ui/tooltip';
|
|
4
5
|
const ThemeContext = createContext(null);
|
|
5
6
|
const STORAGE_KEY = 'moldable-theme';
|
|
6
7
|
function getSystemTheme() {
|
|
@@ -69,7 +70,7 @@ export function ThemeProvider({ children }) {
|
|
|
69
70
|
mediaQuery.addEventListener('change', handleChange);
|
|
70
71
|
return () => mediaQuery.removeEventListener('change', handleChange);
|
|
71
72
|
}, [theme]);
|
|
72
|
-
return (_jsx(ThemeContext.Provider, { value: { theme, resolvedTheme, setTheme }, children: children }));
|
|
73
|
+
return (_jsx(ThemeContext.Provider, { value: { theme, resolvedTheme, setTheme }, children: _jsx(TooltipProvider, { children: children }) }));
|
|
73
74
|
}
|
|
74
75
|
export function useTheme() {
|
|
75
76
|
const context = useContext(ThemeContext);
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Moldable UI design system
|
|
2
|
+
|
|
3
|
+
`@moldable-ai/ui` is the shared renderer UI for Moldable desktop and generated
|
|
4
|
+
apps. Its design goal is a quiet, information-dense personal instrument that
|
|
5
|
+
feels at home on macOS without imitating private platform implementation.
|
|
6
|
+
|
|
7
|
+
## Start here
|
|
8
|
+
|
|
9
|
+
- [Foundations](./foundations.md)
|
|
10
|
+
- [Design tokens](./design-tokens.md)
|
|
11
|
+
- [Adaptive materials](./adaptive-materials.md)
|
|
12
|
+
- [App anatomy](./app-anatomy.md)
|
|
13
|
+
- [Standalone app windows](./standalone-app-windows.md)
|
|
14
|
+
- [Component catalog](./component-catalog.md)
|
|
15
|
+
- [Accessibility](./accessibility.md)
|
|
16
|
+
- [Native integration](./native-integration.md)
|
|
17
|
+
- [Component guide template](./component-guide-template.md)
|
|
18
|
+
|
|
19
|
+
Component-specific guides live beside their source in `src/components/ui`.
|
|
20
|
+
Read the guide for every component family used in a new or substantially
|
|
21
|
+
changed view.
|
|
22
|
+
|
|
23
|
+
## Product rules
|
|
24
|
+
|
|
25
|
+
1. Choose one app archetype and one primary object or workflow.
|
|
26
|
+
2. Start standalone-capable apps with `AppFrame`; use `Panel`, `SplitView`,
|
|
27
|
+
`Toolbar`, and `Inspector` inside the app-owned canvas.
|
|
28
|
+
3. Use `Text` and semantic theme colors for hierarchy.
|
|
29
|
+
4. Prefer shared interactive controls over raw `button`, `input`, or `select`
|
|
30
|
+
elements.
|
|
31
|
+
5. Keep chrome compact and give working content the available space.
|
|
32
|
+
6. Install the shared frame lifecycle once. Put `--chat-safe-padding` on the
|
|
33
|
+
element that actually scrolls; it defaults to zero outside the embedded
|
|
34
|
+
host.
|
|
35
|
+
7. Design loading, empty, error, disabled, and permission states with the main
|
|
36
|
+
view, not afterward.
|
|
37
|
+
8. Review component work in the catalog across theme, density, width, and
|
|
38
|
+
interaction states. Material-bearing components also cover reduced
|
|
39
|
+
transparency, increased contrast, and reduced motion.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Accessibility
|
|
2
|
+
|
|
3
|
+
## Baseline
|
|
4
|
+
|
|
5
|
+
- Give every icon-only action an accessible label and a short tooltip.
|
|
6
|
+
- Use semantic headings in order. Visual typography does not determine heading
|
|
7
|
+
level.
|
|
8
|
+
- Associate every field label, description, and error with its control.
|
|
9
|
+
- Preserve native keyboard behavior unless the component documents a custom
|
|
10
|
+
interaction model.
|
|
11
|
+
- Do not communicate status through color alone.
|
|
12
|
+
|
|
13
|
+
## Keyboard
|
|
14
|
+
|
|
15
|
+
Tab reaches controls in reading order. Arrow-key navigation belongs only to
|
|
16
|
+
composite widgets that implement the complete expected pattern. Escape closes
|
|
17
|
+
temporary surfaces and returns focus to their trigger.
|
|
18
|
+
|
|
19
|
+
App-wide shortcuts should be registered through Moldable commands when they
|
|
20
|
+
represent user actions. Do not hide essential behavior behind a shortcut.
|
|
21
|
+
|
|
22
|
+
## Motion and transparency
|
|
23
|
+
|
|
24
|
+
Animations must remain understandable with reduced motion. Translucent surfaces
|
|
25
|
+
need an opaque semantic-color fallback for environments that reduce
|
|
26
|
+
transparency.
|
|
27
|
+
|
|
28
|
+
## State coverage
|
|
29
|
+
|
|
30
|
+
Test the normal, hover, focus-visible, pressed, selected, disabled, loading,
|
|
31
|
+
empty, invalid, permission-denied, and error states that apply. Check light and
|
|
32
|
+
dark themes, keyboard-only operation, and a narrow pane.
|