fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerUse globals for color variables, react to light/dark mode190d367bc

master
23.5 KiB354 linesraw
1<!DOCTYPE html>
2<html ng-app="fishconfig">
3
4<head>
5    <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
6    <title>fish shell configuration</title>
7    <link rel="icon" type="image/png" href="favicon.png" />
8    <link rel="stylesheet" type="text/css" href="fishconfig.css" />
9    <link rel="stylesheet" type="text/css" media="print" href="fishconfig_print.css">
10    <script type="text/javascript" src="js/colorutils.js" defer></script>
11    <script type="text/javascript" src="js/main.js" defer></script>
12    <script type="text/javascript" src="js/alpine.js" defer></script>
13</head>
14
15<!-- TODO check that every x-for has a :key binding -->
16<!-- TODO check that every template has single child -->
17<!-- TODO try to reduce depth by either splitting routes or eliminating redundant wrappers -->
18
19<body id="ancestor" x-data="{ currentTab: 'colors' }">
20    <main id="parent">
21        <div id="tab_parent">
22            <a :class="{'tab': true, 'selected_tab': currentTab =='colors'}" id="tab_colors"
23                @click="currentTab = 'colors'">colors</a>
24            <a :class="{'tab': true, 'selected_tab': currentTab == 'prompt'}" id="tab_prompt"
25                @click="currentTab = 'prompt'">prompt</a>
26            <a :class="{'tab': true, 'selected_tab': currentTab == 'functions'}" id="tab_functions"
27                @click="currentTab = 'functions'">functions</a>
28            <a :class="{'tab': true, 'selected_tab': currentTab == 'variables'}" id="tab_variables"
29                @click="currentTab = 'variables'">variables</a>
30            <a :class="{'tab': true, 'selected_tab': currentTab == 'history'}" id="tab_history"
31                @click="currentTab = 'history'">history</a>
32            <a :class="{'tab': true, 'selected_tab': currentTab == 'bindings'}" id="tab_bindings"
33                @click="currentTab = 'bindings'"><span class="print_only">fish shell </span>bindings</a>
34        </div>
35        <div id="tab_contents">
36            <template x-if="currentTab === 'colors'" x-data="colors">
37                <div>
38                    <!-- ko with: color_picker -->
39                    <div class="colorpicker_text_sample" :style="{'background-color': actualTerminalBackgroundColor}">
40                        <span style="position: absolute; left: 10px; top: 3px"
41                            :style="{'color': `#${text_color_for_color(actualTerminalBackgroundColor)}`}"
42                            x-text="selectedColorScheme.name_with_color_theme"></span>
43                        <br />
44                        <div class="color_picker_background_cells">
45                            <span style="display: block; text-align: right; line-height: 110%"
46                                :style="{'color': `#${text_color_for_color(actualTerminalBackgroundColor)}`}">
47                                Simulate background color
48                            </span>
49                            <template x-for="color in sampleTerminalBackgroundColors">
50                                <label :style="{'background-color': color}">
51                                    <input type="radio" :value="color" x-model="overriddenTerminalBackgroundColor" hidden
52                                        :title="'Preview with this background color.\n\nfish cannot change the background color of your terminal. Refer to your terminal settings to set its background color.'">
53                                    </input>
54                                </label>
55                            </template>
56                        </div>
57                        <!-- This is the sample text -->
58                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_command'}"
59                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_command)}"
60                            @click="selectColorSetting('fish_color_command')">/bright/vixens</span>
61                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_param'}"
62                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_param)}"
63                            @click="selectColorSetting('fish_color_param')">jump</span>
64                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_end'}"
65                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_end)}"
66                            @click="selectColorSetting('fish_color_end')">|</span>
67                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_command'}"
68                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_command)}"
69                            @click="selectColorSetting('fish_color_command')">dozy</span>
70                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_quote'}"
71                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_quote)}"
72                            @click="selectColorSetting('fish_color_quote')"> "fowl"</span>
73                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_redirection'}"
74                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_redirection)}"
75                            @click="selectColorSetting('fish_color_redirection')">&gt; quack</span>
76                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_end'}"
77                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_end)}"
78                            @click="selectColorSetting('fish_color_end')">&</span>
79                        <br>
80
81                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_command'}"
82                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_command)}"
83                            @click="selectColorSetting('fish_color_command')">echo</span>
84
85                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_error'}"
86                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_error)}"
87                            @click="selectColorSetting('fish_color_error')">'</span><span
88                            :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_quote'}"
89                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_quote)}"
90                            @click="selectColorSetting('fish_color_quote')">Errors are the portals to discovery</span>
91
92                        <br>
93
94                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_comment'}"
95                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_comment)}"
96                            @click="selectColorSetting('fish_color_comment')"># This is a comment</span>
97
98                        <br>
99
100                        <span :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_command'}"
101                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_command)}"
102                            @click="selectColorSetting('fish_color_command')">Th</span><span class="fake_cursor"><span
103                                style="visibility: hidden">i</span></span><span
104                            :class="{cs_clickable: customizationActive, cs_editing: csEditingType == 'fish_color_autosuggestion'}"
105                            :style="{ 'color': interpret_color(currentColorScheme().colors.fish_color_autosuggestion)}"
106                            @click="selectColorSetting('fish_color_autosuggestion')">s is an autosuggestion</span>
107
108
109                        <div style="position: absolute; right: 5px; bottom: 5px;">
110
111                            <button class="customize_theme_button" :class="{button_highlight: customizationActive}"
112                                :style="{'color': `#${text_color_for_color(actualTerminalBackgroundColor)}`}"
113                                @click="toggleCustomizationActive">Customize</button>
114
115                            <button class="save_button"
116                                :style="{'color': `#${text_color_for_color(actualTerminalBackgroundColor)}`}"
117                                x-show="showSaveButton" @click="setTheme" x-text="saveThemeButtonTitle"></button>
118                        </div>
119
120                    </div>
121
122                    <div x-show="customizationActive">
123                        <div style="margin: 10px 0 7px 35px;">Choose a color for <span
124                                x-text="csUserVisibleTitle"></span>:</div>
125                        <!-- TODO maybe add input[type=color] for 24bit terminals -->
126                        <table class="colorpicker_term256" style="margin: 0px 20px;">
127                            <tbody>
128                                <template x-for="color_array in colorArraysArray">
129                                    <tr class="colorpicker_term256_row">
130                                        <template x-for="color in color_array">
131                                            <td class="colorpicker_term256_cell"
132                                                :style="{'background-color': interpret_color(color)}"
133                                                @click="changeSelectedTextColor(color)">
134                                                <div class="colorpicker_term256_selection_indicator"
135                                                    x-show="currentColorScheme().colors[selectedColorSetting] == color"
136                                                    :style="{'border-color': interpret_color(border_color_for_color(color))}">
137                                                </div>
138                                            </td>
139                                        </template>
140                                    </tr>
141                                </template>
142                            </tbody>
143                            <!-- /ko -->
144                        </table>
145                    </div>
146
147                    <div style="margin: 10px 0 7px 35px;">Preview a theme below:</div>
148
149                    <div class="color_scheme_choices_scrollview">
150                        <div class="color_scheme_choices_list">
151                            <template x-for="colorScheme in colorSchemes">
152                                <div class="color_scheme_choice_container"
153                                    @click="changeSelectedColorScheme(colorScheme)">
154                                    <div class="color_scheme_choice_label">
155                                        <!-- This click/clickBubble nonsense is so that we can have a separate URL inside a parent with an onClick handler -->
156                                        <span x-text="colorScheme.name_with_color_themes"></span>
157                                        <a x-show="colorScheme.url" style="text-decoration: none; color: inherit;"
158                                            :href="colorScheme.url">&#10138;</a>
159                                    </div>
160                                    <div class="colorpicker_text_sample_tight"
161                                        :style="{'background-color': default_color_scheme(colorScheme).preferred_background}">
162                                        <span
163                                            :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_command)}">/bright/vixens</span>
164                                        <span :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_param)}">jump</span>
165                                        <span :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_end)}">|</span>
166                                        <span :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_command)}">dozy</span>
167                                        <span :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_quote)}"> "fowl" </span>
168                                        <span :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_redirection)}">&gt;
169                                            quack</span>
170                                        <span :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_end)}">&</span>
171                                        <br>
172                                        <span :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_command)}">echo</span>
173                                        <span :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_error)}">'</span><span
174                                            :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_quote)}">Errors are the
175                                            portals to discovery</span>
176                                        <br>
177                                        <span :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_comment)}"># This is a
178                                            comment</span>
179                                        <br>
180                                        <span :style="{'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_command)}">Th</span><span
181                                            class="fake_cursor"><span style="visibility: hidden">i</span></span><span
182                                            :style="{ 'color': interpret_color(default_color_scheme(colorScheme).colors.fish_color_autosuggestion)}">s is an
183                                            autosuggestion</span>
184                                    </div>
185                                </div>
186                            </template>
187                        </div>
188                    </div>
189                    <!-- /ko -->
190                </div>
191            </template>
192
193            <!-- Investigate potential race condition with selectedPrompt (e.g. replace x-if with x-show) -->
194            <template x-if="currentTab === 'prompt'" x-data="prompt">
195                <div class="height_limiter">
196                    <!-- The first 'sample' prompt is the current one; the remainders are samples. This ought to be cleaned up. -->
197                    <div class="current_prompt" style="min-height: 7.5em;"
198                        :style="{'background-color': actualTerminalBackgroundColor}">
199                        <div class="prompt_demo_choice_label" style="color: #FFF;" x-text="selectedPrompt.name"></div>
200                        <div style='display: flex'>
201                            <div x-html='selectedPrompt.demo' style='flex-grow: 1' class="prompt_demo unbordered"></div>
202                            <template x-if="selectedPrompt.right">
203                                <div title="right prompt for {{selectedPrompt.name }}" x-html='selectedPrompt.right'
204                                    class="prompt_demo unbordered" @click="selectPrompt(selectedPrompt)">
205                                </div>
206                            </template>
207                        </div>
208                        <div style="position: absolute; right: 5px; bottom: 5px;">
209                            <button class="save_button" x-show="showSaveButton" style="color: #CCC" @click="setPrompt()"
210                                x-text="savePromptButtonTitle"></button>
211                        </div>
212                    </div>
213                    <div style="margin: 10px 15px 7px 15px; padding-bottom: 10px; border-bottom: solid 1px #999">Preview
214                        a
215                        prompt below:</div>
216                    <div class="prompt_choices_scrollview">
217                        <div class="prompt_choices_list">
218                            <template x-for="p in samplePrompts" :key="p.name">
219                                <div>
220                                    <div class="prompt_demo_choice_label" x-text="p.name"></div>
221                                    <template x-if="p.right">
222                                        <div style="display: flex;">
223                                            <div x-html="p.demo" class="prompt_demo" style="flex-grow: 1"
224                                                @click="selectPrompt(p)"></div>
225                                            <div title="right prompt for {{p.name}}" x-html="p.right || ''"
226                                                class="prompt_demo" @click="selectPrompt(p)"></div>
227                                        </div>
228                                    </template>
229                                    <template x-if="!p.right">
230                                        <div x-html="p.demo" class="prompt_demo" @click="selectPrompt(p)">
231                                    </template>
232                                </div>
233                            </template>
234                        </div>
235                    </div>
236                </div>
237            </template>
238
239            <template x-if="currentTab === 'functions'" x-data="functions">
240                <div class="function_tab">
241                    <div class="function-list">
242                        <template x-for="func in functions">
243                            <!-- TODO use ul/li -->
244                            <div>
245                                <div id="master_{{func}}"
246                                    :class="{'master_element': true, 'selected_master_elem': func == selectedFunction }"
247                                    @click="selectFunction(func)">
248                                    <span class="master_element_text" x-text="func"></span>
249                                </div>
250                            </div>
251                        </template>
252                    </div>
253                    <div class="function-body">
254                        <div class="detail_function" x-html="functionDefinition"></div>
255                    </div>
256                </div>
257
258            </template>
259
260            <template x-if="currentTab === 'variables'" x-data="variables">
261                <div>
262                    <div id="table_filter_container">
263                        <input id="table_filter_text_box" class="filter_text_box text_box_transient"
264                            placeholder="Filter" x-model="query">
265                    </div>
266                    <table class="data_table">
267                        <template x-for="v in filteredVars" :key="v.name">
268                            <tr class="data_table_row" tabindex="0" x-data="{ focused: false }"
269                                @focusin="focused = true" @focusout="focused = false">
270                                <td class="data_table_cell no_overflow" style="text-align: right; padding-right: 30px;"
271                                    x-text="v.name"></td>
272                                <!-- Small hack to select/unselect variables -->
273                                <td :class="{ 'data_table_cell': true, 'no_overflow': !focused }"
274                                    style="text-align: left; padding-right: 30px;" x-text="v.value"></td>
275                            </tr>
276                        </template>
277                    </table>
278                </div>
279            </template>
280
281            <template x-if="currentTab === 'history'" x-data="history">
282                <div>
283                    <div id="table_filter_container">
284                        <table class="paginator">
285                            <tr>
286                                <td class="prev">
287                                    <button type="button" @click="prevPage" :disabled="currentPage == 0">« Prev</button>
288                                </td>
289                                <td class="desc" x-text="currentPageDescription"></td>
290                                <td class="next">
291                                    <button type="button" @click="nextPage"
292                                        :disabled="(currentPage+1)*itemsPerPage >= filteredItems.length">Next »</button>
293                                </td>
294                            </tr>
295
296                        </table>
297
298                        <input id="table_filter_text_box" class="filter_text_box text_box_transient"
299                            placeholder="Filter" x-model.debounce="query">
300                    </div>
301                    <table class="data_table">
302                        <!-- TODO maybe use history index as keys here? -->
303                        <template
304                            x-for="item in filteredItems.slice(currentPage * itemsPerPage, (currentPage+1) * itemsPerPage)"
305                            :key="item">
306                            <tr>
307                                <td :class="{'history_text': true, 'no_overflow': selectedItems.indexOf(item) < 0}"
308                                    @click="selectItem(item)" x-text="item"></td>
309                                <td class="history_delete">
310                                    <button type="button" class="delete_button" title="Delete"
311                                        @click="deleteHistoryItem(item)">&times;</button>
312                                </td>
313                            </tr>
314                        </template>
315                    </table>
316                </div>
317            </template>
318
319
320            <template x-if="currentTab === 'bindings'" x-data="bindings"
321                x-init="bindings = await (await fetch('bindings/')).json()">
322                <div>
323                    <div id="table_filter_container">
324                        <input id="table_filter_text_box" class="filter_text_box text_box_transient"
325                            placeholder="Filter" x-model="query">
326                    </div>
327                    <table class="data_table">
328                        <template x-for="b in filteredBindings" :key="b.command">
329                            <tr class="data_table_row" tabindex="0" x-data="{ focused: false }"
330                                @focusin="focused = true" @focusout="focused = false">
331                                <td :class="{ 'data_table_cell': true, 'no_overflow': !focused }"
332                                    style="text-align: right; padding-right: 30px;" x-text="b.command"></td>
333                                <!-- Small hack to select/unselect variables -->
334                                <td :class="{ 'data_table_cell': true, 'no_overflow': !focused }"
335                                    style="text-align: left; padding-right: 30px;">
336                                    <template x-for="variety in b.bindings" :key="variety.readable_binding">
337                                        <div>
338                                            <span x-text="variety.readable_binding"></span>
339                                            <template x-for="raw in variety.raw_bindings" :key="raw">
340                                                <div class="raw_binding" x-show="focused" x-text="raw"></div>
341                                            </template>
342                                        </div>
343                                    </template>
344                                </td>
345                            </tr>
346                        </template>
347                    </table>
348                </div>
349            </template>
350        </div>
351    </main>
352</body>
353
354</html>