Skip to content
Merged
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
10 changes: 5 additions & 5 deletions src/lib/stores/settings.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type LanguageCode =
| 'id' // Indonesian
| 'tr'; // Turkish

export const SUPPORTED_LANGUAGES: { code: LanguageCode; name: string; nativeName: string }[] = [
const SUPPORTED_LANGUAGES: { code: LanguageCode; name: string; nativeName: string }[] = [
{ code: 'cs', name: 'Czech', nativeName: 'Čeština' },
{ code: 'da', name: 'Danish', nativeName: 'Dansk' },
{ code: 'nl', name: 'Dutch', nativeName: 'Nederlands' },
Expand Down Expand Up @@ -81,9 +81,9 @@ export const SUPPORTED_LANGUAGES: { code: LanguageCode; name: string; nativeName
{ code: 'zh-TW', name: 'Chinese (Traditional)', nativeName: '繁體中文' },
];

export const SUPPORTED_LANGUAGE_CODES: readonly LanguageCode[] = SUPPORTED_LANGUAGES.map((entry) => entry.code);
const SUPPORTED_LANGUAGE_CODES: readonly LanguageCode[] = SUPPORTED_LANGUAGES.map((entry) => entry.code);

export function isSupportedLanguage(value: unknown): value is LanguageCode {
function isSupportedLanguage(value: unknown): value is LanguageCode {
return typeof value === 'string' && (SUPPORTED_LANGUAGE_CODES as readonly string[]).includes(value);
}

Expand Down Expand Up @@ -305,7 +305,7 @@ export function writeStoredSetting(key: string, value: string | null): boolean {
}

/** Applies everything currently in localStorage onto `target`. */
export function loadPersistedSettings<T>(target: T, entries: readonly PersistedSetting<T>[]): void {
function loadPersistedSettings<T>(target: T, entries: readonly PersistedSetting<T>[]): void {
if (typeof localStorage === 'undefined') return;
for (const entry of entries) {
entry.load(target, localStorage.getItem(entry.key));
Expand All @@ -326,7 +326,7 @@ export function loadPersistedSettings<T>(target: T, entries: readonly PersistedS
* *other* same-origin document, so each window folds its siblings' changes into
* its own state instead of drifting until the next restart.
*/
export function installPersistedSettings<T>(target: T, entries: readonly PersistedSetting<T>[]): void {
function installPersistedSettings<T>(target: T, entries: readonly PersistedSetting<T>[]): void {
for (const entry of entries) {
$effect(() => {
writeStoredSetting(entry.key, entry.read(target));
Expand Down
4 changes: 2 additions & 2 deletions src/lib/stores/update.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { check, type Update } from '@tauri-apps/plugin-updater';
import { relaunch } from '@tauri-apps/plugin-process';
import { getVersion } from '@tauri-apps/api/app';

export type UpdatePhase =
type UpdatePhase =
| 'idle'
| 'checking'
| 'up-to-date'
| 'available'
| 'downloading'
| 'error';

export type ErrorSource = 'check' | 'download' | 'install';
type ErrorSource = 'check' | 'download' | 'install';

// Match only messages that genuinely indicate the updater plugin lacks an
// endpoint / pubkey configuration. We deliberately do NOT match the bare
Expand Down
4 changes: 2 additions & 2 deletions src/lib/utils/editorToolbar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type EditorToolbarGroup = 'inline' | 'block' | 'list' | 'insert';
type EditorToolbarGroup = 'inline' | 'block' | 'list' | 'insert';

export type EditorToolbarTool = {
id: string;
Expand All @@ -13,7 +13,7 @@ export type EditorToolbarMove = {
toIndex: number;
};

export const EDITOR_TOOLBAR_TOOLS: EditorToolbarTool[] = [
const EDITOR_TOOLBAR_TOOLS: EditorToolbarTool[] = [
{ id: 'fmt-bold', label: 'B', name: 'Bold', shortcut: (modifier) => `${modifier}+B`, group: 'inline' },
{ id: 'fmt-italic', label: 'I', name: 'Italic', shortcut: (modifier) => `${modifier}+I`, group: 'inline' },
{ id: 'fmt-underline', label: 'U', name: 'Underline', shortcut: (modifier) => `${modifier}+U`, group: 'inline' },
Expand Down
8 changes: 4 additions & 4 deletions src/lib/utils/exportFonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function selectorClasses(selector: string): string[] {
.filter((name) => name !== 'katex');
}

export interface KatexFamilyRule {
interface KatexFamilyRule {
/** Class tokens that must all be present for the rule to apply. */
classes: string[];
families: string[];
Expand All @@ -64,7 +64,7 @@ export interface KatexFamilyRule {
* family, read out of the stylesheet rather than hard-coded, so a KaTeX upgrade
* that renames a class or adds a family is picked up without edits here.
*/
export function parseKatexFamilyRules(css: string): KatexFamilyRule[] {
function parseKatexFamilyRules(css: string): KatexFamilyRule[] {
const rules: KatexFamilyRule[] = [];
for (const match of css.matchAll(/([^{}]+)\{([^{}]*)\}/g)) {
const selector = match[1].trim();
Expand All @@ -81,7 +81,7 @@ export function parseKatexFamilyRules(css: string): KatexFamilyRule[] {
}

/** Every class token used anywhere under `root`, including `root` itself. */
export function collectClassNames(root: Element): Set<string> {
function collectClassNames(root: Element): Set<string> {
const names = new Set<string>();
// Walked rather than selected: `querySelectorAll('*')` is the one call that
// would tie this to a full selector engine, and the walk is no slower.
Expand Down Expand Up @@ -221,7 +221,7 @@ export function katexFontUrlsToEmbed(css: string, usedFamilies: Set<string>): st
}

/** `btoa` in chunks: a 30 KB font blows the argument limit of `apply`. */
export function bytesToBase64(bytes: Uint8Array): string {
function bytesToBase64(bytes: Uint8Array): string {
let binary = '';
const chunk = 0x8000;
for (let index = 0; index < bytes.length; index += chunk) {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/utils/frontMatter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { parseDocument } from 'yaml';

export type FrontMatterValueKind = 'string' | 'number' | 'boolean' | 'list' | 'object' | 'null';
type FrontMatterValueKind = 'string' | 'number' | 'boolean' | 'list' | 'object' | 'null';

export type FrontMatterField = {
key: string;
Expand Down Expand Up @@ -198,7 +198,7 @@ export function updateFrontMatterField(content: string, key: string, value: unkn
return `---${parsed.lineEnding}${serialized}${parsed.lineEnding}---${parsed.lineEnding}${parsed.lineEnding}${parsed.body}`;
}

export function parseFrontMatterTagInput(value: string): string[] {
function parseFrontMatterTagInput(value: string): string[] {
return value
.split(',')
.map((item) => item.trim())
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/markdownLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function hasMarkdownLinkExtension(path: string): boolean {
return /\.(md|markdown|mdown|mkd|txt)$/i.test(path);
}

export function isAbsoluteMarkdownPath(path: string): boolean {
function isAbsoluteMarkdownPath(path: string): boolean {
return path.startsWith('/') || path.startsWith('\\') || /^[a-z]:/i.test(path);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/mermaidPrint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const SOURCE_ATTR = 'data-mermaid-source';

export const MERMAID_PRINT_THEME = 'neutral';

export interface MermaidRenderer {
interface MermaidRenderer {
initialize(config: { startOnLoad: boolean; theme: string }): void;
render(id: string, source: string): Promise<{ svg: string }>;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/openExportedFile.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type ExportedFileFormat = 'HTML' | 'PDF';
export type OpenExportedFileResult = 'opened' | 'declined' | 'failed';

export type OpenExportedFileLabels = {
type OpenExportedFileLabels = {
title?: string;
message?: string;
};
Expand Down
6 changes: 3 additions & 3 deletions src/lib/utils/pasteContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export const MARKDOWN_LANGUAGE_ID = 'markdown';
* A plain letter is used on purpose: it carries no markdown meaning, so it
* cannot open or close a construct that would change the caret's own token.
*/
export const PASTE_PROBE_CHARACTER = 'x';
const PASTE_PROBE_CHARACTER = 'x';

export type PasteContextToken = {
readonly offset: number;
readonly type: string;
readonly language: string;
};

export type PasteContextTokenizer = (text: string) => readonly (readonly PasteContextToken[])[];
type PasteContextTokenizer = (text: string) => readonly (readonly PasteContextToken[])[];

/**
* Token types Monaco's markdown grammar emits for code. The `.md` suffix is
Expand Down Expand Up @@ -79,7 +79,7 @@ export function findTokenAtOffset(
return found;
}

export function isCodeAtOffset(tokens: readonly PasteContextToken[], offset: number): boolean {
function isCodeAtOffset(tokens: readonly PasteContextToken[], offset: number): boolean {
const token = findTokenAtOffset(tokens, offset);
return token ? isCodeToken(token) : false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/tabFileActions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isHomePath } from './homeTab.js';

export type TabFileActionId = 'copy-path' | 'open-location';
type TabFileActionId = 'copy-path' | 'open-location';

export type TabFileAction = {
id: TabFileActionId;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/titlebarToolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type ConfiguredTitlebarToolbarIds = {
menuIds: string[];
};

export const TITLEBAR_TOOLBAR_ACTIONS: TitlebarToolbarAction[] = [
const TITLEBAR_TOOLBAR_ACTIONS: TitlebarToolbarAction[] = [
{ id: 'back', labelKey: 'menu.back', fallbackName: 'Back', sample: '<', defaultPlacement: 'bar' },
{ id: 'forward', labelKey: 'menu.forward', fallbackName: 'Forward', sample: '>', defaultPlacement: 'bar' },
{ id: 'reload', labelKey: 'tooltip.reloadFromDisk', fallbackName: 'Reload from Disk', sample: 'R', defaultPlacement: 'bar' },
Expand Down
Loading