mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
theme: Rename dark_theme.ts -> theme.ts.
The dark_theme module now contains logic for light, dark, and automatic theme switching. Thus, we rename it a more generic name, `theme.ts`.
This commit is contained in:
@@ -91,7 +91,6 @@ EXEMPT_FILES = make_set(
|
|||||||
"web/src/css_variables.d.ts",
|
"web/src/css_variables.d.ts",
|
||||||
"web/src/css_variables.js",
|
"web/src/css_variables.js",
|
||||||
"web/src/custom_profile_fields_ui.ts",
|
"web/src/custom_profile_fields_ui.ts",
|
||||||
"web/src/dark_theme.ts",
|
|
||||||
"web/src/debug.ts",
|
"web/src/debug.ts",
|
||||||
"web/src/demo_organizations_ui.js",
|
"web/src/demo_organizations_ui.js",
|
||||||
"web/src/deprecated_feature_notice.ts",
|
"web/src/deprecated_feature_notice.ts",
|
||||||
@@ -248,6 +247,7 @@ EXEMPT_FILES = make_set(
|
|||||||
"web/src/stream_ui_updates.js",
|
"web/src/stream_ui_updates.js",
|
||||||
"web/src/submessage.ts",
|
"web/src/submessage.ts",
|
||||||
"web/src/subscriber_api.ts",
|
"web/src/subscriber_api.ts",
|
||||||
|
"web/src/theme.ts",
|
||||||
"web/src/timerender.ts",
|
"web/src/timerender.ts",
|
||||||
"web/src/tippyjs.ts",
|
"web/src/tippyjs.ts",
|
||||||
"web/src/todo_widget.js",
|
"web/src/todo_widget.js",
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import render_navbar_gear_menu_popover from "../templates/popovers/navbar/navbar
|
|||||||
|
|
||||||
import * as blueslip from "./blueslip";
|
import * as blueslip from "./blueslip";
|
||||||
import * as channel from "./channel";
|
import * as channel from "./channel";
|
||||||
import * as dark_theme from "./dark_theme";
|
|
||||||
import * as popover_menus from "./popover_menus";
|
import * as popover_menus from "./popover_menus";
|
||||||
import * as popover_menus_data from "./popover_menus_data";
|
import * as popover_menus_data from "./popover_menus_data";
|
||||||
import * as popovers from "./popovers";
|
import * as popovers from "./popovers";
|
||||||
import * as settings_preferences from "./settings_preferences";
|
import * as settings_preferences from "./settings_preferences";
|
||||||
|
import * as theme from "./theme";
|
||||||
import {parse_html} from "./ui_util";
|
import {parse_html} from "./ui_util";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -159,7 +159,7 @@ export function initialize() {
|
|||||||
$popper.on("change", "input[name='theme-select']", (e) => {
|
$popper.on("change", "input[name='theme-select']", (e) => {
|
||||||
const theme_code = Number.parseInt($(e.currentTarget).attr("data-theme-code"), 10);
|
const theme_code = Number.parseInt($(e.currentTarget).attr("data-theme-code"), 10);
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
dark_theme.set_theme_for_spectator(theme_code);
|
theme.set_theme_for_spectator(theme_code);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import * as compose_call_ui from "./compose_call_ui";
|
|||||||
import * as compose_pm_pill from "./compose_pm_pill";
|
import * as compose_pm_pill from "./compose_pm_pill";
|
||||||
import * as compose_recipient from "./compose_recipient";
|
import * as compose_recipient from "./compose_recipient";
|
||||||
import * as compose_state from "./compose_state";
|
import * as compose_state from "./compose_state";
|
||||||
import * as dark_theme from "./dark_theme";
|
|
||||||
import * as emoji from "./emoji";
|
import * as emoji from "./emoji";
|
||||||
import * as emoji_picker from "./emoji_picker";
|
import * as emoji_picker from "./emoji_picker";
|
||||||
import * as gear_menu from "./gear_menu";
|
import * as gear_menu from "./gear_menu";
|
||||||
@@ -77,6 +76,7 @@ import * as stream_topic_history from "./stream_topic_history";
|
|||||||
import * as stream_ui_updates from "./stream_ui_updates";
|
import * as stream_ui_updates from "./stream_ui_updates";
|
||||||
import * as sub_store from "./sub_store";
|
import * as sub_store from "./sub_store";
|
||||||
import * as submessage from "./submessage";
|
import * as submessage from "./submessage";
|
||||||
|
import * as theme from "./theme";
|
||||||
import * as typing_events from "./typing_events";
|
import * as typing_events from "./typing_events";
|
||||||
import * as unread_ops from "./unread_ops";
|
import * as unread_ops from "./unread_ops";
|
||||||
import * as unread_ui from "./unread_ui";
|
import * as unread_ui from "./unread_ui";
|
||||||
@@ -791,7 +791,7 @@ export function dispatch_normal_event(event) {
|
|||||||
}
|
}
|
||||||
if (event.property === "color_scheme") {
|
if (event.property === "color_scheme") {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
dark_theme.set_theme_and_update(event.value);
|
theme.set_theme_and_update(event.value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (event.property === "starred_message_counts") {
|
if (event.property === "starred_message_counts") {
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import * as compose_tooltips from "./compose_tooltips";
|
|||||||
import * as composebox_typeahead from "./composebox_typeahead";
|
import * as composebox_typeahead from "./composebox_typeahead";
|
||||||
import * as condense from "./condense";
|
import * as condense from "./condense";
|
||||||
import * as copy_and_paste from "./copy_and_paste";
|
import * as copy_and_paste from "./copy_and_paste";
|
||||||
import * as dark_theme from "./dark_theme";
|
|
||||||
import * as desktop_integration from "./desktop_integration";
|
import * as desktop_integration from "./desktop_integration";
|
||||||
import * as desktop_notifications from "./desktop_notifications";
|
import * as desktop_notifications from "./desktop_notifications";
|
||||||
import * as drafts from "./drafts";
|
import * as drafts from "./drafts";
|
||||||
@@ -126,6 +125,7 @@ import * as stream_settings_ui from "./stream_settings_ui";
|
|||||||
import * as stream_topic_history from "./stream_topic_history";
|
import * as stream_topic_history from "./stream_topic_history";
|
||||||
import * as stream_topic_history_util from "./stream_topic_history_util";
|
import * as stream_topic_history_util from "./stream_topic_history_util";
|
||||||
import * as sub_store from "./sub_store";
|
import * as sub_store from "./sub_store";
|
||||||
|
import * as theme from "./theme";
|
||||||
import * as timerender from "./timerender";
|
import * as timerender from "./timerender";
|
||||||
import * as tippyjs from "./tippyjs";
|
import * as tippyjs from "./tippyjs";
|
||||||
import * as topic_list from "./topic_list";
|
import * as topic_list from "./topic_list";
|
||||||
@@ -422,7 +422,7 @@ export function initialize_everything(state_data) {
|
|||||||
sidebar_ui.restore_sidebar_toggle_status();
|
sidebar_ui.restore_sidebar_toggle_status();
|
||||||
information_density.initialize();
|
information_density.initialize();
|
||||||
if (page_params.is_spectator) {
|
if (page_params.is_spectator) {
|
||||||
dark_theme.initialize_theme_for_spectator();
|
theme.initialize_theme_for_spectator();
|
||||||
}
|
}
|
||||||
|
|
||||||
i18n.initialize({language_list: page_params.language_list});
|
i18n.initialize({language_list: page_params.language_list});
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import {z} from "zod";
|
|||||||
|
|
||||||
import * as channel from "./channel";
|
import * as channel from "./channel";
|
||||||
import * as compose_banner from "./compose_banner";
|
import * as compose_banner from "./compose_banner";
|
||||||
import * as dark_theme from "./dark_theme";
|
|
||||||
import * as feedback_widget from "./feedback_widget";
|
import * as feedback_widget from "./feedback_widget";
|
||||||
import {$t} from "./i18n";
|
import {$t} from "./i18n";
|
||||||
import * as markdown from "./markdown";
|
import * as markdown from "./markdown";
|
||||||
import * as settings_config from "./settings_config";
|
import * as settings_config from "./settings_config";
|
||||||
|
import * as theme from "./theme";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ export function switch_to_light_theme(): void {
|
|||||||
on_success(raw_data) {
|
on_success(raw_data) {
|
||||||
const data = data_schema.parse(raw_data);
|
const data = data_schema.parse(raw_data);
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
dark_theme.set_theme_and_update(settings_config.color_scheme_values.day.code);
|
theme.set_theme_and_update(settings_config.color_scheme_values.day.code);
|
||||||
});
|
});
|
||||||
feedback_widget.show({
|
feedback_widget.show({
|
||||||
populate($container) {
|
populate($container) {
|
||||||
@@ -93,7 +93,7 @@ export function switch_to_dark_theme(): void {
|
|||||||
on_success(raw_data) {
|
on_success(raw_data) {
|
||||||
const data = data_schema.parse(raw_data);
|
const data = data_schema.parse(raw_data);
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
dark_theme.set_theme_and_update(settings_config.color_scheme_values.night.code);
|
theme.set_theme_and_update(settings_config.color_scheme_values.night.code);
|
||||||
});
|
});
|
||||||
feedback_widget.show({
|
feedback_widget.show({
|
||||||
populate($container) {
|
populate($container) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const attachments_ui = mock_esm("../src/attachments_ui");
|
|||||||
const audible_notifications = mock_esm("../src/audible_notifications");
|
const audible_notifications = mock_esm("../src/audible_notifications");
|
||||||
const bot_data = mock_esm("../src/bot_data");
|
const bot_data = mock_esm("../src/bot_data");
|
||||||
const compose_pm_pill = mock_esm("../src/compose_pm_pill");
|
const compose_pm_pill = mock_esm("../src/compose_pm_pill");
|
||||||
const dark_theme = mock_esm("../src/dark_theme");
|
const theme = mock_esm("../src/theme");
|
||||||
const emoji_picker = mock_esm("../src/emoji_picker");
|
const emoji_picker = mock_esm("../src/emoji_picker");
|
||||||
const gear_menu = mock_esm("../src/gear_menu");
|
const gear_menu = mock_esm("../src/gear_menu");
|
||||||
const information_density = mock_esm("../src/information_density");
|
const information_density = mock_esm("../src/information_density");
|
||||||
@@ -969,7 +969,7 @@ run_test("user_settings", ({override}) => {
|
|||||||
const stub = make_stub();
|
const stub = make_stub();
|
||||||
event = event_fixtures.user_settings__color_scheme_automatic;
|
event = event_fixtures.user_settings__color_scheme_automatic;
|
||||||
user_settings.color_scheme = 2;
|
user_settings.color_scheme = 2;
|
||||||
override(dark_theme, "set_theme_and_update", stub.f); // automatically checks if called
|
override(theme, "set_theme_and_update", stub.f); // automatically checks if called
|
||||||
dispatch(event);
|
dispatch(event);
|
||||||
const args = stub.get_args("color_scheme_code");
|
const args = stub.get_args("color_scheme_code");
|
||||||
assert.equal(stub.num_calls, 1);
|
assert.equal(stub.num_calls, 1);
|
||||||
@@ -980,7 +980,7 @@ run_test("user_settings", ({override}) => {
|
|||||||
const stub = make_stub();
|
const stub = make_stub();
|
||||||
event = event_fixtures.user_settings__color_scheme_dark;
|
event = event_fixtures.user_settings__color_scheme_dark;
|
||||||
user_settings.color_scheme = 1;
|
user_settings.color_scheme = 1;
|
||||||
override(dark_theme, "set_theme_and_update", stub.f); // automatically checks if called
|
override(theme, "set_theme_and_update", stub.f); // automatically checks if called
|
||||||
dispatch(event);
|
dispatch(event);
|
||||||
const args = stub.get_args("color_scheme_code");
|
const args = stub.get_args("color_scheme_code");
|
||||||
assert.equal(stub.num_calls, 1);
|
assert.equal(stub.num_calls, 1);
|
||||||
@@ -991,7 +991,7 @@ run_test("user_settings", ({override}) => {
|
|||||||
const stub = make_stub();
|
const stub = make_stub();
|
||||||
event = event_fixtures.user_settings__color_scheme_light;
|
event = event_fixtures.user_settings__color_scheme_light;
|
||||||
user_settings.color_scheme = 1;
|
user_settings.color_scheme = 1;
|
||||||
override(dark_theme, "set_theme_and_update", stub.f); // automatically checks if called
|
override(theme, "set_theme_and_update", stub.f); // automatically checks if called
|
||||||
dispatch(event);
|
dispatch(event);
|
||||||
const args = stub.get_args("color_scheme_code");
|
const args = stub.get_args("color_scheme_code");
|
||||||
assert.equal(stub.num_calls, 1);
|
assert.equal(stub.num_calls, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user