Rename Selector -> Picker in theme

This commit is contained in:
Max Brunsfeld 2022-04-28 14:45:32 -07:00
parent 79fad42424
commit a60c75e343
18 changed files with 32 additions and 32 deletions

View File

@ -1,5 +1,5 @@
{
"selector": {
"picker": {
"background": "#26232a",
"corner_radius": 8,
"padding": 8,

View File

@ -1,5 +1,5 @@
{
"selector": {
"picker": {
"background": "#e2dfe7",
"corner_radius": 8,
"padding": 8,

View File

@ -1,5 +1,5 @@
{
"selector": {
"picker": {
"background": "#1c1c1c",
"corner_radius": 8,
"padding": 8,

View File

@ -1,5 +1,5 @@
{
"selector": {
"picker": {
"background": "#f8f8f8",
"corner_radius": 8,
"padding": 8,

View File

@ -1,5 +1,5 @@
{
"selector": {
"picker": {
"background": "#073642",
"corner_radius": 8,
"padding": 8,

View File

@ -1,5 +1,5 @@
{
"selector": {
"picker": {
"background": "#eee8d5",
"corner_radius": 8,
"padding": 8,

View File

@ -1,5 +1,5 @@
{
"selector": {
"picker": {
"background": "#293256",
"corner_radius": 8,
"padding": 8,

View File

@ -1,5 +1,5 @@
{
"selector": {
"picker": {
"background": "#dfe2f1",
"corner_radius": 8,
"padding": 8,

View File

@ -206,9 +206,9 @@ impl PickerDelegate for CommandPalette {
let settings = cx.global::<Settings>();
let theme = &settings.theme;
let style = if selected {
&theme.selector.active_item
&theme.picker.active_item
} else {
&theme.selector.item
&theme.picker.item
};
let key_style = &theme.command_palette.key;
let keystroke_spacing = theme.command_palette.keystroke_spacing;

View File

@ -227,9 +227,9 @@ impl PickerDelegate for FileFinder {
let path_match = &self.matches[ix];
let settings = cx.global::<Settings>();
let style = if selected {
&settings.theme.selector.active_item
&settings.theme.picker.active_item
} else {
&settings.theme.selector.item
&settings.theme.picker.item
};
let (file_name, file_name_positions, full_path, full_path_positions) =
self.labels_for_match(path_match);

View File

@ -33,7 +33,7 @@ pub enum Event {
impl GoToLine {
pub fn new(active_editor: ViewHandle<Editor>, cx: &mut ViewContext<Self>) -> Self {
let line_editor = cx.add_view(|cx| {
Editor::single_line(Some(|theme| theme.selector.input_editor.clone()), cx)
Editor::single_line(Some(|theme| theme.picker.input_editor.clone()), cx)
});
cx.subscribe(&line_editor, Self::on_line_editor_event)
.detach();
@ -152,7 +152,7 @@ impl View for GoToLine {
}
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
let theme = &cx.global::<Settings>().theme.selector;
let theme = &cx.global::<Settings>().theme.picker;
let label = format!(
"{},{} of {} lines",

View File

@ -232,9 +232,9 @@ impl PickerDelegate for OutlineView {
let settings = cx.global::<Settings>();
let string_match = &self.matches[ix];
let style = if selected {
&settings.theme.selector.active_item
&settings.theme.picker.active_item
} else {
&settings.theme.selector.item
&settings.theme.picker.item
};
let outline_item = &self.outline.items[string_match.candidate_id];

View File

@ -57,17 +57,17 @@ impl<D: PickerDelegate> View for Picker<D> {
.with_child(
ChildView::new(&self.query_editor)
.contained()
.with_style(settings.theme.selector.input_editor.container)
.with_style(settings.theme.picker.input_editor.container)
.boxed(),
)
.with_child(
if match_count == 0 {
Label::new(
"No matches".into(),
settings.theme.selector.empty.label.clone(),
settings.theme.picker.empty.label.clone(),
)
.contained()
.with_style(settings.theme.selector.empty.container)
.with_style(settings.theme.picker.empty.container)
} else {
UniformList::new(
self.list_state.clone(),
@ -95,7 +95,7 @@ impl<D: PickerDelegate> View for Picker<D> {
.boxed(),
)
.contained()
.with_style(settings.theme.selector.container)
.with_style(settings.theme.picker.container)
.constrained()
.with_max_width(self.max_size.x())
.with_max_height(self.max_size.y())
@ -126,7 +126,7 @@ impl<D: PickerDelegate> Picker<D> {
pub fn new(delegate: WeakViewHandle<D>, cx: &mut ViewContext<Self>) -> Self {
let query_editor = cx.add_view(|cx| {
Editor::single_line(Some(|theme| theme.selector.input_editor.clone()), cx)
Editor::single_line(Some(|theme| theme.picker.input_editor.clone()), cx)
});
cx.subscribe(&query_editor, Self::on_query_editor_event)
.detach();

View File

@ -224,9 +224,9 @@ impl PickerDelegate for ProjectSymbolsView {
let string_match = &self.matches[ix];
let settings = cx.global::<Settings>();
let style = if selected {
&settings.theme.selector.active_item
&settings.theme.picker.active_item
} else {
&settings.theme.selector.item
&settings.theme.picker.item
};
let symbol = &self.symbols[string_match.candidate_id];
let syntax_runs = styled_runs_for_code_label(&symbol.label, &settings.theme.editor.syntax);
@ -259,7 +259,7 @@ impl PickerDelegate for ProjectSymbolsView {
.with_child(
// Avoid styling the path differently when it is selected, since
// the symbol's syntax highlighting doesn't change when selected.
Label::new(path.to_string(), settings.theme.selector.item.label.clone()).boxed(),
Label::new(path.to_string(), settings.theme.picker.item.label.clone()).boxed(),
)
.contained()
.with_style(style.container)

View File

@ -23,7 +23,7 @@ pub struct Theme {
pub contacts_panel: ContactsPanel,
pub project_panel: ProjectPanel,
pub command_palette: CommandPalette,
pub selector: Selector,
pub picker: Picker,
pub editor: Editor,
pub search: Search,
pub project_diagnostics: ProjectDiagnostics,
@ -288,7 +288,7 @@ pub struct ChannelName {
}
#[derive(Deserialize, Default)]
pub struct Selector {
pub struct Picker {
#[serde(flatten)]
pub container: ContainerStyle,
pub empty: ContainedLabel,
@ -410,7 +410,7 @@ pub struct FieldEditor {
pub selection: SelectionStyle,
}
#[derive(Default, Clone, Copy)]
#[derive(Debug, Default, Clone, Copy)]
pub struct Interactive<T> {
pub default: T,
pub hover: Option<T>,

View File

@ -208,9 +208,9 @@ impl PickerDelegate for ThemeSelector {
let theme = &settings.theme;
let theme_match = &self.matches[ix];
let style = if selected {
&theme.selector.active_item
&theme.picker.active_item
} else {
&theme.selector.item
&theme.picker.item
};
Label::new(theme_match.string.clone(), style.label.clone())

View File

@ -6,7 +6,7 @@ import commandPalette from "./commandPalette";
import editor from "./editor";
import projectPanel from "./projectPanel";
import search from "./search";
import selectorModal from "./selectorModal";
import picker from "./picker";
import workspace from "./workspace";
import projectDiagnostics from "./projectDiagnostics";
@ -16,7 +16,7 @@ export const panel = {
export default function app(theme: Theme): Object {
return {
selector: selectorModal(theme),
picker: picker(theme),
workspace: workspace(theme),
editor: editor(theme),
projectDiagnostics: projectDiagnostics(theme),

View File

@ -1,7 +1,7 @@
import Theme from "../themes/theme";
import { backgroundColor, border, player, shadow, text } from "./components";
export default function selectorModal(theme: Theme): Object {
export default function picker(theme: Theme) {
const item = {
padding: {
bottom: 4,