@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,33 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
type ScrollToEnd = (options?: {
|
|
3
|
+
behavior?: ScrollBehavior;
|
|
4
|
+
}) => boolean;
|
|
5
|
+
type AnchorPosition = {
|
|
6
|
+
element: HTMLElement;
|
|
7
|
+
top: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
};
|
|
10
|
+
export type MessageScrollerLayoutSnapshot = {
|
|
11
|
+
anchors: AnchorPosition[];
|
|
12
|
+
atEnd: boolean;
|
|
13
|
+
scrollHeight: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function isMessageScrollerAtEnd(viewport: HTMLElement): boolean;
|
|
16
|
+
export declare function captureMessageScrollerLayout(viewport: HTMLElement): MessageScrollerLayoutSnapshot;
|
|
17
|
+
/**
|
|
18
|
+
* Preserve the first previously visible stable leaf when content above it
|
|
19
|
+
* changes height. Native scroll anchoring may already have done this; in that
|
|
20
|
+
* case the measured delta is zero and this is deliberately a no-op.
|
|
21
|
+
*/
|
|
22
|
+
export declare function restoreMessageScrollerAnchor(viewport: HTMLElement, snapshot: MessageScrollerLayoutSnapshot): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Complements shadcn's message scroller for mutable chat rows. The upstream
|
|
25
|
+
* primitive handles appends, prepends, and explicit jumps well, but a nested
|
|
26
|
+
* disclosure shrinking inside an existing row can look like user scroll
|
|
27
|
+
* intent. We remember whether the viewport was following the end before the
|
|
28
|
+
* resize and restore that mode, or preserve a visible content leaf when the
|
|
29
|
+
* user is reading higher in the transcript.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useMessageScrollerLayoutStability(viewportRef: RefObject<HTMLElement | null>, scrollToEnd: ScrollToEnd): void;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=message-scroller-layout-stability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-scroller-layout-stability.d.ts","sourceRoot":"","sources":["../../../src/components/ui/message-scroller-layout-stability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAA;AAQzD,KAAK,WAAW,GAAG,CAAC,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,cAAc,CAAA;CAAE,KAAK,OAAO,CAAA;AAEvE,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,WAAW,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,KAAK,EAAE,OAAO,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAWD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAKrE;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,WAAW,GACpB,6BAA6B,CAoB/B;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,WAAW,EACrB,QAAQ,EAAE,6BAA6B,GACtC,OAAO,CAcT;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAC1C,WAAW,EAAE,WAAW,QAqGzB"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
const END_THRESHOLD_PX = 8;
|
|
3
|
+
const POSITION_EPSILON_PX = 0.5;
|
|
4
|
+
const USER_SCROLL_GRACE_MS = 300;
|
|
5
|
+
const CONTENT_ANCHOR_SELECTOR = '[data-message-scroll-anchor]';
|
|
6
|
+
const MESSAGE_ANCHOR_SELECTOR = '[data-message-id]';
|
|
7
|
+
function relativePosition(element, viewport) {
|
|
8
|
+
const elementRect = element.getBoundingClientRect();
|
|
9
|
+
const viewportRect = viewport.getBoundingClientRect();
|
|
10
|
+
return {
|
|
11
|
+
top: elementRect.top - viewportRect.top,
|
|
12
|
+
bottom: elementRect.bottom - viewportRect.top,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function isMessageScrollerAtEnd(viewport) {
|
|
16
|
+
return (viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight <=
|
|
17
|
+
END_THRESHOLD_PX);
|
|
18
|
+
}
|
|
19
|
+
export function captureMessageScrollerLayout(viewport) {
|
|
20
|
+
// Prefer stable leaves within a message. A top-level message's own top does
|
|
21
|
+
// not move when content collapses inside it, so it is only a fallback when
|
|
22
|
+
// the visible leaf itself was removed by the disclosure transition.
|
|
23
|
+
const contentAnchors = Array.from(viewport.querySelectorAll(CONTENT_ANCHOR_SELECTOR));
|
|
24
|
+
const messageAnchors = Array.from(viewport.querySelectorAll(MESSAGE_ANCHOR_SELECTOR));
|
|
25
|
+
const anchors = [...contentAnchors, ...messageAnchors].map((element) => ({
|
|
26
|
+
element,
|
|
27
|
+
...relativePosition(element, viewport),
|
|
28
|
+
}));
|
|
29
|
+
return {
|
|
30
|
+
anchors,
|
|
31
|
+
atEnd: isMessageScrollerAtEnd(viewport),
|
|
32
|
+
scrollHeight: viewport.scrollHeight,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Preserve the first previously visible stable leaf when content above it
|
|
37
|
+
* changes height. Native scroll anchoring may already have done this; in that
|
|
38
|
+
* case the measured delta is zero and this is deliberately a no-op.
|
|
39
|
+
*/
|
|
40
|
+
export function restoreMessageScrollerAnchor(viewport, snapshot) {
|
|
41
|
+
const anchor = snapshot.anchors.find(({ element, top, bottom }) => {
|
|
42
|
+
if (!element.isConnected)
|
|
43
|
+
return false;
|
|
44
|
+
const current = element.getBoundingClientRect();
|
|
45
|
+
return current.height > 0 && bottom > 0 && top < viewport.clientHeight;
|
|
46
|
+
});
|
|
47
|
+
if (!anchor)
|
|
48
|
+
return false;
|
|
49
|
+
const current = relativePosition(anchor.element, viewport);
|
|
50
|
+
const delta = current.top - anchor.top;
|
|
51
|
+
if (Math.abs(delta) <= POSITION_EPSILON_PX)
|
|
52
|
+
return false;
|
|
53
|
+
viewport.scrollTop += delta;
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Complements shadcn's message scroller for mutable chat rows. The upstream
|
|
58
|
+
* primitive handles appends, prepends, and explicit jumps well, but a nested
|
|
59
|
+
* disclosure shrinking inside an existing row can look like user scroll
|
|
60
|
+
* intent. We remember whether the viewport was following the end before the
|
|
61
|
+
* resize and restore that mode, or preserve a visible content leaf when the
|
|
62
|
+
* user is reading higher in the transcript.
|
|
63
|
+
*/
|
|
64
|
+
export function useMessageScrollerLayoutStability(viewportRef, scrollToEnd) {
|
|
65
|
+
const snapshotRef = useRef(null);
|
|
66
|
+
const followEndRef = useRef(true);
|
|
67
|
+
const userInteractingRef = useRef(false);
|
|
68
|
+
const suspendStabilityUntilRef = useRef(0);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const viewport = viewportRef.current;
|
|
71
|
+
if (!viewport || typeof ResizeObserver === 'undefined')
|
|
72
|
+
return;
|
|
73
|
+
snapshotRef.current = captureMessageScrollerLayout(viewport);
|
|
74
|
+
followEndRef.current = snapshotRef.current.atEnd;
|
|
75
|
+
let frame = 0;
|
|
76
|
+
const suspendForUserScroll = () => {
|
|
77
|
+
suspendStabilityUntilRef.current = Date.now() + USER_SCROLL_GRACE_MS;
|
|
78
|
+
};
|
|
79
|
+
const isUserScrolling = () => userInteractingRef.current ||
|
|
80
|
+
Date.now() < suspendStabilityUntilRef.current;
|
|
81
|
+
const handleWheel = (event) => {
|
|
82
|
+
suspendForUserScroll();
|
|
83
|
+
if (event.deltaY < 0)
|
|
84
|
+
followEndRef.current = false;
|
|
85
|
+
snapshotRef.current = captureMessageScrollerLayout(viewport);
|
|
86
|
+
};
|
|
87
|
+
const handlePointerDown = () => {
|
|
88
|
+
userInteractingRef.current = true;
|
|
89
|
+
suspendForUserScroll();
|
|
90
|
+
snapshotRef.current = captureMessageScrollerLayout(viewport);
|
|
91
|
+
};
|
|
92
|
+
const handlePointerUp = () => {
|
|
93
|
+
userInteractingRef.current = false;
|
|
94
|
+
suspendForUserScroll();
|
|
95
|
+
};
|
|
96
|
+
const captureAfterIntentionalScroll = () => {
|
|
97
|
+
const previous = snapshotRef.current;
|
|
98
|
+
const heightChanged = previous &&
|
|
99
|
+
Math.abs(previous.scrollHeight - viewport.scrollHeight) >
|
|
100
|
+
POSITION_EPSILON_PX;
|
|
101
|
+
// A browser clamp caused by content shrinking is layout, not user intent.
|
|
102
|
+
// Explicit wheel or scrollbar interaction always wins over that heuristic.
|
|
103
|
+
if (isUserScrolling() || !heightChanged) {
|
|
104
|
+
if (isUserScrolling())
|
|
105
|
+
suspendForUserScroll();
|
|
106
|
+
followEndRef.current = isMessageScrollerAtEnd(viewport);
|
|
107
|
+
snapshotRef.current = captureMessageScrollerLayout(viewport);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
111
|
+
window.cancelAnimationFrame(frame);
|
|
112
|
+
frame = window.requestAnimationFrame(() => {
|
|
113
|
+
const previous = snapshotRef.current;
|
|
114
|
+
if (isUserScrolling()) {
|
|
115
|
+
snapshotRef.current = captureMessageScrollerLayout(viewport);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (previous) {
|
|
119
|
+
if (followEndRef.current) {
|
|
120
|
+
// Public API resets the primitive's internal mode as well as the
|
|
121
|
+
// DOM position after a shrink was mistaken for an upward scroll.
|
|
122
|
+
scrollToEnd({ behavior: 'auto' });
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
restoreMessageScrollerAnchor(viewport, previous);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
snapshotRef.current = captureMessageScrollerLayout(viewport);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
const content = viewport.querySelector('[data-slot="message-scroller-content"]');
|
|
132
|
+
if (content)
|
|
133
|
+
resizeObserver.observe(content);
|
|
134
|
+
viewport.addEventListener('wheel', handleWheel, { passive: true });
|
|
135
|
+
viewport.addEventListener('pointerdown', handlePointerDown, {
|
|
136
|
+
passive: true,
|
|
137
|
+
});
|
|
138
|
+
window.addEventListener('pointerup', handlePointerUp, { passive: true });
|
|
139
|
+
window.addEventListener('pointercancel', handlePointerUp, { passive: true });
|
|
140
|
+
viewport.addEventListener('scroll', captureAfterIntentionalScroll, {
|
|
141
|
+
passive: true,
|
|
142
|
+
});
|
|
143
|
+
return () => {
|
|
144
|
+
window.cancelAnimationFrame(frame);
|
|
145
|
+
resizeObserver.disconnect();
|
|
146
|
+
viewport.removeEventListener('wheel', handleWheel);
|
|
147
|
+
viewport.removeEventListener('pointerdown', handlePointerDown);
|
|
148
|
+
window.removeEventListener('pointerup', handlePointerUp);
|
|
149
|
+
window.removeEventListener('pointercancel', handlePointerUp);
|
|
150
|
+
viewport.removeEventListener('scroll', captureAfterIntentionalScroll);
|
|
151
|
+
};
|
|
152
|
+
}, [scrollToEnd, viewportRef]);
|
|
153
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure scroll-ownership policy for the chat transcript.
|
|
3
|
+
*
|
|
4
|
+
* One rule outranks everything: the reader's scroll intent wins instantly.
|
|
5
|
+
* Programmatic motion is explicit — every scroll the primitive itself starts
|
|
6
|
+
* declares a target — so any viewport movement that was not commanded is, by
|
|
7
|
+
* definition, the user. That includes native scrollbar drags, which emit no
|
|
8
|
+
* wheel, pointer, or key events at all.
|
|
9
|
+
*
|
|
10
|
+
* The previous stack (upstream shadcn primitive + a local layout-stability
|
|
11
|
+
* patch) ran two competing controllers with grace timers and an
|
|
12
|
+
* "autoscrolling" veto window; a scrollbar drag during streaming could not
|
|
13
|
+
* release follow mode, so the next content growth yanked the viewport back
|
|
14
|
+
* down. This module replaces both with a single mode machine, mirroring the
|
|
15
|
+
* MessageScrollerPolicy used by the iOS transcript.
|
|
16
|
+
*/
|
|
17
|
+
export type MessageScrollerMode =
|
|
18
|
+
/** Pinned to the newest output; content growth keeps the end in view. */
|
|
19
|
+
'following-end'
|
|
20
|
+
/** The reader owns the position; the scroller never moves it. */
|
|
21
|
+
| 'free'
|
|
22
|
+
/** A turn anchor is pinned near the viewport top while output streams. */
|
|
23
|
+
| 'anchored'
|
|
24
|
+
/** A commanded jump is in flight; resolves on arrival or user motion. */
|
|
25
|
+
| 'settling-jump';
|
|
26
|
+
export type MessageScrollerResizeAction = 'stick-to-end' | 'reanchor' | 'preserve-reading-position' | 'none';
|
|
27
|
+
export interface MessageScrollerScrollEvent {
|
|
28
|
+
scrollTop: number;
|
|
29
|
+
lastScrollTop: number;
|
|
30
|
+
atEnd: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare class MessageScrollerPolicy {
|
|
33
|
+
mode: MessageScrollerMode;
|
|
34
|
+
autoScroll: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The destination of the programmatic scroll currently in flight, if any.
|
|
37
|
+
* Smooth scrolls pass through many intermediate positions; they count as
|
|
38
|
+
* our own motion only while they keep approaching this target.
|
|
39
|
+
*/
|
|
40
|
+
programmaticTarget: number | null;
|
|
41
|
+
private lastDistanceToTarget;
|
|
42
|
+
constructor(autoScroll: boolean);
|
|
43
|
+
get followsEnd(): boolean;
|
|
44
|
+
/** Declares a programmatic scroll about to start toward `target`. */
|
|
45
|
+
beginProgrammaticScroll(target: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* Abandons an in-flight programmatic scroll that will never arrive (the
|
|
48
|
+
* animation was dropped or its target became unreachable). Subsequent
|
|
49
|
+
* movement is classified as the reader's.
|
|
50
|
+
*/
|
|
51
|
+
cancelProgrammaticScroll(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Classifies a scroll event and returns true when it was the reader's own
|
|
54
|
+
* motion. Programmatic motion is recognized by monotonic approach to the
|
|
55
|
+
* declared target; everything else — wheel, trackpad, keyboard, scrollbar
|
|
56
|
+
* drag, momentum — is user motion and takes ownership immediately.
|
|
57
|
+
*/
|
|
58
|
+
handleScrollEvent(event: MessageScrollerScrollEvent): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Explicit input intent (wheel, touch, scroll keys). Upward intent releases
|
|
61
|
+
* immediately — before the scroll event lands — so a resize racing the
|
|
62
|
+
* same frame cannot pull the viewport down first.
|
|
63
|
+
*/
|
|
64
|
+
handleUserIntent(direction: 'up' | 'down' | 'unknown'): void;
|
|
65
|
+
/** How a content size change may move the viewport in the current mode. */
|
|
66
|
+
resizeAction(): MessageScrollerResizeAction;
|
|
67
|
+
/** A new turn anchor was appended and commanded into view. */
|
|
68
|
+
anchorToTurn(): void;
|
|
69
|
+
beginJump(): void;
|
|
70
|
+
jumpToEnd(): void;
|
|
71
|
+
jumpToStart(): void;
|
|
72
|
+
release(): void;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=message-scroller-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-scroller-policy.d.ts","sourceRoot":"","sources":["../../../src/components/ui/message-scroller-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,mBAAmB;AAC7B,yEAAyE;AACvE,eAAe;AACjB,iEAAiE;GAC/D,MAAM;AACR,0EAA0E;GACxE,UAAU;AACZ,yEAAyE;GACvE,eAAe,CAAA;AAEnB,MAAM,MAAM,2BAA2B,GACnC,cAAc,GACd,UAAU,GACV,2BAA2B,GAC3B,MAAM,CAAA;AAKV,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,OAAO,CAAA;CACf;AAED,qBAAa,qBAAqB;IAChC,IAAI,EAAE,mBAAmB,CAAA;IACzB,UAAU,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAO;IACxC,OAAO,CAAC,oBAAoB,CAA2B;gBAE3C,UAAU,EAAE,OAAO;IAK/B,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,qEAAqE;IACrE,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAK7C;;;;OAIG;IACH,wBAAwB,IAAI,IAAI;IAOhC;;;;;OAKG;IACH,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO;IA6B7D;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI;IAK5D,2EAA2E;IAC3E,YAAY,IAAI,2BAA2B;IAgB3C,8DAA8D;IAC9D,YAAY,IAAI,IAAI;IAIpB,SAAS,IAAI,IAAI;IAIjB,SAAS,IAAI,IAAI;IAIjB,WAAW,IAAI,IAAI;IAInB,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure scroll-ownership policy for the chat transcript.
|
|
3
|
+
*
|
|
4
|
+
* One rule outranks everything: the reader's scroll intent wins instantly.
|
|
5
|
+
* Programmatic motion is explicit — every scroll the primitive itself starts
|
|
6
|
+
* declares a target — so any viewport movement that was not commanded is, by
|
|
7
|
+
* definition, the user. That includes native scrollbar drags, which emit no
|
|
8
|
+
* wheel, pointer, or key events at all.
|
|
9
|
+
*
|
|
10
|
+
* The previous stack (upstream shadcn primitive + a local layout-stability
|
|
11
|
+
* patch) ran two competing controllers with grace timers and an
|
|
12
|
+
* "autoscrolling" veto window; a scrollbar drag during streaming could not
|
|
13
|
+
* release follow mode, so the next content growth yanked the viewport back
|
|
14
|
+
* down. This module replaces both with a single mode machine, mirroring the
|
|
15
|
+
* MessageScrollerPolicy used by the iOS transcript.
|
|
16
|
+
*/
|
|
17
|
+
const SCROLL_EPSILON_PX = 0.5;
|
|
18
|
+
const TARGET_ARRIVAL_PX = 1;
|
|
19
|
+
export class MessageScrollerPolicy {
|
|
20
|
+
mode;
|
|
21
|
+
autoScroll;
|
|
22
|
+
/**
|
|
23
|
+
* The destination of the programmatic scroll currently in flight, if any.
|
|
24
|
+
* Smooth scrolls pass through many intermediate positions; they count as
|
|
25
|
+
* our own motion only while they keep approaching this target.
|
|
26
|
+
*/
|
|
27
|
+
programmaticTarget = null;
|
|
28
|
+
lastDistanceToTarget = Number.POSITIVE_INFINITY;
|
|
29
|
+
constructor(autoScroll) {
|
|
30
|
+
this.autoScroll = autoScroll;
|
|
31
|
+
this.mode = autoScroll ? 'following-end' : 'free';
|
|
32
|
+
}
|
|
33
|
+
get followsEnd() {
|
|
34
|
+
return this.mode === 'following-end';
|
|
35
|
+
}
|
|
36
|
+
/** Declares a programmatic scroll about to start toward `target`. */
|
|
37
|
+
beginProgrammaticScroll(target) {
|
|
38
|
+
this.programmaticTarget = target;
|
|
39
|
+
this.lastDistanceToTarget = Number.POSITIVE_INFINITY;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Abandons an in-flight programmatic scroll that will never arrive (the
|
|
43
|
+
* animation was dropped or its target became unreachable). Subsequent
|
|
44
|
+
* movement is classified as the reader's.
|
|
45
|
+
*/
|
|
46
|
+
cancelProgrammaticScroll() {
|
|
47
|
+
if (this.programmaticTarget === null)
|
|
48
|
+
return;
|
|
49
|
+
this.programmaticTarget = null;
|
|
50
|
+
this.lastDistanceToTarget = Number.POSITIVE_INFINITY;
|
|
51
|
+
if (this.mode === 'settling-jump')
|
|
52
|
+
this.mode = 'free';
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Classifies a scroll event and returns true when it was the reader's own
|
|
56
|
+
* motion. Programmatic motion is recognized by monotonic approach to the
|
|
57
|
+
* declared target; everything else — wheel, trackpad, keyboard, scrollbar
|
|
58
|
+
* drag, momentum — is user motion and takes ownership immediately.
|
|
59
|
+
*/
|
|
60
|
+
handleScrollEvent(event) {
|
|
61
|
+
if (this.programmaticTarget !== null) {
|
|
62
|
+
const distance = Math.abs(event.scrollTop - this.programmaticTarget);
|
|
63
|
+
if (distance <= TARGET_ARRIVAL_PX) {
|
|
64
|
+
this.programmaticTarget = null;
|
|
65
|
+
this.lastDistanceToTarget = Number.POSITIVE_INFINITY;
|
|
66
|
+
if (this.mode === 'settling-jump') {
|
|
67
|
+
this.mode = event.atEnd && this.autoScroll ? 'following-end' : 'free';
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (distance <= this.lastDistanceToTarget + SCROLL_EPSILON_PX) {
|
|
72
|
+
this.lastDistanceToTarget = distance;
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
// Motion away from our own target: the reader grabbed the viewport
|
|
76
|
+
// mid-flight. The jump loses.
|
|
77
|
+
this.programmaticTarget = null;
|
|
78
|
+
this.lastDistanceToTarget = Number.POSITIVE_INFINITY;
|
|
79
|
+
}
|
|
80
|
+
const movedUp = event.scrollTop < event.lastScrollTop - SCROLL_EPSILON_PX;
|
|
81
|
+
const movedDown = event.scrollTop > event.lastScrollTop + SCROLL_EPSILON_PX;
|
|
82
|
+
if (!movedUp && !movedDown)
|
|
83
|
+
return false;
|
|
84
|
+
this.mode = event.atEnd && this.autoScroll ? 'following-end' : 'free';
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Explicit input intent (wheel, touch, scroll keys). Upward intent releases
|
|
89
|
+
* immediately — before the scroll event lands — so a resize racing the
|
|
90
|
+
* same frame cannot pull the viewport down first.
|
|
91
|
+
*/
|
|
92
|
+
handleUserIntent(direction) {
|
|
93
|
+
if (this.mode === 'following-end' && direction === 'down')
|
|
94
|
+
return;
|
|
95
|
+
this.mode = 'free';
|
|
96
|
+
}
|
|
97
|
+
/** How a content size change may move the viewport in the current mode. */
|
|
98
|
+
resizeAction() {
|
|
99
|
+
switch (this.mode) {
|
|
100
|
+
case 'following-end':
|
|
101
|
+
return 'stick-to-end';
|
|
102
|
+
case 'anchored':
|
|
103
|
+
return 'reanchor';
|
|
104
|
+
case 'settling-jump':
|
|
105
|
+
return 'none';
|
|
106
|
+
case 'free':
|
|
107
|
+
// A collapsing disclosure above the reader must not shift what they
|
|
108
|
+
// are looking at. Native scroll anchoring usually handles it; the
|
|
109
|
+
// caller re-pins the first visible stable leaf when it does not.
|
|
110
|
+
return 'preserve-reading-position';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** A new turn anchor was appended and commanded into view. */
|
|
114
|
+
anchorToTurn() {
|
|
115
|
+
this.mode = 'anchored';
|
|
116
|
+
}
|
|
117
|
+
beginJump() {
|
|
118
|
+
this.mode = 'settling-jump';
|
|
119
|
+
}
|
|
120
|
+
jumpToEnd() {
|
|
121
|
+
this.mode = this.autoScroll ? 'following-end' : 'free';
|
|
122
|
+
}
|
|
123
|
+
jumpToStart() {
|
|
124
|
+
this.mode = 'free';
|
|
125
|
+
}
|
|
126
|
+
release() {
|
|
127
|
+
this.mode = 'free';
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MessageScrollerDefaultScrollPosition, type MessageScrollerScrollAlign, type MessageScrollerScrollOptions, type MessageScrollerScrollable, type MessageScrollerVisibilityState } from './message-scroller-controller';
|
|
3
|
+
type MessageScrollerProviderProps = {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
autoScroll?: boolean;
|
|
6
|
+
defaultScrollPosition?: MessageScrollerDefaultScrollPosition;
|
|
7
|
+
scrollEdgeThreshold?: number;
|
|
8
|
+
scrollPreviousItemPeek?: number;
|
|
9
|
+
scrollMargin?: number;
|
|
10
|
+
};
|
|
11
|
+
declare function MessageScrollerProvider({ autoScroll, children, defaultScrollPosition, scrollEdgeThreshold, scrollPreviousItemPeek, scrollMargin, }: MessageScrollerProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
type MessageScrollerProps = React.ComponentProps<'div'>;
|
|
13
|
+
declare function MessageScrollerRoot({ children, ...props }: MessageScrollerProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
type MessageScrollerViewportProps = React.ComponentProps<'div'> & {
|
|
15
|
+
preserveScrollOnPrepend?: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare function MessageScrollerViewport({ 'aria-label': ariaLabel, children, onKeyDown, onScroll, onTouchMove, onWheel, preserveScrollOnPrepend, ref, role, tabIndex, ...props }: MessageScrollerViewportProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
type MessageScrollerContentProps = React.ComponentProps<'div'> & {
|
|
19
|
+
spacerClassName?: string;
|
|
20
|
+
};
|
|
21
|
+
declare function MessageScrollerContent({ 'aria-relevant': ariaRelevant, children, ref, role, spacerClassName, ...props }: MessageScrollerContentProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
type MessageScrollerItemProps = React.ComponentProps<'div'> & {
|
|
23
|
+
messageId?: string;
|
|
24
|
+
scrollAnchor?: boolean;
|
|
25
|
+
};
|
|
26
|
+
declare function MessageScrollerItem({ messageId, ref, scrollAnchor, ...props }: MessageScrollerItemProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
type MessageScrollerButtonDirection = 'start' | 'end';
|
|
28
|
+
type MessageScrollerButtonRenderState = {
|
|
29
|
+
active: boolean;
|
|
30
|
+
direction: MessageScrollerButtonDirection;
|
|
31
|
+
};
|
|
32
|
+
type MessageScrollerButtonProps = Omit<React.ComponentProps<'button'>, 'children'> & {
|
|
33
|
+
behavior?: ScrollBehavior;
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
direction?: MessageScrollerButtonDirection;
|
|
36
|
+
render?: React.ReactElement<Record<string, unknown>> | ((props: Record<string, unknown>, state: MessageScrollerButtonRenderState) => React.ReactElement | null);
|
|
37
|
+
};
|
|
38
|
+
declare function MessageScrollerButton({ behavior, children, className, direction, onClick, render, tabIndex, type, ...props }: MessageScrollerButtonProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
39
|
+
declare function useMessageScroller(): {
|
|
40
|
+
scrollToEnd: (options?: MessageScrollerScrollOptions) => boolean;
|
|
41
|
+
scrollToMessage: (messageId: string, options?: MessageScrollerScrollOptions) => boolean;
|
|
42
|
+
scrollToStart: (options?: MessageScrollerScrollOptions) => boolean;
|
|
43
|
+
};
|
|
44
|
+
declare function useMessageScrollerScrollable(): MessageScrollerScrollable;
|
|
45
|
+
declare function useMessageScrollerVisibility(): MessageScrollerVisibilityState;
|
|
46
|
+
declare const MessageScroller: {
|
|
47
|
+
Provider: typeof MessageScrollerProvider;
|
|
48
|
+
Root: typeof MessageScrollerRoot;
|
|
49
|
+
Viewport: typeof MessageScrollerViewport;
|
|
50
|
+
Content: typeof MessageScrollerContent;
|
|
51
|
+
Item: typeof MessageScrollerItem;
|
|
52
|
+
Button: typeof MessageScrollerButton;
|
|
53
|
+
};
|
|
54
|
+
export { MessageScroller, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, type MessageScrollerDefaultScrollPosition, type MessageScrollerScrollAlign, type MessageScrollerScrollOptions, type MessageScrollerScrollable, type MessageScrollerVisibilityState, };
|
|
55
|
+
//# sourceMappingURL=message-scroller-primitive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-scroller-primitive.d.ts","sourceRoot":"","sources":["../../../src/components/ui/message-scroller-primitive.tsx"],"names":[],"mappings":"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"}
|