Skip to content
Merged

Alpha #307

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/assets/css/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@
font-family: 'Parkinsans';
src: url('../../assets/fonts/Parkinsans-VariableFont.ttf');
}

@font-face {
font-family: 'JetBrains Mono';
src: url('../../assets/fonts/JetBrainsMono-VariableFont.ttf');
}
Binary file added src/assets/fonts/JetBrainsMono-VariableFont.ttf
Binary file not shown.
6 changes: 6 additions & 0 deletions src/lib/components/icons/Brave.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}
><path
fill="currentColor"
d="m15.68 0l2.096 2.38s1.84-.512 2.709.358c.868.87 1.584 1.638 1.584 1.638l-.562 1.381l.715 2.047s-2.104 7.98-2.35 8.955c-.486 1.919-.818 2.66-2.198 3.633a186 186 0 0 1-4.293 2.916c-.409.256-.92.692-1.38.692s-.97-.436-1.38-.692a186 186 0 0 1-4.293-2.916c-1.38-.973-1.712-1.714-2.197-3.633c-.247-.975-2.351-8.955-2.351-8.955l.715-2.047l-.562-1.381s.716-.768 1.585-1.638c.868-.87 2.708-.358 2.708-.358L8.321 0h7.36zm-3.679 14.936c-.14 0-1.038.317-1.758.69s-1.242.637-1.409.742s-.065.301.087.409s2.194 1.69 2.393 1.866c.198.175.489.464.687.464s.49-.29.688-.464s2.24-1.759 2.392-1.866s.254-.305.087-.41s-.689-.368-1.41-.741c-.72-.373-1.617-.69-1.757-.69m0-11.278s-.409.001-1.022.206s-1.278.46-1.584.46s-2.581-.434-2.581-.434s-2.695 3.262-2.695 3.959s.339.881.68 1.243l2.02 2.149c.192.203.59.511.356 1.066c-.235.555-.58 1.26-.196 1.977c.384.716 1.042 1.194 1.464 1.115c.421-.08 1.412-.598 1.776-.834c.364-.237 1.518-1.19 1.518-1.554s-1.193-1.02-1.413-1.168c-.22-.15-1.226-.725-1.247-.95c-.02-.227-.012-.293.284-.851c.297-.559.831-1.304.742-1.8c-.089-.495-.95-.753-1.565-.986s-1.799-.671-1.947-.74s-.11-.133.339-.175c.448-.043 1.719-.212 2.292-.052s1.552.403 1.632.532c.079.13.149.134.067.579s-.5 2.581-.541 2.96c-.04.38-.12.63.288.724c.409.094 1.097.256 1.333.256s.924-.162 1.333-.256c.408-.093.329-.344.288-.723c-.04-.38-.46-2.516-.541-2.961s-.012-.45.067-.579c.08-.129 1.059-.372 1.632-.532s1.845.009 2.292.052c.449.042.487.107.339.175c-.148.069-1.332.508-1.947.74c-.615.233-1.476.49-1.565.986c-.09.496.445 1.241.742 1.8s.304.624.284.85s-1.026.802-1.247.95c-.22.15-1.413.804-1.413 1.169c0 .364 1.154 1.317 1.518 1.554c.364.236 1.355.755 1.776.834s1.08-.4 1.464-1.115c.384-.716.039-1.422-.195-1.977s.163-.863.355-1.066l2.02-2.149c.341-.362.68-.546.68-1.243s-2.695-3.96-2.695-3.96s-2.274.436-2.58.436s-.972-.256-1.585-.461s-1.022-.206-1.022-.206"
/></svg
>
6 changes: 6 additions & 0 deletions src/lib/components/icons/DuckDuckGo.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}
><path
fill="currentColor"
d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12s12-5.373 12-12S18.627 0 12 0m0 23C5.925 23 1 18.074 1 12S5.926 1 12 1s11 4.925 11 11s-4.925 11-11 11m10.219-11c0 4.805-3.317 8.833-7.786 9.925c-.27-.521-.53-1.017-.749-1.438c.645.249 1.93.718 2.208.615c.376-.144.282-3.149-.14-3.245c-.338-.075-1.632.837-2.141 1.209l.034.156c.078.397.144.993.03 1.247q-.001.007-.004.013a.2.2 0 0 1-.068.088c-.284.188-1.081.284-1.503.188l-.064-.02c-.694.396-2.01 1.109-2.25.971c-.329-.188-.377-2.676-.329-3.288c.035-.46 1.653.286 2.442.679c.174-.163.602-.272.98-.31c-.57-1.389-.99-2.977-.733-4.105q.001.003.002.002c.356.248 2.73 1.05 3.91 1.027s3.114-.743 2.903-1.323c-.212-.58-2.135.51-4.142.324c-1.486-.138-1.748-.804-1.42-1.29c.414-.611 1.168.116 2.411-.256c1.245-.371 2.987-1.035 3.632-1.397c1.494-.833-.625-1.177-1.125-.947c-.474.22-2.123.637-2.889.82c.428-1.516-.603-4.149-1.757-5.3c-.376-.376-.951-.612-1.603-.736c-.25-.344-.654-.671-1.225-.977a5.77 5.77 0 0 0-3.595-.584l-.024.004l-.034.004l.004.002c-.148.028-.237.08-.357.098c.148.016.705.276 1.057.418c-.174.068-.412.108-.596.184a.8.8 0 0 0-.204.056c-.173.08-.303.375-.3.515c.84-.086 2.082-.026 2.991.246c-.644.09-1.235.258-1.661.482l-.048.028q-.082.03-.152.066c-1.367.72-1.971 2.405-1.611 4.424c.323 1.824 1.665 8.088 2.29 11.064c-3.973-1.4-6.822-5.186-6.822-9.639C1.781 6.356 6.356 1.781 12 1.781S22.219 6.356 22.219 12M9.095 9.581a.758.758 0 1 0 0 1.516a.758.758 0 0 0 0-1.516m.338.702a.196.196 0 1 1 0-.392a.196.196 0 0 1 0 .392m4.724-1.043a.65.65 0 1 0 0 1.299a.65.65 0 0 0 0-1.3zm.29.601a.168.168 0 1 1 0-.336a.168.168 0 0 1 0 .336M9.313 8.146s-.571-.26-1.125.09c-.554.348-.534.704-.534.704s-.294-.656.49-.978c.786-.32 1.17.184 1.17.184zm5.236-.052s-.41-.234-.73-.23c-.654.008-.831.296-.831.296s.11-.688.945-.55a.84.84 0 0 1 .616.484"
/></svg
>
6 changes: 6 additions & 0 deletions src/lib/components/icons/Google.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}
><path
fill="currentColor"
d="M21.456 10.154c.123.659.19 1.348.19 2.067c0 5.624-3.764 9.623-9.449 9.623A9.84 9.84 0 0 1 2.353 12a9.84 9.84 0 0 1 9.844-9.844c2.658 0 4.879.978 6.583 2.566l-2.775 2.775V7.49c-1.033-.984-2.344-1.489-3.808-1.489c-3.248 0-5.888 2.744-5.888 5.993s2.64 5.999 5.888 5.999c2.947 0 4.953-1.686 5.365-4h-5.365v-3.839z"
/></svg
>
6 changes: 0 additions & 6 deletions src/lib/components/icons/GoogleLine.svelte

This file was deleted.

6 changes: 6 additions & 0 deletions src/lib/components/icons/MicrosoftBing.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}
><path
fill="currentColor"
d="M5 3v16l3.72 2L18 15.82v-4.09L9.77 8.95l1.61 3.89L13.94 14L8.7 16.92V4.27z"
/></svg
>
6 changes: 6 additions & 0 deletions src/lib/components/icons/Yahoo.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}
><path
fill="currentColor"
d="M10.5 7.59L8.16 13.2L5.85 7.59H2l4.29 9.64l-1.54 3.47H8.5l5.74-13.11zm4.5 5.14c-1.37 0-2.41 1.04-2.41 2.27c0 1.17 1 2.16 2.34 2.16c1.39 0 2.43-1.03 2.43-2.26c0-1.21-1-2.17-2.36-2.17m2.72-9.43l-3.83 8.59h4.28L22 3.3z"
/></svg
>
35 changes: 30 additions & 5 deletions src/lib/components/menubar/SearchMenu.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<script lang="ts">
import GoogleLineIcon from '@/components/icons/GoogleLine.svelte';
import GoogleIcon from '@/components/icons/Google.svelte';
import MicrosoftBing from '@/components/icons/MicrosoftBing.svelte';
import DuckDuckGo from '@/components/icons/DuckDuckGo.svelte';
import Yahoo from '@/components/icons/Yahoo.svelte';
import Brave from '@/components/icons/Brave.svelte';
import * as Menubar from '@/components/ui/menubar';
import { Notpad } from '@/helpers/notpad';
</script>
Expand All @@ -14,9 +18,30 @@
Go To<Menubar.Shortcut>Ctrl+G</Menubar.Shortcut>
</Menubar.Item>
<Menubar.Separator />
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb()}>
Search on Google
<GoogleLineIcon class="ml-auto text-muted-foreground" />
</Menubar.Item>
<Menubar.Sub>
<Menubar.SubTrigger>Search on</Menubar.SubTrigger>
<Menubar.SubContent>
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb('google')}>
Google
<GoogleIcon class="ml-auto text-muted-foreground" />
</Menubar.Item>
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb('bing')}>
Bing
<MicrosoftBing class="ml-auto text-muted-foreground" />
</Menubar.Item>
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb('duckduckgo')}>
DuckDuckGo
<DuckDuckGo class="ml-3 text-muted-foreground" />
</Menubar.Item>
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb('yahoo')}>
Yahoo
<Yahoo class="ml-auto text-muted-foreground" />
</Menubar.Item>
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb('brave')}>
Brave Search
<Brave class="ml-auto text-muted-foreground" />
</Menubar.Item>
</Menubar.SubContent>
</Menubar.Sub>
</Menubar.Content>
</Menubar.Menu>
12 changes: 10 additions & 2 deletions src/lib/helpers/menubar/search-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ import { isTauri } from '@/src/lib';
import { open as tauriLaunchUrl } from '@tauri-apps/plugin-shell';

export class SearchOptions {
public searchOnWeb = (editorId?: string) => {
private searchEngines = {
google: 'google.com/search',
bing: 'bing.com/search',
duckduckgo: 'duckduckgo.com/',
yahoo: 'search.yahoo.com/search',
brave: 'search.brave.com/search'
} as const;

public searchOnWeb = (searchEngine: keyof typeof this.searchEngines, editorId?: string) => {
const editor = Notpad.editors.getEditor(editorId);
if (!editor) return;

Expand All @@ -16,7 +24,7 @@ export class SearchOptions {
selectedText = selectedText?.trim();
if (!selectedText) return Notpad.showError('Please select some text to search on the web.');

const url = `https://www.google.com/search?q=${encodeURIComponent(selectedText)}`;
const url = `https://${this.searchEngines[searchEngine]}?q=${encodeURIComponent(selectedText)}`;

if (isTauri) {
tauriLaunchUrl(url);
Expand Down
3 changes: 2 additions & 1 deletion src/lib/helpers/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export class Settings {
'Lora',
'Roboto Slab',
'Inconsolata',
'Parkinsans'
'Parkinsans',
'JetBrains Mono'
] as const;
static fontSizes = [6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72] as const;
static zooms = [0.5, 0.75, 0.9, 1, 1.2, 1.5, 1.75, 2] as const;
Expand Down