zulip/static/js/bundles/app.js

231 lines
6.7 KiB
JavaScript
Raw Normal View History

import "./common.js";
// Import Third party libraries
import "../../third/bootstrap-notify/js/bootstrap-notify.js";
import "../../third/bootstrap-typeahead/typeahead.js";
import "jquery-caret-plugin/src/jquery.caret.js";
import "../../third/jquery-idle/jquery.idle.js";
import "spectrum-colorpicker";
import "../../third/marked/lib/marked.js";
import "xdate/src/xdate.js";
import "jquery-validation/dist/jquery.validate.js";
import "blueimp-md5/js/md5.js";
import "clipboard/dist/clipboard.js";
import "winchan/winchan.js";
import "handlebars/dist/cjs/handlebars.runtime.js";
import "flatpickr/dist/flatpickr.js";
import "flatpickr/dist/plugins/confirmDate/confirmDate.js";
import "sortablejs/Sortable.js";
// Import App JS
import "../translations.js";
import "../feature_flags.js";
import "../loading.js";
import "../schema.js";
pm_list: Simplify redraws for Private Messages. We now use vdom-ish techniques to track the list items for the pm list. When we go to update the list, we only re-render nodes whose data has changed, with two exceptions: - Obviously, the first time we do a full render. - If the keys for the items have changed (i.e. a new node has come in or the order has changed), we just re-render the whole list. If the keys are the same since the last re-render, we only re-render individual items if their data has changed. Most of the new code is in these two modules: - pm_list_dom.js - vdom.js We remove all of the code in pm_list.js that is related to updating DOM with unread counts. For presence updates, we are now *never* re-rendering the whole list, since presence updates only change individual line items and don't affect the keys. Instead, we just update any changed elements in place. The main thing that makes this all work is the `update` method in `vdom`, which is totally generic and essentially does a few simple jobs: - detect if keys are different - just render the whole ul as needed - for items that change, do the appropriate jQuery to update the item in place Note that this code seems to play nice with simplebar. Also, this code continues to use templates to render the individual list items. FWIW this code isn't radically different than list_render, but it's got some key differences: - There are fewer bells and whistles in this code. Some of the stuff that list_render does is overkill for the PM list. - This code detects data changes. Note that the vdom scheme is agnostic about templates; it simply requires the child nodes to provide a render method. (This is similar to list_render, which is also technically agnostic about rendering, but which also does use templates in most cases.) These fixes are somewhat related to #13605, but we haven't gotten a solid repro on that issue, and the scrolling issues there may be orthogonal to the redraws. But having fewer moving parts here should help, and we won't get the rug pulled out from under us on every presence update. There are two possible extensions to this that are somewhat overlapping in nature, but can be done one a time. * We can do a deeper vdom approach here that gets us away from templates, and just have nodes write to an AST. I have this on another branch, but it might be overkill. * We can avoid some redraws by detecting where keys are moving up and down. I'm not completely sure we need it for the PM list. If this gets merged, we may want to try similar things for the stream list, which also does a fairly complicated mixture of big-hammer re-renders and surgical updates-in-place (with custom code). BTW we have 100% line coverage for vdom.js.
2020-01-04 17:17:44 +01:00
import "../vdom.js";
import "../search_util.js";
import "../keydown_util.js";
import "../lightbox_canvas.js";
import "../rtl.js";
import "../lazy_set.js";
import "../fold_dict.ts";
import "../scroll_util.js";
import "../components.js";
import "../feedback_widget.js";
import "../localstorage.js";
import "../drafts.js";
import "../input_pill.js";
import "../user_pill.js";
import "../compose_pm_pill.js";
import "../channel.js";
import "../setup.js";
import "../unread_ui.js";
import "../unread_ops.js";
import "../muting.js";
import "../muting_ui.js";
import "../message_viewport.js";
import "../rows.js";
import "../people.js";
import "../user_groups.js";
import "../unread.js";
import "../topic_list_data.js";
import "../topic_list.js";
pm_list: Simplify redraws for Private Messages. We now use vdom-ish techniques to track the list items for the pm list. When we go to update the list, we only re-render nodes whose data has changed, with two exceptions: - Obviously, the first time we do a full render. - If the keys for the items have changed (i.e. a new node has come in or the order has changed), we just re-render the whole list. If the keys are the same since the last re-render, we only re-render individual items if their data has changed. Most of the new code is in these two modules: - pm_list_dom.js - vdom.js We remove all of the code in pm_list.js that is related to updating DOM with unread counts. For presence updates, we are now *never* re-rendering the whole list, since presence updates only change individual line items and don't affect the keys. Instead, we just update any changed elements in place. The main thing that makes this all work is the `update` method in `vdom`, which is totally generic and essentially does a few simple jobs: - detect if keys are different - just render the whole ul as needed - for items that change, do the appropriate jQuery to update the item in place Note that this code seems to play nice with simplebar. Also, this code continues to use templates to render the individual list items. FWIW this code isn't radically different than list_render, but it's got some key differences: - There are fewer bells and whistles in this code. Some of the stuff that list_render does is overkill for the PM list. - This code detects data changes. Note that the vdom scheme is agnostic about templates; it simply requires the child nodes to provide a render method. (This is similar to list_render, which is also technically agnostic about rendering, but which also does use templates in most cases.) These fixes are somewhat related to #13605, but we haven't gotten a solid repro on that issue, and the scrolling issues there may be orthogonal to the redraws. But having fewer moving parts here should help, and we won't get the rug pulled out from under us on every presence update. There are two possible extensions to this that are somewhat overlapping in nature, but can be done one a time. * We can do a deeper vdom approach here that gets us away from templates, and just have nodes write to an AST. I have this on another branch, but it might be overkill. * We can avoid some redraws by detecting where keys are moving up and down. I'm not completely sure we need it for the PM list. If this gets merged, we may want to try similar things for the stream list, which also does a fairly complicated mixture of big-hammer re-renders and surgical updates-in-place (with custom code). BTW we have 100% line coverage for vdom.js.
2020-01-04 17:17:44 +01:00
import "../pm_list_dom.js";
import "../pm_list.js";
import "../pm_conversations.js";
import "../recent_senders.js";
import "../stream_sort.js";
import "../topic_generator.js";
import "../top_left_corner.js";
import "../stream_list.js";
import "../topic_zoom.js";
import "../filter.js";
import "../poll_widget.js";
import "../todo_widget.js";
import "../tictactoe_widget.js";
import "../zform.js";
import "../widgetize.js";
import "../submessage.js";
import "../fetch_status.js";
import "../message_list_data.js";
import "../message_list_view.js";
import "../message_list.js";
import "../message_live_update.js";
import "../narrow_state.js";
import "../narrow.js";
import "../reload_state.js";
import "../reload.js";
import "../compose_fade.js";
import "../fenced_code.js";
import "../markdown.js";
import "../local_message.js";
import "../echo.js";
import "../sent_messages.js";
import "../compose_state.js";
import "../compose_actions.js";
import "../transmit.js";
import "../zcommand.js";
import "../compose.js";
import "../upload.js";
import "../color_data.js";
import "../stream_color.js";
import "../stream_data.js";
import "../topic_data.js";
import "../stream_muting.js";
import "../stream_events.js";
import "../stream_create.js";
import "../stream_edit.js";
import "../subs.js";
import "../message_edit.js";
import "../condense.js";
import "../resize.js";
import "../list_render.js";
import "../floating_recipient_bar.js";
import "../lightbox.js";
import "../ui_report.js";
import "../message_scroll.js";
import "../info_overlay.js";
import "../ui.js";
import "../night_mode.js";
import "../ui_util.js";
import "../pointer.js";
import "../click_handlers.js";
import "../settings_panel_menu.js";
import "../settings_toggle.js";
import "../scroll_bar.js";
import "../gear_menu.js";
import "../copy_and_paste.js";
import "../stream_popover.js";
import "../popovers.js";
import "../overlays.js";
import "../typeahead_helper.js";
import "../search_suggestion.js";
import "../search.js";
import "../composebox_typeahead.js";
import "../navigate.js";
import "../list_util.js";
import "../hotkey.js";
import "../favicon.js";
import "../notifications.js";
import "../hash_util.js";
import "../hashchange.js";
import "../invite.js";
import "../message_flags.js";
import "../starred_messages.js";
import "../alert_words.js";
import "../alert_words_ui.js";
import "../attachments_ui.js";
import "../message_store.js";
import "../message_util.js";
import "../message_events.js";
import "../message_fetch.js";
import "../server_events.js";
import "../server_events_dispatch.js";
import "../zulip.js";
import "../presence.js";
import "../user_search.js";
import "../user_status.js";
import "../user_status_ui.js";
import "../buddy_data.js";
import "../padded_widget.js";
import "../buddy_list.js";
import "../list_cursor.js";
import "../activity.js";
import "../user_events.js";
import "../colorspace.js";
import "../timerender.js";
import "../tutorial.js";
import "../hotspots.js";
import "../templates.js";
import "../upload_widget.js";
import "../avatar.js";
import "../realm_icon.js";
import "../realm_logo.js";
import "../reminder.js";
import "../confirm_dialog.js";
import "../settings_account.js";
import "../settings_display.js";
import "../settings_notifications.js";
import "../settings_bots.js";
import "../settings_muting.js";
import "../settings_sections.js";
import "../settings_emoji.js";
import "../settings_exports.js";
import "../settings_org.js";
import "../settings_users.js";
import "../settings_streams.js";
import "../settings_linkifiers.js";
import "../settings_invites.js";
import "../settings_user_groups.js";
import "../settings_profile_fields.js";
import "../settings.js";
import "../admin.js";
import "../tab_bar.js";
import "../emoji.js";
import "../bot_data.js";
import "../reactions.js";
import "../typing.js";
import "../typing_data.js";
import "../typing_events.js";
import "../ui_init.js";
import "../emoji_picker.js";
import "../compose_ui.js";
import "../panels.js";
import "../settings_ui.js";
import "../search_pill.js";
import "../search_pill_widget.js";
import "../stream_ui_updates.js";
// Import Styles
import "../../third/bootstrap-notify/css/bootstrap-notify.css";
import "spectrum-colorpicker/spectrum.css";
import "katex/dist/katex.css";
import "flatpickr/dist/flatpickr.css";
import "flatpickr/dist/plugins/confirmDate/confirmDate.css";
import "../../styles/components.scss";
import "../../styles/app_components.scss";
import "../../styles/rendered_markdown.scss";
import "../../styles/zulip.scss";
import "../../styles/alerts.scss";
import "../../styles/settings.scss";
import "../../styles/subscriptions.scss";
import "../../styles/drafts.scss";
import "../../styles/input_pill.scss";
import "../../styles/informational-overlays.scss";
import "../../styles/compose.scss";
import "../../styles/reactions.scss";
import "../../styles/user_circles.scss";
import "../../styles/left-sidebar.scss";
import "../../styles/right-sidebar.scss";
import "../../styles/lightbox.scss";
import "../../styles/popovers.scss";
import "../../styles/typing_notifications.scss";
import "../../styles/hotspots.scss";
import "../../styles/night_mode.scss";
import "../../styles/user_status.scss";
import "../../styles/widgets.scss";
// This should be last.
import "../ready.js";