@rtc-agent/component 0.2.7-rc.3 → 0.2.8-rc.0
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/README.md +109 -13
- package/dist/.generated/locales/en-US.d.ts +268 -0
- package/dist/.generated/locales/en-US.d.ts.map +1 -0
- package/dist/assets/{shared-worker-BEaT-a-g.js → shared-worker-CXyjL7E6.js} +210 -210
- package/dist/components/activity-bar/rtc-activity-bar.d.ts +67 -0
- package/dist/components/activity-bar/rtc-activity-bar.d.ts.map +1 -0
- package/dist/components/activity-bar/rtc-activity-bar.styles.d.ts +7 -0
- package/dist/components/activity-bar/rtc-activity-bar.styles.d.ts.map +1 -0
- package/dist/components/chat-layout/rtc-chat-layout.d.ts +218 -0
- package/dist/components/chat-layout/rtc-chat-layout.d.ts.map +1 -0
- package/dist/components/chat-layout/rtc-chat-layout.styles.d.ts +11 -0
- package/dist/components/chat-layout/rtc-chat-layout.styles.d.ts.map +1 -0
- package/dist/components/content-area/rtc-content-area.d.ts +34 -0
- package/dist/components/content-area/rtc-content-area.d.ts.map +1 -0
- package/dist/components/content-area/rtc-content-area.styles.d.ts +2 -0
- package/dist/components/content-area/rtc-content-area.styles.d.ts.map +1 -0
- package/dist/components/content-area/rtc-error-message.d.ts +82 -0
- package/dist/components/content-area/rtc-error-message.d.ts.map +1 -0
- package/dist/components/content-area/rtc-message-list.d.ts +251 -0
- package/dist/components/content-area/rtc-message-list.d.ts.map +1 -0
- package/dist/components/content-area/rtc-message-list.skeleton-styles.d.ts +13 -0
- package/dist/components/content-area/rtc-message-list.skeleton-styles.d.ts.map +1 -0
- package/dist/components/content-area/rtc-message-list.styles.d.ts +2 -0
- package/dist/components/content-area/rtc-message-list.styles.d.ts.map +1 -0
- package/dist/components/content-area/rtc-message-more-menu.d.ts +35 -0
- package/dist/components/content-area/rtc-message-more-menu.d.ts.map +1 -0
- package/dist/components/content-area/rtc-message.d.ts +208 -0
- package/dist/components/content-area/rtc-message.d.ts.map +1 -0
- package/dist/components/content-area/rtc-message.styles.d.ts +2 -0
- package/dist/components/content-area/rtc-message.styles.d.ts.map +1 -0
- package/dist/components/content-area/rtc-scroll-container.d.ts +44 -0
- package/dist/components/content-area/rtc-scroll-container.d.ts.map +1 -0
- package/dist/components/content-area/rtc-scroll-container.styles.d.ts +2 -0
- package/dist/components/content-area/rtc-scroll-container.styles.d.ts.map +1 -0
- package/dist/components/content-area/rtc-toolcall-card.d.ts +86 -0
- package/dist/components/content-area/rtc-toolcall-card.d.ts.map +1 -0
- package/dist/components/content-area/rtc-toolcall-card.styles.d.ts +2 -0
- package/dist/components/content-area/rtc-toolcall-card.styles.d.ts.map +1 -0
- package/dist/components/content-area/rtc-toolcall-reply.d.ts +77 -0
- package/dist/components/content-area/rtc-toolcall-reply.d.ts.map +1 -0
- package/dist/components/content-area/rtc-toolcall-reply.styles.d.ts +2 -0
- package/dist/components/content-area/rtc-toolcall-reply.styles.d.ts.map +1 -0
- package/dist/components/content-area/rtc-user-message.d.ts +116 -0
- package/dist/components/content-area/rtc-user-message.d.ts.map +1 -0
- package/dist/components/content-area/rtc-user-message.styles.d.ts +22 -0
- package/dist/components/content-area/rtc-user-message.styles.d.ts.map +1 -0
- package/dist/components/content-area/timeline.styles.d.ts +2 -0
- package/dist/components/content-area/timeline.styles.d.ts.map +1 -0
- package/dist/components/content-wrapper/rtc-content-wrapper.d.ts +25 -0
- package/dist/components/content-wrapper/rtc-content-wrapper.d.ts.map +1 -0
- package/dist/components/content-wrapper/rtc-content-wrapper.styles.d.ts +2 -0
- package/dist/components/content-wrapper/rtc-content-wrapper.styles.d.ts.map +1 -0
- package/dist/components/drawer/rtc-drawer.d.ts +75 -0
- package/dist/components/drawer/rtc-drawer.d.ts.map +1 -0
- package/dist/components/drawer/rtc-drawer.styles.d.ts +15 -0
- package/dist/components/drawer/rtc-drawer.styles.d.ts.map +1 -0
- package/dist/components/editor-area/rtc-editor-area.d.ts +119 -0
- package/dist/components/editor-area/rtc-editor-area.d.ts.map +1 -0
- package/dist/components/editor-area/rtc-editor-area.styles.d.ts +8 -0
- package/dist/components/editor-area/rtc-editor-area.styles.d.ts.map +1 -0
- package/dist/components/editor-area/rtc-editor-tab.d.ts +84 -0
- package/dist/components/editor-area/rtc-editor-tab.d.ts.map +1 -0
- package/dist/components/editor-area/rtc-editor-tab.styles.d.ts +8 -0
- package/dist/components/editor-area/rtc-editor-tab.styles.d.ts.map +1 -0
- package/dist/components/editor-area/rtc-editor-toolbar.d.ts +68 -0
- package/dist/components/editor-area/rtc-editor-toolbar.d.ts.map +1 -0
- package/dist/components/editor-area/rtc-editor-toolbar.styles.d.ts +8 -0
- package/dist/components/editor-area/rtc-editor-toolbar.styles.d.ts.map +1 -0
- package/dist/components/empty-state/rtc-empty-state.d.ts +24 -0
- package/dist/components/empty-state/rtc-empty-state.d.ts.map +1 -0
- package/dist/components/empty-state/rtc-empty-state.styles.d.ts +2 -0
- package/dist/components/empty-state/rtc-empty-state.styles.d.ts.map +1 -0
- package/dist/components/file-explorer/rtc-file-explorer.d.ts +94 -0
- package/dist/components/file-explorer/rtc-file-explorer.d.ts.map +1 -0
- package/dist/components/file-explorer/rtc-file-explorer.styles.d.ts +8 -0
- package/dist/components/file-explorer/rtc-file-explorer.styles.d.ts.map +1 -0
- package/dist/components/file-explorer/rtc-file-tree-item.d.ts +70 -0
- package/dist/components/file-explorer/rtc-file-tree-item.d.ts.map +1 -0
- package/dist/components/file-explorer/rtc-file-tree-item.styles.d.ts +8 -0
- package/dist/components/file-explorer/rtc-file-tree-item.styles.d.ts.map +1 -0
- package/dist/components/function-console/rtc-function-console.d.ts +32 -0
- package/dist/components/function-console/rtc-function-console.d.ts.map +1 -0
- package/dist/components/function-console/rtc-function-console.styles.d.ts +8 -0
- package/dist/components/function-console/rtc-function-console.styles.d.ts.map +1 -0
- package/dist/components/function-debugger/rtc-function-debugger.d.ts +39 -0
- package/dist/components/function-debugger/rtc-function-debugger.d.ts.map +1 -0
- package/dist/components/function-debugger/rtc-function-debugger.styles.d.ts +8 -0
- package/dist/components/function-debugger/rtc-function-debugger.styles.d.ts.map +1 -0
- package/dist/components/function-history/rtc-function-history.d.ts +49 -0
- package/dist/components/function-history/rtc-function-history.d.ts.map +1 -0
- package/dist/components/function-history/rtc-function-history.styles.d.ts +8 -0
- package/dist/components/function-history/rtc-function-history.styles.d.ts.map +1 -0
- package/dist/components/function-params/rtc-function-params.d.ts +29 -0
- package/dist/components/function-params/rtc-function-params.d.ts.map +1 -0
- package/dist/components/function-params/rtc-function-params.styles.d.ts +8 -0
- package/dist/components/function-params/rtc-function-params.styles.d.ts.map +1 -0
- package/dist/components/function-tree/rtc-function-tree.d.ts +59 -0
- package/dist/components/function-tree/rtc-function-tree.d.ts.map +1 -0
- package/dist/components/function-tree/rtc-function-tree.styles.d.ts +2 -0
- package/dist/components/function-tree/rtc-function-tree.styles.d.ts.map +1 -0
- package/dist/components/functions-layout/rtc-functions-layout.d.ts +45 -0
- package/dist/components/functions-layout/rtc-functions-layout.d.ts.map +1 -0
- package/dist/components/functions-layout/rtc-functions-layout.styles.d.ts +8 -0
- package/dist/components/functions-layout/rtc-functions-layout.styles.d.ts.map +1 -0
- package/dist/components/input-area/rtc-input-area.d.ts +167 -0
- package/dist/components/input-area/rtc-input-area.d.ts.map +1 -0
- package/dist/components/input-area/rtc-input-area.styles.d.ts +2 -0
- package/dist/components/input-area/rtc-input-area.styles.d.ts.map +1 -0
- package/dist/components/login/rtc-login-dialog.d.ts +54 -0
- package/dist/components/login/rtc-login-dialog.d.ts.map +1 -0
- package/dist/components/login/rtc-login-dialog.styles.d.ts +2 -0
- package/dist/components/login/rtc-login-dialog.styles.d.ts.map +1 -0
- package/dist/components/login/rtc-login-page.d.ts +39 -0
- package/dist/components/login/rtc-login-page.d.ts.map +1 -0
- package/dist/components/login/rtc-login-page.styles.d.ts +2 -0
- package/dist/components/login/rtc-login-page.styles.d.ts.map +1 -0
- package/dist/components/logo/rtc-logo.d.ts +38 -0
- package/dist/components/logo/rtc-logo.d.ts.map +1 -0
- package/dist/components/markdown-editor/rtc-markdown-editor.d.ts +91 -0
- package/dist/components/markdown-editor/rtc-markdown-editor.d.ts.map +1 -0
- package/dist/components/markdown-editor/rtc-markdown-editor.styles.d.ts +2 -0
- package/dist/components/markdown-editor/rtc-markdown-editor.styles.d.ts.map +1 -0
- package/dist/components/notice-bar/rtc-notice-bar.d.ts +23 -0
- package/dist/components/notice-bar/rtc-notice-bar.d.ts.map +1 -0
- package/dist/components/notice-bar/rtc-notice-bar.styles.d.ts +2 -0
- package/dist/components/notice-bar/rtc-notice-bar.styles.d.ts.map +1 -0
- package/dist/components/overlay/rtc-ask-user.d.ts +91 -0
- package/dist/components/overlay/rtc-ask-user.d.ts.map +1 -0
- package/dist/components/overlay/rtc-ask-user.styles.d.ts +11 -0
- package/dist/components/overlay/rtc-ask-user.styles.d.ts.map +1 -0
- package/dist/components/overlay/rtc-command-panel.d.ts +44 -0
- package/dist/components/overlay/rtc-command-panel.d.ts.map +1 -0
- package/dist/components/overlay/rtc-command-panel.styles.d.ts +2 -0
- package/dist/components/overlay/rtc-command-panel.styles.d.ts.map +1 -0
- package/dist/components/overlay/rtc-export-dialog.d.ts +59 -0
- package/dist/components/overlay/rtc-export-dialog.d.ts.map +1 -0
- package/dist/components/overlay/rtc-export-dialog.styles.d.ts +11 -0
- package/dist/components/overlay/rtc-export-dialog.styles.d.ts.map +1 -0
- package/dist/components/overlay/rtc-mode-panel.d.ts +30 -0
- package/dist/components/overlay/rtc-mode-panel.d.ts.map +1 -0
- package/dist/components/overlay/rtc-mode-panel.styles.d.ts +2 -0
- package/dist/components/overlay/rtc-mode-panel.styles.d.ts.map +1 -0
- package/dist/components/overlay/rtc-overlay-manager.d.ts +30 -0
- package/dist/components/overlay/rtc-overlay-manager.d.ts.map +1 -0
- package/dist/components/overlay/rtc-overlay-manager.styles.d.ts +2 -0
- package/dist/components/overlay/rtc-overlay-manager.styles.d.ts.map +1 -0
- package/dist/components/overlay/rtc-restore-confirm.d.ts +37 -0
- package/dist/components/overlay/rtc-restore-confirm.d.ts.map +1 -0
- package/dist/components/overlay/rtc-restore-confirm.styles.d.ts +2 -0
- package/dist/components/overlay/rtc-restore-confirm.styles.d.ts.map +1 -0
- package/dist/components/overlay/rtc-scenario-panel.d.ts +33 -0
- package/dist/components/overlay/rtc-scenario-panel.d.ts.map +1 -0
- package/dist/components/overlay/rtc-scenario-panel.styles.d.ts +2 -0
- package/dist/components/overlay/rtc-scenario-panel.styles.d.ts.map +1 -0
- package/dist/components/overlay/rtc-session-panel.d.ts +39 -0
- package/dist/components/overlay/rtc-session-panel.d.ts.map +1 -0
- package/dist/components/overlay/rtc-session-panel.styles.d.ts +2 -0
- package/dist/components/overlay/rtc-session-panel.styles.d.ts.map +1 -0
- package/dist/components/overlay/rtc-toast.d.ts +51 -0
- package/dist/components/overlay/rtc-toast.d.ts.map +1 -0
- package/dist/components/overlay/rtc-todo-panel.d.ts +23 -0
- package/dist/components/overlay/rtc-todo-panel.d.ts.map +1 -0
- package/dist/components/overlay/rtc-todo-panel.styles.d.ts +2 -0
- package/dist/components/overlay/rtc-todo-panel.styles.d.ts.map +1 -0
- package/dist/components/overlay/rtc-tool-confirm.d.ts +30 -0
- package/dist/components/overlay/rtc-tool-confirm.d.ts.map +1 -0
- package/dist/components/overlay/rtc-tool-confirm.styles.d.ts +2 -0
- package/dist/components/overlay/rtc-tool-confirm.styles.d.ts.map +1 -0
- package/dist/components/rtc-agent/helpers/bus-handler.d.ts +110 -0
- package/dist/components/rtc-agent/helpers/bus-handler.d.ts.map +1 -0
- package/dist/components/rtc-agent/helpers/command-handler.d.ts +25 -0
- package/dist/components/rtc-agent/helpers/command-handler.d.ts.map +1 -0
- package/dist/components/rtc-agent/helpers/connection-setup.d.ts +89 -0
- package/dist/components/rtc-agent/helpers/connection-setup.d.ts.map +1 -0
- package/dist/components/rtc-agent/helpers/dialog-helpers.d.ts +63 -0
- package/dist/components/rtc-agent/helpers/dialog-helpers.d.ts.map +1 -0
- package/dist/components/rtc-agent/helpers/session-loader.d.ts +69 -0
- package/dist/components/rtc-agent/helpers/session-loader.d.ts.map +1 -0
- package/dist/components/rtc-agent/helpers/vfs-operations.d.ts +155 -0
- package/dist/components/rtc-agent/helpers/vfs-operations.d.ts.map +1 -0
- package/dist/components/rtc-agent/rtc-agent.d.ts +677 -0
- package/dist/components/rtc-agent/rtc-agent.d.ts.map +1 -0
- package/dist/components/rtc-agent/rtc-agent.styles.d.ts +16 -0
- package/dist/components/rtc-agent/rtc-agent.styles.d.ts.map +1 -0
- package/dist/components/session-header/rtc-session-header.d.ts +77 -0
- package/dist/components/session-header/rtc-session-header.d.ts.map +1 -0
- package/dist/components/session-header/rtc-session-header.styles.d.ts +2 -0
- package/dist/components/session-header/rtc-session-header.styles.d.ts.map +1 -0
- package/dist/components/session-tree/rtc-session-tab-bar.d.ts +43 -0
- package/dist/components/session-tree/rtc-session-tab-bar.d.ts.map +1 -0
- package/dist/components/session-tree/rtc-session-tab-bar.styles.d.ts +10 -0
- package/dist/components/session-tree/rtc-session-tab-bar.styles.d.ts.map +1 -0
- package/dist/components/session-tree/rtc-session-tab.d.ts +33 -0
- package/dist/components/session-tree/rtc-session-tab.d.ts.map +1 -0
- package/dist/components/session-tree/rtc-session-tab.styles.d.ts +11 -0
- package/dist/components/session-tree/rtc-session-tab.styles.d.ts.map +1 -0
- package/dist/components/session-tree/rtc-session-tree-item.d.ts +42 -0
- package/dist/components/session-tree/rtc-session-tree-item.d.ts.map +1 -0
- package/dist/components/session-tree/rtc-session-tree-item.styles.d.ts +11 -0
- package/dist/components/session-tree/rtc-session-tree-item.styles.d.ts.map +1 -0
- package/dist/components/session-tree/rtc-session-tree.d.ts +71 -0
- package/dist/components/session-tree/rtc-session-tree.d.ts.map +1 -0
- package/dist/components/session-tree/rtc-session-tree.styles.d.ts +10 -0
- package/dist/components/session-tree/rtc-session-tree.styles.d.ts.map +1 -0
- package/dist/components/settings/rtc-settings-panel.d.ts +27 -0
- package/dist/components/settings/rtc-settings-panel.d.ts.map +1 -0
- package/dist/components/settings/rtc-settings-panel.styles.d.ts +8 -0
- package/dist/components/settings/rtc-settings-panel.styles.d.ts.map +1 -0
- package/dist/components/settings-layout/rtc-settings-layout.d.ts +74 -0
- package/dist/components/settings-layout/rtc-settings-layout.d.ts.map +1 -0
- package/dist/components/settings-layout/rtc-settings-layout.styles.d.ts +8 -0
- package/dist/components/settings-layout/rtc-settings-layout.styles.d.ts.map +1 -0
- package/dist/components/settings-layout/rtc-settings-nav.d.ts +62 -0
- package/dist/components/settings-layout/rtc-settings-nav.d.ts.map +1 -0
- package/dist/components/settings-layout/rtc-settings-nav.styles.d.ts +7 -0
- package/dist/components/settings-layout/rtc-settings-nav.styles.d.ts.map +1 -0
- package/dist/components/status-bar/rtc-status-bar.d.ts +39 -0
- package/dist/components/status-bar/rtc-status-bar.d.ts.map +1 -0
- package/dist/components/status-bar/rtc-status-bar.styles.d.ts +11 -0
- package/dist/components/status-bar/rtc-status-bar.styles.d.ts.map +1 -0
- package/dist/components/title-bar/rtc-title-bar.d.ts +46 -0
- package/dist/components/title-bar/rtc-title-bar.d.ts.map +1 -0
- package/dist/components/title-bar/rtc-title-bar.styles.d.ts +2 -0
- package/dist/components/title-bar/rtc-title-bar.styles.d.ts.map +1 -0
- package/dist/components/token-usage/rtc-token-usage.d.ts +60 -0
- package/dist/components/token-usage/rtc-token-usage.d.ts.map +1 -0
- package/dist/config/auth.d.ts +58 -0
- package/dist/config/auth.d.ts.map +1 -0
- package/dist/contexts/activity.d.ts +42 -0
- package/dist/contexts/activity.d.ts.map +1 -0
- package/dist/contexts/auth.d.ts +29 -0
- package/dist/contexts/auth.d.ts.map +1 -0
- package/dist/contexts/editor.d.ts +43 -0
- package/dist/contexts/editor.d.ts.map +1 -0
- package/dist/contexts/file-explorer.d.ts +48 -0
- package/dist/contexts/file-explorer.d.ts.map +1 -0
- package/dist/contexts/function-debug.d.ts +52 -0
- package/dist/contexts/function-debug.d.ts.map +1 -0
- package/dist/contexts/functions.d.ts +43 -0
- package/dist/contexts/functions.d.ts.map +1 -0
- package/dist/contexts/logo.d.ts +21 -0
- package/dist/contexts/logo.d.ts.map +1 -0
- package/dist/contexts/message.d.ts +22 -0
- package/dist/contexts/message.d.ts.map +1 -0
- package/dist/contexts/mode.d.ts +18 -0
- package/dist/contexts/mode.d.ts.map +1 -0
- package/dist/contexts/notification.d.ts +21 -0
- package/dist/contexts/notification.d.ts.map +1 -0
- package/dist/contexts/session-tab.d.ts +10 -0
- package/dist/contexts/session-tab.d.ts.map +1 -0
- package/dist/contexts/session-tree.d.ts +10 -0
- package/dist/contexts/session-tree.d.ts.map +1 -0
- package/dist/contexts/session.d.ts +16 -0
- package/dist/contexts/session.d.ts.map +1 -0
- package/dist/contexts/settings.d.ts +40 -0
- package/dist/contexts/settings.d.ts.map +1 -0
- package/dist/contexts/skill.d.ts +27 -0
- package/dist/contexts/skill.d.ts.map +1 -0
- package/dist/contexts/tool-call.d.ts +16 -0
- package/dist/contexts/tool-call.d.ts.map +1 -0
- package/dist/contexts/turn-count.d.ts +23 -0
- package/dist/contexts/turn-count.d.ts.map +1 -0
- package/dist/contexts/window-state.d.ts +20 -0
- package/dist/contexts/window-state.d.ts.map +1 -0
- package/dist/controllers/activity.controller.d.ts +45 -0
- package/dist/controllers/activity.controller.d.ts.map +1 -0
- package/dist/controllers/auth.controller.d.ts +207 -0
- package/dist/controllers/auth.controller.d.ts.map +1 -0
- package/dist/controllers/editor-area.controller.d.ts +120 -0
- package/dist/controllers/editor-area.controller.d.ts.map +1 -0
- package/dist/controllers/editor.controller.d.ts +29 -0
- package/dist/controllers/editor.controller.d.ts.map +1 -0
- package/dist/controllers/event-binding.controller.d.ts +204 -0
- package/dist/controllers/event-binding.controller.d.ts.map +1 -0
- package/dist/controllers/file-explorer.controller.d.ts +42 -0
- package/dist/controllers/file-explorer.controller.d.ts.map +1 -0
- package/dist/controllers/fork.controller.d.ts +63 -0
- package/dist/controllers/fork.controller.d.ts.map +1 -0
- package/dist/controllers/function-debug.controller.d.ts +67 -0
- package/dist/controllers/function-debug.controller.d.ts.map +1 -0
- package/dist/controllers/functions.controller.d.ts +31 -0
- package/dist/controllers/functions.controller.d.ts.map +1 -0
- package/dist/controllers/message.controller.d.ts +192 -0
- package/dist/controllers/message.controller.d.ts.map +1 -0
- package/dist/controllers/mode.controller.d.ts +26 -0
- package/dist/controllers/mode.controller.d.ts.map +1 -0
- package/dist/controllers/notification.controller.d.ts +105 -0
- package/dist/controllers/notification.controller.d.ts.map +1 -0
- package/dist/controllers/persistence.controller.d.ts +145 -0
- package/dist/controllers/persistence.controller.d.ts.map +1 -0
- package/dist/controllers/session-tab.controller.d.ts +85 -0
- package/dist/controllers/session-tab.controller.d.ts.map +1 -0
- package/dist/controllers/session-tree.controller.d.ts +44 -0
- package/dist/controllers/session-tree.controller.d.ts.map +1 -0
- package/dist/controllers/session.controller.d.ts +58 -0
- package/dist/controllers/session.controller.d.ts.map +1 -0
- package/dist/controllers/settings.controller.d.ts +46 -0
- package/dist/controllers/settings.controller.d.ts.map +1 -0
- package/dist/controllers/skill.controller.d.ts +81 -0
- package/dist/controllers/skill.controller.d.ts.map +1 -0
- package/dist/controllers/status-bar.controller.d.ts +32 -0
- package/dist/controllers/status-bar.controller.d.ts.map +1 -0
- package/dist/controllers/toast.controller.d.ts +29 -0
- package/dist/controllers/toast.controller.d.ts.map +1 -0
- package/dist/controllers/tool-call.controller.d.ts +38 -0
- package/dist/controllers/tool-call.controller.d.ts.map +1 -0
- package/dist/controllers/window-interaction.controller.d.ts +130 -0
- package/dist/controllers/window-interaction.controller.d.ts.map +1 -0
- package/dist/controllers/window-state.controller.d.ts +79 -0
- package/dist/controllers/window-state.controller.d.ts.map +1 -0
- package/dist/core/builtin-system-group.d.ts +73 -0
- package/dist/core/builtin-system-group.d.ts.map +1 -0
- package/dist/core/event-bus.d.ts +133 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/function-registry.d.ts +196 -0
- package/dist/core/function-registry.d.ts.map +1 -0
- package/dist/core/i18n.d.ts +25 -0
- package/dist/core/i18n.d.ts.map +1 -0
- package/dist/core/locale-controller.d.ts +25 -0
- package/dist/core/locale-controller.d.ts.map +1 -0
- package/dist/core/markdown-generator.d.ts +46 -0
- package/dist/core/markdown-generator.d.ts.map +1 -0
- package/dist/core/ready.d.ts +33 -0
- package/dist/core/ready.d.ts.map +1 -0
- package/dist/core/scenario-loader.d.ts +60 -0
- package/dist/core/scenario-loader.d.ts.map +1 -0
- package/dist/core/theme.d.ts +29 -0
- package/dist/core/theme.d.ts.map +1 -0
- package/dist/debug-api-core.d.ts +9 -0
- package/dist/debug-api-core.d.ts.map +1 -0
- package/dist/debug-api-ext.d.ts +16 -0
- package/dist/debug-api-ext.d.ts.map +1 -0
- package/dist/debug-api-helpers.d.ts +28 -0
- package/dist/debug-api-helpers.d.ts.map +1 -0
- package/dist/debug-api-types.d.ts +206 -0
- package/dist/debug-api-types.d.ts.map +1 -0
- package/dist/debug-api.d.ts +10 -0
- package/dist/debug-api.d.ts.map +1 -0
- package/dist/elements.d.ts +26 -0
- package/dist/elements.d.ts.map +1 -0
- package/dist/{en-US-B3u0M1QC.js → en-US-DGPo7Pzk.js} +56 -8
- package/dist/factory.d.ts +68 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/{highlight-languages-Do4vG6hX.js → highlight-languages-BStkA3vP.js} +1 -1
- package/dist/icons/icons.d.ts +93 -0
- package/dist/icons/icons.d.ts.map +1 -0
- package/dist/icons/index.d.ts +8 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/logo.d.ts +15 -0
- package/dist/icons/logo.d.ts.map +1 -0
- package/dist/{index-TrHSQq--.js → index-c20k11wZ.js} +28078 -23840
- package/dist/index.d.ts +116 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -36
- package/dist/index.umd.js +3277 -1094
- package/dist/locales/en-US.d.ts +4 -0
- package/dist/locales/en-US.d.ts.map +1 -0
- package/dist/main.d.ts +17 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/master-lock.d.ts +72 -0
- package/dist/master-lock.d.ts.map +1 -0
- package/dist/registry.d.ts +2 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/repositories/index.d.ts +8 -0
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/message.repository.d.ts +182 -0
- package/dist/repositories/message.repository.d.ts.map +1 -0
- package/dist/stats.html +1 -1
- package/dist/storage.d.ts +11 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/styles/base.d.ts +8 -0
- package/dist/styles/base.d.ts.map +1 -0
- package/dist/styles/index.d.ts +5 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/themes/dark.d.ts +2 -0
- package/dist/styles/themes/dark.d.ts.map +1 -0
- package/dist/styles/themes/light.d.ts +2 -0
- package/dist/styles/themes/light.d.ts.map +1 -0
- package/dist/styles/tokens.d.ts +22 -0
- package/dist/styles/tokens.d.ts.map +1 -0
- package/dist/types/activity-bar-config.d.ts +38 -0
- package/dist/types/activity-bar-config.d.ts.map +1 -0
- package/dist/types/agent-config.d.ts +61 -0
- package/dist/types/agent-config.d.ts.map +1 -0
- package/dist/types/events.d.ts +112 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/factory.d.ts +610 -0
- package/dist/types/factory.d.ts.map +1 -0
- package/dist/types/functions-debug.d.ts +48 -0
- package/dist/types/functions-debug.d.ts.map +1 -0
- package/dist/types/index.d.ts +386 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/skill.d.ts +207 -0
- package/dist/types/skill.d.ts.map +1 -0
- package/dist/types/window-config.d.ts +122 -0
- package/dist/types/window-config.d.ts.map +1 -0
- package/dist/utils/clipboard.d.ts +14 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/command-parser.d.ts +33 -0
- package/dist/utils/command-parser.d.ts.map +1 -0
- package/dist/utils/content-data.d.ts +113 -0
- package/dist/utils/content-data.d.ts.map +1 -0
- package/dist/utils/custom-scrollbar.d.ts +41 -0
- package/dist/utils/custom-scrollbar.d.ts.map +1 -0
- package/dist/utils/device.d.ts +22 -0
- package/dist/utils/device.d.ts.map +1 -0
- package/dist/utils/floating-panel-controller.d.ts +52 -0
- package/dist/utils/floating-panel-controller.d.ts.map +1 -0
- package/dist/utils/format.d.ts +27 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/highlight-languages.d.ts +9 -0
- package/dist/utils/highlight-languages.d.ts.map +1 -0
- package/dist/utils/message-skeleton.d.ts +39 -0
- package/dist/utils/message-skeleton.d.ts.map +1 -0
- package/dist/utils/message-virtual-scroll.d.ts +595 -0
- package/dist/utils/message-virtual-scroll.d.ts.map +1 -0
- package/dist/utils/relative-time.d.ts +14 -0
- package/dist/utils/relative-time.d.ts.map +1 -0
- package/dist/utils/scroll-saver.d.ts +34 -0
- package/dist/utils/scroll-saver.d.ts.map +1 -0
- package/dist/utils/session-exporter.d.ts +65 -0
- package/dist/utils/session-exporter.d.ts.map +1 -0
- package/dist/utils/skeleton-tracker.d.ts +144 -0
- package/dist/utils/skeleton-tracker.d.ts.map +1 -0
- package/dist/utils/visibility-manager.d.ts +103 -0
- package/dist/utils/visibility-manager.d.ts.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/validation/index.d.ts +53 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/openapi-to-zod.d.ts +15 -0
- package/dist/validation/openapi-to-zod.d.ts.map +1 -0
- package/dist/validation/zod-to-openapi.d.ts +66 -0
- package/dist/validation/zod-to-openapi.d.ts.map +1 -0
- package/dist/worker-bridge.d.ts +152 -0
- package/dist/worker-bridge.d.ts.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message Virtual Scroll - Inspired by Telegram Web
|
|
3
|
+
*
|
|
4
|
+
* Architecture (mirrors Telegram's bubbles.ts + appMessagesManager):
|
|
5
|
+
* 1. Data layer: external repository = "cache" (like appMessagesManager)
|
|
6
|
+
* 2. DOM layer: _elementMap = rendered DOM elements (like bubbles)
|
|
7
|
+
* 3. Viewport slicing: classify into invisibleTop/visible/invisibleBottom
|
|
8
|
+
* 4. Delete slice: remove off-screen DOM, mark loadedTop/Bottom = false
|
|
9
|
+
* 5. Restore: when scrolling back, onLoadMore loads from cache using window boundary IDs
|
|
10
|
+
*
|
|
11
|
+
* Key Telegram references:
|
|
12
|
+
* - loadMoreHistory: components/chat/bubbles.ts:4570
|
|
13
|
+
* - getRenderedHistory('asc') → [firstMid, ..., lastMid]
|
|
14
|
+
* - getHistory1(history[0], true) for top
|
|
15
|
+
* - getHistory1(history[last], false, true) for bottom
|
|
16
|
+
*/
|
|
17
|
+
import { VisibilityManager, VisibilityState } from './visibility-manager.js';
|
|
18
|
+
/**
|
|
19
|
+
* Stateful component interface - components can implement this to preserve state
|
|
20
|
+
* across virtualization (destroy/restore cycles).
|
|
21
|
+
*/
|
|
22
|
+
export interface StatefulComponent {
|
|
23
|
+
getState(): Record<string, unknown>;
|
|
24
|
+
setState(state: Record<string, unknown>): void;
|
|
25
|
+
}
|
|
26
|
+
export interface WindowBoundary {
|
|
27
|
+
/** First item's ID in current window (undefined if empty) */
|
|
28
|
+
firstId: string | undefined;
|
|
29
|
+
/** Last item's ID in current window (undefined if empty) */
|
|
30
|
+
lastId: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
export interface MessageVirtualScrollOptions<T> {
|
|
33
|
+
scrollContainer: HTMLElement;
|
|
34
|
+
innerContainer: HTMLElement;
|
|
35
|
+
renderItem: (item: T, index: number) => HTMLElement;
|
|
36
|
+
getItemId: (item: T) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Called when scrolling near edge and more messages may be available.
|
|
39
|
+
* Receives current window boundary - use it to load adjacent messages from cache.
|
|
40
|
+
* Return empty array to signal no more messages in that direction.
|
|
41
|
+
*
|
|
42
|
+
* Mirrors Telegram's loadMoreHistory → getHistory1(maxId, reverse) pattern.
|
|
43
|
+
*/
|
|
44
|
+
onLoadMore?: (direction: 'top' | 'bottom', boundary: WindowBoundary) => Promise<T[]>;
|
|
45
|
+
/** CSS selector for message elements (default: '.message') */
|
|
46
|
+
query?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Preload threshold - start loading when this far from edge (px, default: 300).
|
|
49
|
+
* Telegram uses 300px (onScrollOffset = 300).
|
|
50
|
+
*/
|
|
51
|
+
preloadThreshold?: number;
|
|
52
|
+
/** Messages to keep as buffer on each side of viewport (default: 20) */
|
|
53
|
+
bufferMessages?: number;
|
|
54
|
+
/** Callback when content size changes (for custom scrollbar) */
|
|
55
|
+
onSizeChange?: () => void;
|
|
56
|
+
/**
|
|
57
|
+
* Extract the "changeable content" from an item for comparison.
|
|
58
|
+
* Only the returned value is compared to detect changes.
|
|
59
|
+
* This is more efficient than JSON.stringify on the entire item.
|
|
60
|
+
*
|
|
61
|
+
* Example: For messages, return {content, status, timestamp} to ignore
|
|
62
|
+
* internal fields that don't affect rendering.
|
|
63
|
+
*
|
|
64
|
+
* If not provided, falls back to JSON.stringify comparison.
|
|
65
|
+
*/
|
|
66
|
+
getChangeableContent?: (item: T) => unknown;
|
|
67
|
+
/**
|
|
68
|
+
* Update an existing element in-place with new item data.
|
|
69
|
+
* If provided, updateItemById and updateItems will call this instead of
|
|
70
|
+
* destroying and recreating the element. This preserves DOM state
|
|
71
|
+
* (e.g., rendered Markdown) and prevents visual flicker during streaming.
|
|
72
|
+
*
|
|
73
|
+
* The callback should update the element's properties to reflect the new item.
|
|
74
|
+
* If not provided, falls back to destroy-rebuild pattern.
|
|
75
|
+
*/
|
|
76
|
+
updateItemElement?: (element: HTMLElement, item: T, index: number) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Create a skeleton placeholder element for an item being virtualized.
|
|
79
|
+
* If not provided, uses MessageSkeletonGenerator to create default skeletons.
|
|
80
|
+
*/
|
|
81
|
+
createPlaceholder?: (item: T, height: number) => HTMLElement;
|
|
82
|
+
/**
|
|
83
|
+
* Extract component state before destroying an element (for state preservation).
|
|
84
|
+
* Called during viewport slicing before replacing with skeleton.
|
|
85
|
+
*/
|
|
86
|
+
extractComponentState?: (item: T, element: HTMLElement) => Record<string, unknown> | null;
|
|
87
|
+
/**
|
|
88
|
+
* Inject component state after restoring an element from skeleton.
|
|
89
|
+
* Called synchronously before first render to avoid flicker.
|
|
90
|
+
*/
|
|
91
|
+
injectComponentState?: (item: T, element: HTMLElement, state: Record<string, unknown>) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Check if an item is stable (safe to virtualize).
|
|
94
|
+
* Unstable items (e.g., streaming messages) are not replaced with skeletons.
|
|
95
|
+
*/
|
|
96
|
+
isItemStable?: (item: T) => boolean;
|
|
97
|
+
}
|
|
98
|
+
export declare class MessageVirtualScroll<T> {
|
|
99
|
+
private _scrollContainer;
|
|
100
|
+
private _innerContainer;
|
|
101
|
+
private _renderItem;
|
|
102
|
+
private _getItemId;
|
|
103
|
+
private _onLoadMore?;
|
|
104
|
+
private _onSizeChange?;
|
|
105
|
+
private _getChangeableContent?;
|
|
106
|
+
private _updateItemElement?;
|
|
107
|
+
private _query;
|
|
108
|
+
private _preloadThreshold;
|
|
109
|
+
private _bufferMessages;
|
|
110
|
+
/** Currently loaded window of items */
|
|
111
|
+
private _items;
|
|
112
|
+
/** Map from item index to DOM element */
|
|
113
|
+
private _elementMap;
|
|
114
|
+
/** Map from item ID to index for O(1) lookup */
|
|
115
|
+
private _idToIndex;
|
|
116
|
+
/**
|
|
117
|
+
* loadedTop = true means "no more messages above the current window"
|
|
118
|
+
* loadedBottom = true means "no more messages below the current window"
|
|
119
|
+
*
|
|
120
|
+
* When viewport is sliced, these become false, signaling that scrolling
|
|
121
|
+
* back should trigger onLoadMore to restore destroyed messages.
|
|
122
|
+
* (Mirrors Telegram's scrollable.loadedAll)
|
|
123
|
+
*/
|
|
124
|
+
private _loadedTop;
|
|
125
|
+
private _loadedBottom;
|
|
126
|
+
private _isLoading;
|
|
127
|
+
private _scrollHandler;
|
|
128
|
+
private _sliceDebounceTimer;
|
|
129
|
+
private _sliceDebounceDelay;
|
|
130
|
+
/** User interaction state for distinguishing user vs programmatic scrolls */
|
|
131
|
+
private _isUserInteracting;
|
|
132
|
+
private _interactionCleanup;
|
|
133
|
+
/** New callback options for skeleton placeholder support */
|
|
134
|
+
private _createPlaceholder?;
|
|
135
|
+
private _extractComponentState?;
|
|
136
|
+
private _injectComponentState?;
|
|
137
|
+
private _isItemStable?;
|
|
138
|
+
/** Height cache: itemId → last known height */
|
|
139
|
+
private _heightCache;
|
|
140
|
+
/** Component state cache: itemId → state object */
|
|
141
|
+
private _componentStateCache;
|
|
142
|
+
/** Element height tracker using ResizeObserver */
|
|
143
|
+
private _itemResizeObserver?;
|
|
144
|
+
/** Capacity limit for component state cache */
|
|
145
|
+
private readonly MAX_STATE_CACHE;
|
|
146
|
+
/** S5: Capacity limit for height cache (larger since entries are smaller) */
|
|
147
|
+
private readonly MAX_HEIGHT_CACHE;
|
|
148
|
+
/** Pending restoration queue */
|
|
149
|
+
private _pendingRestorations;
|
|
150
|
+
/** Whether a batch restoration is already scheduled */
|
|
151
|
+
private _restorationScheduled;
|
|
152
|
+
/** Last scroll top for direction detection */
|
|
153
|
+
private _lastScrollTop;
|
|
154
|
+
/** Maximum restorations per frame */
|
|
155
|
+
private readonly MAX_RESTORATIONS_PER_FRAME;
|
|
156
|
+
/** Visibility manager: tracks VISIBLE/HIDDEN/TRANSITIONING state */
|
|
157
|
+
private _visibilityManager;
|
|
158
|
+
/** Skeleton tracker: unified lifecycle management for placeholders */
|
|
159
|
+
private _skeletonTracker;
|
|
160
|
+
/** Minimum interval between _sliceViewport calls (ms) */
|
|
161
|
+
private readonly MIN_SLICE_INTERVAL;
|
|
162
|
+
/** Timestamp of last _sliceViewport call (prevents double invocation) */
|
|
163
|
+
private _lastSliceTime;
|
|
164
|
+
/** Active streaming item IDs - prevents skeletonization during streaming */
|
|
165
|
+
private _activeStreams;
|
|
166
|
+
/** ResizeObserver for scroll container - rebuilds placeholder positions on resize */
|
|
167
|
+
private _containerResizeObserver?;
|
|
168
|
+
/** Unsubscribe function for visibility manager state changes */
|
|
169
|
+
private _visibilityUnsubscribe?;
|
|
170
|
+
/** Cleanup for document visibilitychange listener */
|
|
171
|
+
private _documentVisibilityCleanup?;
|
|
172
|
+
/**
|
|
173
|
+
* Cold storage: historical messages that have been settled out of the hot window.
|
|
174
|
+
* Items are moved here when _items exceeds MAX_HOT_ITEMS.
|
|
175
|
+
* The repository serves as the authoritative external cache; we only track a
|
|
176
|
+
* settled counter for logging — no secondary buffer, to avoid memory leaks.
|
|
177
|
+
*/
|
|
178
|
+
private _settledCount;
|
|
179
|
+
/** Maximum items in hot storage before settling to cold */
|
|
180
|
+
private readonly MAX_HOT_ITEMS;
|
|
181
|
+
constructor(options: MessageVirtualScrollOptions<T>);
|
|
182
|
+
/**
|
|
183
|
+
* Declarative API: Set items and automatically apply optimal DOM operations.
|
|
184
|
+
*
|
|
185
|
+
* This is the main entry point for consumers. It internally diffs old vs new items
|
|
186
|
+
* and applies the minimal DOM operations:
|
|
187
|
+
* - Empty → items: Full render with scroll to bottom (initial load)
|
|
188
|
+
* - Items → empty: Clear all
|
|
189
|
+
* - Items changed: Detect prepend/append/update/middle-insert and apply optimal operations
|
|
190
|
+
*
|
|
191
|
+
* Scroll compensation is handled automatically via ScrollSaver.
|
|
192
|
+
*/
|
|
193
|
+
setItems(newItems: T[]): void;
|
|
194
|
+
/**
|
|
195
|
+
* Compute diff between old and new items.
|
|
196
|
+
* Detects: prepended (before old first), appended (after old last),
|
|
197
|
+
* middleInserted (between old first and last), removals, and content updates.
|
|
198
|
+
*/
|
|
199
|
+
private _computeDiff;
|
|
200
|
+
/**
|
|
201
|
+
* Prepend items to DOM without updating _items.
|
|
202
|
+
* Used internally by setItems.
|
|
203
|
+
*/
|
|
204
|
+
private _prependToDom;
|
|
205
|
+
/**
|
|
206
|
+
* Append items to DOM without updating _items.
|
|
207
|
+
* Used internally by setItems.
|
|
208
|
+
*/
|
|
209
|
+
private _appendToDom;
|
|
210
|
+
/**
|
|
211
|
+
* Shared logic for updating items in place.
|
|
212
|
+
* Used by both updateItems() and _updateInPlace().
|
|
213
|
+
*/
|
|
214
|
+
private _applyItemUpdates;
|
|
215
|
+
/**
|
|
216
|
+
* Update existing items in place.
|
|
217
|
+
* Only re-renders items that have changed and are currently in the DOM.
|
|
218
|
+
* Called internally by setItems() during incremental updates.
|
|
219
|
+
*/
|
|
220
|
+
private _updateInPlace;
|
|
221
|
+
/**
|
|
222
|
+
* Update items in place (e.g., when message status changes from 'syncing' to 'synced').
|
|
223
|
+
* Only re-renders items that have changed and are currently in the DOM.
|
|
224
|
+
* More efficient than setItems() which re-renders everything.
|
|
225
|
+
*
|
|
226
|
+
* Uses ID-based lookup + deep content comparison to avoid unnecessary DOM recreation.
|
|
227
|
+
* This is critical for preserving Markdown DOM when tab switching triggers reload()
|
|
228
|
+
* which returns new array references but identical content.
|
|
229
|
+
*/
|
|
230
|
+
updateItems(items: T[]): void;
|
|
231
|
+
/**
|
|
232
|
+
* Deep compare two items for equality.
|
|
233
|
+
* If getChangeableContent is provided, only compares the extracted content
|
|
234
|
+
* using shallow equality (own-property reference check) — avoids the cost
|
|
235
|
+
* and key-order fragility of JSON.stringify.
|
|
236
|
+
* Otherwise, falls back to JSON.stringify comparison.
|
|
237
|
+
*/
|
|
238
|
+
protected _itemsEqual(a: T, b: T): boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Shallow equality for plain objects: same own keys, same values (by reference).
|
|
241
|
+
* Falls back to JSON.stringify for non-object / null values.
|
|
242
|
+
*/
|
|
243
|
+
private _shallowEqual;
|
|
244
|
+
/**
|
|
245
|
+
* Mark that all messages in a direction have been loaded.
|
|
246
|
+
* Called by the consumer when repository has no more messages.
|
|
247
|
+
*/
|
|
248
|
+
setFullyLoaded(direction: 'top' | 'bottom', value: boolean): void;
|
|
249
|
+
/**
|
|
250
|
+
* Prepend items (older messages) with smooth scroll compensation.
|
|
251
|
+
* Uses Telegram's ScrollSaver algorithm.
|
|
252
|
+
*
|
|
253
|
+
* IMPORTANT: Only inserts new elements at the beginning, does NOT re-render
|
|
254
|
+
* all elements. This preserves DOM element references for ScrollSaver.
|
|
255
|
+
*/
|
|
256
|
+
prependItems(items: T[]): void;
|
|
257
|
+
/**
|
|
258
|
+
* Append items (newer messages) with smooth scroll compensation.
|
|
259
|
+
* Uses Telegram's ScrollSaver algorithm with reverse=false.
|
|
260
|
+
* Anchors to the LAST visible element's bottom position.
|
|
261
|
+
*/
|
|
262
|
+
appendItems(items: T[]): void;
|
|
263
|
+
/**
|
|
264
|
+
* Update a single item by ID.
|
|
265
|
+
* O(1) lookup using _idToIndex map.
|
|
266
|
+
*
|
|
267
|
+
* Phase 5: Correctly handles placeholder state:
|
|
268
|
+
* - Always updates data model
|
|
269
|
+
* - If placeholder and content changed, invalidates cached state
|
|
270
|
+
* - If not placeholder, updates DOM
|
|
271
|
+
*
|
|
272
|
+
* @param itemId - The ID of the item to update
|
|
273
|
+
* @param newItem - The new item data
|
|
274
|
+
* @returns true if the item was found and updated, false otherwise
|
|
275
|
+
*/
|
|
276
|
+
updateItemById(itemId: string, newItem: T): boolean;
|
|
277
|
+
clear(): void;
|
|
278
|
+
/**
|
|
279
|
+
* Get current visibility state.
|
|
280
|
+
* @deprecated Use visibilityManager.state instead
|
|
281
|
+
*/
|
|
282
|
+
isVisible(): boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Public API: Set visibility state.
|
|
285
|
+
* Called by parent component (rtc-message-list) when Tab visibility changes.
|
|
286
|
+
*
|
|
287
|
+
* This is the primary mechanism for the visibility state machine:
|
|
288
|
+
* - Tab switch → parent calls setVisibility(false/true)
|
|
289
|
+
* - Browser window blur/focus → parent calls setVisibility(false/true)
|
|
290
|
+
*
|
|
291
|
+
* The state machine ensures:
|
|
292
|
+
* - HIDDEN: pauses all skeletonize/restore operations
|
|
293
|
+
* - TRANSITIONING: gives browser one frame to stabilize layout
|
|
294
|
+
* - VISIBLE: synchronously restores visible skeletons before allowing interaction
|
|
295
|
+
*
|
|
296
|
+
* @param isVisible Whether the component is currently visible to the user
|
|
297
|
+
*/
|
|
298
|
+
setVisibility(isVisible: boolean): void;
|
|
299
|
+
/**
|
|
300
|
+
* Get the visibility manager (for advanced use cases).
|
|
301
|
+
*/
|
|
302
|
+
get visibilityManager(): VisibilityManager;
|
|
303
|
+
/**
|
|
304
|
+
* Mark an item as actively streaming.
|
|
305
|
+
* Prevents skeletonization during streaming output.
|
|
306
|
+
* Call this when WebSocket stream starts for a message.
|
|
307
|
+
*/
|
|
308
|
+
markStreamStart(itemId: string): void;
|
|
309
|
+
/**
|
|
310
|
+
* Mark an item's streaming as ended.
|
|
311
|
+
* Allows skeletonization after streaming completes.
|
|
312
|
+
* Call this when WebSocket stream ends for a message.
|
|
313
|
+
*/
|
|
314
|
+
markStreamEnd(itemId: string): void;
|
|
315
|
+
/**
|
|
316
|
+
* Check if an item is currently streaming.
|
|
317
|
+
*/
|
|
318
|
+
isStreaming(itemId: string): boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Check if an item is currently a skeleton placeholder.
|
|
321
|
+
* Used by scrollToMessage to determine if sync restoration is needed.
|
|
322
|
+
*/
|
|
323
|
+
isPlaceholder(itemId: string): boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Synchronously restore a skeleton placeholder to a real element.
|
|
326
|
+
* Used by scrollToMessage to ensure the target is visible before scrolling.
|
|
327
|
+
*
|
|
328
|
+
* Unlike batch restoration (which uses requestAnimationFrame), this runs
|
|
329
|
+
* synchronously so the caller can immediately scroll to the restored element.
|
|
330
|
+
*/
|
|
331
|
+
syncRestorePlaceholder(itemId: string): void;
|
|
332
|
+
scrollToBottom(): void;
|
|
333
|
+
/**
|
|
334
|
+
* Synchronously restore ALL skeleton placeholders.
|
|
335
|
+
*
|
|
336
|
+
* This stabilizes scrollHeight before programmatic scrolls (e.g., scrollToBottom),
|
|
337
|
+
* preventing the "scroll target drift" bug where smooth scroll targets a stale
|
|
338
|
+
* scrollHeight while skeletons are being restored mid-animation.
|
|
339
|
+
*
|
|
340
|
+
* Uses cumulative scroll adjustment to prevent compound drift when multiple
|
|
341
|
+
* skeletons are restored: captures viewport position once before any DOM mutations,
|
|
342
|
+
* then adjusts scrollTop by the total height difference of all elements restored
|
|
343
|
+
* above the viewport in a single operation.
|
|
344
|
+
*
|
|
345
|
+
* Call this BEFORE any scrollTo/scrollIntoView to ensure the scroll target is real.
|
|
346
|
+
*/
|
|
347
|
+
restoreAll(): void;
|
|
348
|
+
/**
|
|
349
|
+
* Setup user interaction tracking to distinguish user vs programmatic scrolls.
|
|
350
|
+
* Tracks pointer (mouse/touch) and keyboard interactions on the scroll container.
|
|
351
|
+
* This allows _onScroll to skip viewport slicing for programmatic scrolls (auto-scroll).
|
|
352
|
+
*/
|
|
353
|
+
private _setupInteractionTracking;
|
|
354
|
+
dispose(): void;
|
|
355
|
+
getStats(): {
|
|
356
|
+
totalItems: number;
|
|
357
|
+
renderedItems: number;
|
|
358
|
+
placeholderCount: number;
|
|
359
|
+
pendingRestorationCount: number;
|
|
360
|
+
visibilityState: VisibilityState;
|
|
361
|
+
loadedTop: boolean;
|
|
362
|
+
loadedBottom: boolean;
|
|
363
|
+
firstId: string | undefined;
|
|
364
|
+
lastId: string | undefined;
|
|
365
|
+
heightCacheSize: number;
|
|
366
|
+
stateCacheSize: number;
|
|
367
|
+
activeStreamCount: number;
|
|
368
|
+
isVisible: boolean;
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* Get current window boundary (like Telegram's getRenderedHistory).
|
|
372
|
+
*/
|
|
373
|
+
private _getWindowBoundary;
|
|
374
|
+
private _onScroll;
|
|
375
|
+
/**
|
|
376
|
+
* Phase 2: Find and schedule restoration for skeletons in the preload range.
|
|
377
|
+
* Uses fixed 2× viewport preload distance for simplicity.
|
|
378
|
+
*
|
|
379
|
+
* Visibility check: Uses visibility state machine to ensure restoration only
|
|
380
|
+
* happens when VISIBLE. This prevents the bug where restoration would fail
|
|
381
|
+
* silently when the component was hidden.
|
|
382
|
+
*
|
|
383
|
+
* Skeleton lookup: Uses SkeletonTracker.getInRange() which handles the
|
|
384
|
+
* "any part in range" check internally (including tall skeletons).
|
|
385
|
+
*
|
|
386
|
+
* Dedup: Uses SkeletonTracker's isPendingRestoration flag instead of a
|
|
387
|
+
* separate _pendingRestorationIds set, avoiding the "dedup deadlock" bug
|
|
388
|
+
* where failed restorations would never be retried.
|
|
389
|
+
*/
|
|
390
|
+
private _restoreSkeletonsInRange;
|
|
391
|
+
/**
|
|
392
|
+
* Detect scroll direction (up/down) based on last scroll position.
|
|
393
|
+
*/
|
|
394
|
+
private _getScrollDirection;
|
|
395
|
+
/**
|
|
396
|
+
* Schedule batch restoration with frame limit.
|
|
397
|
+
* Uses requestAnimationFrame for smooth rendering.
|
|
398
|
+
*
|
|
399
|
+
* Uses cumulative scroll adjustment: captures viewport position once before
|
|
400
|
+
* the batch, then adjusts scrollTop by the total height difference of all
|
|
401
|
+
* elements restored above the viewport in a single operation.
|
|
402
|
+
*
|
|
403
|
+
* Visibility check: Uses visibility state machine. If not VISIBLE, the batch
|
|
404
|
+
* is cancelled and pending items are unmarked so they can be retried later.
|
|
405
|
+
* This fixes the "dedup deadlock" bug where pending IDs would prevent retry.
|
|
406
|
+
*/
|
|
407
|
+
private _scheduleBatchRestoration;
|
|
408
|
+
/**
|
|
409
|
+
* Classify elements into invisibleTop, visible, invisibleBottom.
|
|
410
|
+
* Mirrors Telegram's getViewportSlice (helpers/dom/getViewportSlice.ts).
|
|
411
|
+
*/
|
|
412
|
+
private _getViewportSlice;
|
|
413
|
+
/**
|
|
414
|
+
* Check if the scroll container is currently visible.
|
|
415
|
+
* Uses the visibility state machine as the single source of truth.
|
|
416
|
+
*
|
|
417
|
+
* The visibility state machine (VisibilityManager) tracks:
|
|
418
|
+
* - VISIBLE: component is visible and interactive
|
|
419
|
+
* - HIDDEN: component is not visible (Tab switch or browser window blur)
|
|
420
|
+
* - TRANSITIONING: component is transitioning from hidden to visible
|
|
421
|
+
*
|
|
422
|
+
* This replaces the previous ad-hoc checks that couldn't detect
|
|
423
|
+
* visibility: hidden CSS (which preserves layout dimensions).
|
|
424
|
+
*/
|
|
425
|
+
private _isContainerVisible;
|
|
426
|
+
/**
|
|
427
|
+
* Handle visibility state machine transitions.
|
|
428
|
+
* Called by VisibilityManager when state changes.
|
|
429
|
+
*
|
|
430
|
+
* State transitions:
|
|
431
|
+
* - VISIBLE → HIDDEN: Pause all operations, cancel pending timers
|
|
432
|
+
* - HIDDEN → TRANSITIONING: Prepare for restore (wait one frame for layout)
|
|
433
|
+
* - TRANSITIONING → VISIBLE: Rebuild skeleton positions, restore visible skeletons
|
|
434
|
+
*/
|
|
435
|
+
private _onVisibilityStateChange;
|
|
436
|
+
/**
|
|
437
|
+
* Pause all virtual scroll operations when becoming hidden.
|
|
438
|
+
*
|
|
439
|
+
* This is the key mechanism that prevents the bug:
|
|
440
|
+
* - When Tab is hidden (visibility: hidden) or browser window loses focus,
|
|
441
|
+
* all skeletonize/restore operations are paused
|
|
442
|
+
* - No new skeletons are created while hidden
|
|
443
|
+
* - Pending restoration timers are cancelled
|
|
444
|
+
* - When becoming visible again, state is rebuilt synchronously
|
|
445
|
+
*/
|
|
446
|
+
private _pauseOperations;
|
|
447
|
+
/**
|
|
448
|
+
* Restore state when becoming visible again.
|
|
449
|
+
*
|
|
450
|
+
* This runs synchronously when the state machine transitions to VISIBLE:
|
|
451
|
+
* 1. Rebuild skeleton Y positions (layout may have changed while hidden)
|
|
452
|
+
* 2. Synchronously restore all skeletons in the current viewport
|
|
453
|
+
* 3. Allow subsequent operations
|
|
454
|
+
*
|
|
455
|
+
* This fixes the "stale Y coordinates" bug:
|
|
456
|
+
* - While hidden, layout may change (new messages, container resize)
|
|
457
|
+
* - Old Y coordinates become stale
|
|
458
|
+
* - By rebuilding positions synchronously on restore, we ensure accuracy
|
|
459
|
+
*/
|
|
460
|
+
private _restoreState;
|
|
461
|
+
/**
|
|
462
|
+
* Synchronously restore all skeletons in the current viewport.
|
|
463
|
+
*
|
|
464
|
+
* Called when transitioning from hidden to visible.
|
|
465
|
+
* Unlike _restoreSkeletonsInRange (which uses rAF), this runs synchronously
|
|
466
|
+
* to ensure all visible skeletons are restored before user can interact.
|
|
467
|
+
*/
|
|
468
|
+
private _restoreVisibleSkeletons;
|
|
469
|
+
/**
|
|
470
|
+
* Slice viewport: replace off-screen messages with skeleton placeholders.
|
|
471
|
+
*
|
|
472
|
+
* Phase 1: Instead of destroying elements, we replace them with skeleton
|
|
473
|
+
* placeholders that maintain the scroll height. This provides visual continuity
|
|
474
|
+
* and prevents scroll position jumps.
|
|
475
|
+
*
|
|
476
|
+
* Visibility check: Uses the visibility state machine (shouldPerformOperations)
|
|
477
|
+
* to ensure slicing only happens when the component is VISIBLE. This prevents
|
|
478
|
+
* the bug where background tabs (visibility: hidden) would have skeletons
|
|
479
|
+
* created but never restored.
|
|
480
|
+
*
|
|
481
|
+
* I3: Also checks _lastSliceTime to prevent double invocation.
|
|
482
|
+
*/
|
|
483
|
+
private _sliceViewport;
|
|
484
|
+
/**
|
|
485
|
+
* Replace real element with skeleton placeholder.
|
|
486
|
+
*
|
|
487
|
+
* This is the core of Phase 1: instead of destroying off-screen elements,
|
|
488
|
+
* we replace them with skeleton placeholders that maintain the scroll height.
|
|
489
|
+
*
|
|
490
|
+
* Steps:
|
|
491
|
+
* 1. Extract component state (if supported)
|
|
492
|
+
* 2. Cache the element height
|
|
493
|
+
* 3. Create skeleton placeholder
|
|
494
|
+
* 4. Replace DOM element
|
|
495
|
+
* 5. Track placeholder via SkeletonTracker (unified lifecycle management)
|
|
496
|
+
* 6. Stop tracking height for this element (skeleton height is fixed)
|
|
497
|
+
*/
|
|
498
|
+
private _replaceWithSkeleton;
|
|
499
|
+
/**
|
|
500
|
+
* Phase 2: Restore a skeleton placeholder to a real element.
|
|
501
|
+
*
|
|
502
|
+
* This is the inverse of _replaceWithSkeleton:
|
|
503
|
+
* 1. Render the real element from item data
|
|
504
|
+
* 2. Inject cached state synchronously (before first render to avoid flicker)
|
|
505
|
+
* 3. Replace skeleton with real element in DOM
|
|
506
|
+
* 4. Start tracking height for the new element
|
|
507
|
+
* 5. Adjust scroll position if needed (for elements above viewport)
|
|
508
|
+
*
|
|
509
|
+
* @param itemId - Stable ID of the item (immune to index shifts from prepend/append)
|
|
510
|
+
* @param _index - Index at scheduling time (unused; resolved via _idToIndex for correctness)
|
|
511
|
+
* @param skeletonHeight - Height of the skeleton placeholder (for scroll adjustment)
|
|
512
|
+
*/
|
|
513
|
+
private _restoreSkeleton;
|
|
514
|
+
/**
|
|
515
|
+
* Internal skeleton restoration without scroll adjustment.
|
|
516
|
+
* Returns height diff info for batch scroll adjustment.
|
|
517
|
+
*
|
|
518
|
+
* @param itemId - Stable ID of the item
|
|
519
|
+
* @param skeletonHeight - Height of the skeleton placeholder
|
|
520
|
+
* @returns Restoration result or null if skipped
|
|
521
|
+
*/
|
|
522
|
+
private _restoreSkeletonInternal;
|
|
523
|
+
/**
|
|
524
|
+
* Create default skeleton using MessageSkeletonGenerator.
|
|
525
|
+
* Called when createPlaceholder callback is not provided.
|
|
526
|
+
*/
|
|
527
|
+
private _createDefaultSkeleton;
|
|
528
|
+
/**
|
|
529
|
+
* Determine skeleton type based on item content.
|
|
530
|
+
* Uses type guard for safe property access on generic T.
|
|
531
|
+
*
|
|
532
|
+
* NOTE: This is a fallback method. In production, `createPlaceholder` callback
|
|
533
|
+
* is always provided by the consumer (rtc-message-list.ts), which uses
|
|
534
|
+
* MessageSkeletonGenerator.create() with full type information.
|
|
535
|
+
* This method is only used if createPlaceholder is not provided.
|
|
536
|
+
*/
|
|
537
|
+
private _getSkeletonType;
|
|
538
|
+
/**
|
|
539
|
+
* Cache component state with capacity limit.
|
|
540
|
+
* When cache exceeds MAX_STATE_CACHE, removes oldest half.
|
|
541
|
+
* Uses Map iterator for O(1) key access without allocation.
|
|
542
|
+
*/
|
|
543
|
+
private _cacheComponentState;
|
|
544
|
+
/**
|
|
545
|
+
* S5: Set height cache with capacity limit.
|
|
546
|
+
* When cache exceeds MAX_HEIGHT_CACHE, removes oldest half.
|
|
547
|
+
* Uses Map iterator for O(1) key access without allocation.
|
|
548
|
+
*/
|
|
549
|
+
private _setHeightCache;
|
|
550
|
+
/**
|
|
551
|
+
* Check if an item is stable (safe to virtualize).
|
|
552
|
+
* Unstable items should not be replaced with skeletons.
|
|
553
|
+
*/
|
|
554
|
+
private _checkItemStable;
|
|
555
|
+
/**
|
|
556
|
+
* S3: Find element by itemId using O(1) map lookup.
|
|
557
|
+
* Falls back to DOM query only if not found in maps.
|
|
558
|
+
* Used for placeholder restoration and scroll-to-message.
|
|
559
|
+
*/
|
|
560
|
+
protected _findElementByItemId(itemId: string): HTMLElement | null;
|
|
561
|
+
/**
|
|
562
|
+
* Find item index by itemId using _idToIndex map - O(1).
|
|
563
|
+
*/
|
|
564
|
+
protected _findIndexByItemId(itemId: string): number;
|
|
565
|
+
/**
|
|
566
|
+
* Handle scroll container resize (e.g., window resize).
|
|
567
|
+
* Rebuilds all skeleton Y positions via SkeletonTracker since cached coordinates become stale.
|
|
568
|
+
*
|
|
569
|
+
* Note: Only rebuilds positions when VISIBLE. When hidden, positions will be rebuilt
|
|
570
|
+
* by _restoreState() when transitioning back to visible.
|
|
571
|
+
*/
|
|
572
|
+
private _onContainerResize;
|
|
573
|
+
/**
|
|
574
|
+
* Settle excess hot items to cold storage.
|
|
575
|
+
* Called after items are added to prevent unbounded memory growth.
|
|
576
|
+
*
|
|
577
|
+
* When _items exceeds MAX_HOT_ITEMS, the oldest items are evicted and a
|
|
578
|
+
* settled counter is incremented for logging.
|
|
579
|
+
* This keeps the hot window small for fast iteration while relying on the
|
|
580
|
+
* repository as the authoritative cache for older history.
|
|
581
|
+
*
|
|
582
|
+
* IMPORTANT: After splicing _items, this method also synchronizes all index
|
|
583
|
+
* structures (_idToIndex, _elementMap, dataset.messageIndex) and removes
|
|
584
|
+
* orphaned DOM elements to prevent index drift.
|
|
585
|
+
*/
|
|
586
|
+
private _settleData;
|
|
587
|
+
private _renderAll;
|
|
588
|
+
/**
|
|
589
|
+
* Rebuild the ID-to-index mapping from current _items array.
|
|
590
|
+
* Called after operations that change item indices (prepend, slice, etc.)
|
|
591
|
+
*/
|
|
592
|
+
private _rebuildIdToIndex;
|
|
593
|
+
private _renderNewItems;
|
|
594
|
+
}
|
|
595
|
+
//# sourceMappingURL=message-virtual-scroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-virtual-scroll.d.ts","sourceRoot":"","sources":["../../src/utils/message-virtual-scroll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EAAC,iBAAiB,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAK3E;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,cAAc;IAC3B,6DAA6D;IAC7D,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,2BAA2B,CAAC,CAAC;IAC1C,eAAe,EAAE,WAAW,CAAC;IAC7B,cAAc,EAAE,WAAW,CAAC;IAC5B,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,WAAW,CAAC;IACpD,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAE/B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,KAA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O,CAAC,gBAAgB;IAyBxB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,aAAa;IAmBrB;;;;;;OAMG;IACH,OAAO,CAAC,wBAAwB;IA4ChC;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,cAAc;IAqFtB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,oBAAoB;IAqD5B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,gBAAgB;IA0BxB;;;;;;;OAOG;IACH,OAAO,CAAC,wBAAwB;IAiEhC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAW9B;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAqBxB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAiB5B;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAiBvB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAiBxB;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAalE;;OAEG;IACH,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAMpD;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,WAAW;IAyCnB,OAAO,CAAC,UAAU;IA8BlB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,eAAe;CAiB1B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relative time formatting utilities
|
|
3
|
+
*
|
|
4
|
+
* Uses native Intl.RelativeTimeFormat, no third-party library needed.
|
|
5
|
+
* Supports Chinese and English, automatically selects the best unit (seconds/minutes/hours/days/weeks/months/years).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Format a timestamp as relative time
|
|
9
|
+
* @param timestamp Millisecond timestamp
|
|
10
|
+
* @param locale Locale, defaults to Chinese
|
|
11
|
+
* @returns Relative time string, e.g. "3 minutes ago", "2 hours ago", "5 days ago"
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatRelativeTime(timestamp: number, locale?: 'zh-CN' | 'en-US'): string;
|
|
14
|
+
//# sourceMappingURL=relative-time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relative-time.d.ts","sourceRoot":"","sources":["../../src/utils/relative-time.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAC9B,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,OAAO,GAAG,OAAiB,GACpC,MAAM,CAYR"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScrollSaver - Preserves scroll position across DOM changes.
|
|
3
|
+
* Directly ported from Telegram Web's ScrollSaver.
|
|
4
|
+
*
|
|
5
|
+
* Key concept:
|
|
6
|
+
* 1. save(): Record visible elements and their positions
|
|
7
|
+
* 2. DOM changes (prepend/append/delete)
|
|
8
|
+
* 3. restore(): Find anchor element, calculate position delta, adjust scrollTop
|
|
9
|
+
*/
|
|
10
|
+
export declare class ScrollSaver {
|
|
11
|
+
private _container;
|
|
12
|
+
private _query;
|
|
13
|
+
private _reverse;
|
|
14
|
+
private _scrollTop;
|
|
15
|
+
private _scrollHeight;
|
|
16
|
+
private _elements;
|
|
17
|
+
constructor(container: HTMLElement, query?: string, reverse?: boolean);
|
|
18
|
+
/**
|
|
19
|
+
* Save current scroll state and visible elements.
|
|
20
|
+
*/
|
|
21
|
+
save(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Restore scroll position after DOM changes.
|
|
24
|
+
*
|
|
25
|
+
* Fallback chain (matching Telegram Web's algorithm):
|
|
26
|
+
* 1. Try the saved anchor element
|
|
27
|
+
* 2. If anchor disconnected → re-query visible elements, pick new anchor
|
|
28
|
+
* 3. If still no anchor → fall back to scrollHeight delta
|
|
29
|
+
*/
|
|
30
|
+
restore(): void;
|
|
31
|
+
private _findElements;
|
|
32
|
+
private _getAnchor;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=scroll-saver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-saver.d.ts","sourceRoot":"","sources":["../../src/utils/scroll-saver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,qBAAa,WAAW;IACpB,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,SAAS,CAA+C;gBAEpD,SAAS,EAAE,WAAW,EAAE,KAAK,GAAE,MAAmB,EAAE,OAAO,GAAE,OAAc;IAMvF;;OAEG;IACH,IAAI;IAMJ;;;;;;;OAOG;IACH,OAAO;IA+DP,OAAO,CAAC,aAAa;IA0BrB,OAAO,CAAC,UAAU;CAKrB"}
|