Skip to content

Build your personal knowledge base with Trilium Notes

chore(monorepo/client): set up some common dependencies

Elian Doran011c859ceabf
diff --git a/_regroup/package.json b/_regroup/package.json
index 90d904504f..d52334b973 100644
--- a/_regroup/package.json
+++ b/_regroup/package.json
@@ -143,7 +143,6 @@
"@stylistic/eslint-plugin": "4.2.0",
"@types/archiver": "6.0.3",
"@types/better-sqlite3": "7.6.13",
- "@types/bootstrap": "5.2.10",
"@types/cheerio": "0.22.35",
"@types/cls-hooked": "4.3.9",
"@types/compression": "1.7.5",
@@ -178,7 +177,6 @@
"@types/xml2js": "0.4.14",
"@types/yargs": "17.0.33",
"@vitest/coverage-v8": "3.1.1",
- "bootstrap": "5.3.5",
"cross-env": "7.0.3",
"css-loader": "7.1.2",
"electron": "35.1.5",
diff --git a/_regroup/src/services/i18n.ts b/_regroup/src/services/i18n.ts
index fc8316494d..5d3c93050c 100644
--- a/_regroup/src/services/i18n.ts
+++ b/_regroup/src/services/i18n.ts
@@ -5,17 +5,7 @@ import sql_init from "./sql_init.js";
import { join } from "path";
import { getResourceDir } from "./utils.js";
import hidden_subtree from "./hidden_subtree.js";
-
-export interface Locale {
- id: string;
- name: string;
- /** `true` if the language is a right-to-left one, or `false` if it's left-to-right. */
- rtl?: boolean;
- /** `true` if the language is not supported by the application as a display language, but it is selectable by the user for the content. */
- contentOnly?: boolean;
- /** The value to pass to `--lang` for the Electron instance in order to set it as a locale. Not setting it will hide it from the list of supported locales. */
- electronLocale?: string;
-}
+import type { Locale } from "@triliumnext/commons";
const LOCALES: Locale[] = [
{
diff --git a/apps/client/package.json b/apps/client/package.json
index 5379c1f38f..b90eae9aa6 100644
--- a/apps/client/package.json
+++ b/apps/client/package.json
@@ -67,6 +67,8 @@
"electron": "35.1.5",
"debounce": "2.2.0",
"draggabilly": "3.0.0",
- "vitest": "3.1.1"
+ "vitest": "3.1.1",
+ "@types/bootstrap": "5.2.10",
+ "bootstrap": "5.3.5"
}
}
diff --git a/apps/client/src/widgets/type_widgets/options/advanced/database_anonymization.ts b/apps/client/src/widgets/type_widgets/options/advanced/database_anonymization.ts
index 2726a489b8..edef0e4d40 100644
--- a/apps/client/src/widgets/type_widgets/options/advanced/database_anonymization.ts
+++ b/apps/client/src/widgets/type_widgets/options/advanced/database_anonymization.ts
@@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
import toastService from "../../../../services/toast.js";
import server from "../../../../services/server.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/advanced/sync.ts b/apps/client/src/widgets/type_widgets/options/advanced/sync.ts
index 39eee0f978..503ad1b3ab 100644
--- a/apps/client/src/widgets/type_widgets/options/advanced/sync.ts
+++ b/apps/client/src/widgets/type_widgets/options/advanced/sync.ts
@@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
import server from "../../../../services/server.js";
import toastService from "../../../../services/toast.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/ai_settings/ai_settings_widget.ts b/apps/client/src/widgets/type_widgets/options/ai_settings/ai_settings_widget.ts
index 269b958ba1..8f76eac4b9 100644
--- a/apps/client/src/widgets/type_widgets/options/ai_settings/ai_settings_widget.ts
+++ b/apps/client/src/widgets/type_widgets/options/ai_settings/ai_settings_widget.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import { TPL } from "./template.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionDefinitions, OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionDefinitions, OptionMap } from "@triliumnext/commons";
import server from "../../../../services/server.js";
import toastService from "../../../../services/toast.js";
import type { EmbeddingStats, FailedEmbeddingNotes } from "./interfaces.js";
diff --git a/apps/client/src/widgets/type_widgets/options/appearance/code_block.ts b/apps/client/src/widgets/type_widgets/options/appearance/code_block.ts
index 2ed2210885..44182fdaef 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance/code_block.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/code_block.ts
@@ -1,4 +1,4 @@
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { t } from "../../../../services/i18n.js";
import library_loader from "../../../../services/library_loader.js";
import server from "../../../../services/server.js";
diff --git a/apps/client/src/widgets/type_widgets/options/appearance/electron_integration.ts b/apps/client/src/widgets/type_widgets/options/appearance/electron_integration.ts
index 2a0181dd4e..b49a7503ba 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance/electron_integration.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/electron_integration.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
import utils from "../../../../services/utils.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/appearance/fonts.ts b/apps/client/src/widgets/type_widgets/options/appearance/fonts.ts
index d9f68f5b76..7d4fa3ce0d 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance/fonts.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/fonts.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import utils from "../../../../services/utils.js";
import { t } from "../../../../services/i18n.js";
-import type { FontFamily, OptionMap, OptionNames } from "../../../../../../services/options_interface.js";
+import type { FontFamily, OptionMap, OptionNames } from "@triliumnext/commons";
interface FontFamilyEntry {
value: FontFamily;
diff --git a/apps/client/src/widgets/type_widgets/options/appearance/max_content_width.ts b/apps/client/src/widgets/type_widgets/options/appearance/max_content_width.ts
index 7b6bccff15..1cf576034b 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance/max_content_width.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/max_content_width.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import utils from "../../../../services/utils.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const MIN_VALUE = 640;
diff --git a/apps/client/src/widgets/type_widgets/options/appearance/ribbon.ts b/apps/client/src/widgets/type_widgets/options/appearance/ribbon.ts
index 257dac0ee1..861410790c 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance/ribbon.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/ribbon.ts
@@ -1,4 +1,4 @@
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { t } from "../../../../services/i18n.js";
import OptionsWidget from "../options_widget.js";
diff --git a/apps/client/src/widgets/type_widgets/options/appearance/theme.ts b/apps/client/src/widgets/type_widgets/options/appearance/theme.ts
index 17a88c3b64..a46408d780 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance/theme.ts
+++ b/apps/client/src/widgets/type_widgets/options/appearance/theme.ts
@@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
import server from "../../../../services/server.js";
import utils from "../../../../services/utils.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/backup.ts b/apps/client/src/widgets/type_widgets/options/backup.ts
index 808f91e92f..9fd79803fb 100644
--- a/apps/client/src/widgets/type_widgets/options/backup.ts
+++ b/apps/client/src/widgets/type_widgets/options/backup.ts
@@ -3,7 +3,7 @@ import { t } from "../../../services/i18n.js";
import OptionsWidget from "./options_widget.js";
import server from "../../../services/server.js";
import toastService from "../../../services/toast.js";
-import type { OptionMap } from "../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/code_notes/code_auto_read_only_size.ts b/apps/client/src/widgets/type_widgets/options/code_notes/code_auto_read_only_size.ts
index 17cd0bb350..b3b7bad0fb 100644
--- a/apps/client/src/widgets/type_widgets/options/code_notes/code_auto_read_only_size.ts
+++ b/apps/client/src/widgets/type_widgets/options/code_notes/code_auto_read_only_size.ts
@@ -1,4 +1,4 @@
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { t } from "../../../../services/i18n.js";
import OptionsWidget from "../options_widget.js";
diff --git a/apps/client/src/widgets/type_widgets/options/code_notes/code_editor.ts b/apps/client/src/widgets/type_widgets/options/code_notes/code_editor.ts
index 728a58f81f..f99b12b503 100644
--- a/apps/client/src/widgets/type_widgets/options/code_notes/code_editor.ts
+++ b/apps/client/src/widgets/type_widgets/options/code_notes/code_editor.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/code_notes/code_mime_types.ts b/apps/client/src/widgets/type_widgets/options/code_notes/code_mime_types.ts
index b8250f67d1..7bb4ecac8e 100644
--- a/apps/client/src/widgets/type_widgets/options/code_notes/code_mime_types.ts
+++ b/apps/client/src/widgets/type_widgets/options/code_notes/code_mime_types.ts
@@ -1,7 +1,7 @@
import { t } from "../../../../services/i18n.js";
import OptionsWidget from "../options_widget.js";
import mimeTypesService from "../../../../services/mime_types.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/i18n/i18n.ts b/apps/client/src/widgets/type_widgets/options/i18n/i18n.ts
index b75c99fc20..48fb295462 100644
--- a/apps/client/src/widgets/type_widgets/options/i18n/i18n.ts
+++ b/apps/client/src/widgets/type_widgets/options/i18n/i18n.ts
@@ -2,8 +2,7 @@ import OptionsWidget from "../options_widget.js";
import server from "../../../../services/server.js";
import utils from "../../../../services/utils.js";
import { getAvailableLocales, t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
-import type { Locale } from "../../../../../../services/i18n.js";
+import type { OptionMap, Locale } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/i18n/language.ts b/apps/client/src/widgets/type_widgets/options/i18n/language.ts
index 4ccf185503..7a10e0a153 100644
--- a/apps/client/src/widgets/type_widgets/options/i18n/language.ts
+++ b/apps/client/src/widgets/type_widgets/options/i18n/language.ts
@@ -1,5 +1,5 @@
import OptionsWidget from "../options_widget.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { getAvailableLocales } from "../../../../services/i18n.js";
import { t } from "i18next";
diff --git a/apps/client/src/widgets/type_widgets/options/images/images.ts b/apps/client/src/widgets/type_widgets/options/images/images.ts
index da2005fefa..d74cd4b709 100644
--- a/apps/client/src/widgets/type_widgets/options/images/images.ts
+++ b/apps/client/src/widgets/type_widgets/options/images/images.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.ts b/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.ts
index d75a6a7bcc..211a4941d9 100644
--- a/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.ts
+++ b/apps/client/src/widgets/type_widgets/options/multi_factor_authentication.ts
@@ -1,7 +1,7 @@
import server from "../../../services/server.js";
import toastService from "../../../services/toast.js";
import OptionsWidget from "./options_widget.js";
-import type { OptionMap } from "../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { t } from "../../../services/i18n.js";
import utils from "../../../services/utils.js";
import dialogService from "../../../services/dialog.js";
diff --git a/apps/client/src/widgets/type_widgets/options/options_widget.ts b/apps/client/src/widgets/type_widgets/options/options_widget.ts
index 5d614a42ec..331358995c 100644
--- a/apps/client/src/widgets/type_widgets/options/options_widget.ts
+++ b/apps/client/src/widgets/type_widgets/options/options_widget.ts
@@ -1,4 +1,4 @@
-import type { FilterOptionsByType, OptionMap, OptionNames } from "../../../../../services/options_interface.js";
+import type { FilterOptionsByType, OptionMap, OptionNames } from "@triliumnext/commons";
import type { EventData, EventListener } from "../../../components/app_context.js";
import type FNote from "../../../entities/fnote.js";
import { t } from "../../../services/i18n.js";
diff --git a/apps/client/src/widgets/type_widgets/options/other/html_import_tags.ts b/apps/client/src/widgets/type_widgets/options/other/html_import_tags.ts
index 61542ea621..5bb6269657 100644
--- a/apps/client/src/widgets/type_widgets/options/other/html_import_tags.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/html_import_tags.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
// TODO: Deduplicate with src/services/html_sanitizer once there is a commons project between client and server.
export const DEFAULT_ALLOWED_TAGS = [
diff --git a/apps/client/src/widgets/type_widgets/options/other/network_connections.ts b/apps/client/src/widgets/type_widgets/options/other/network_connections.ts
index 90f0bbb783..529b9959e9 100644
--- a/apps/client/src/widgets/type_widgets/options/other/network_connections.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/network_connections.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/other/note_erasure_timeout.ts b/apps/client/src/widgets/type_widgets/options/other/note_erasure_timeout.ts
index 3438340062..96292ab37e 100644
--- a/apps/client/src/widgets/type_widgets/options/other/note_erasure_timeout.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/note_erasure_timeout.ts
@@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
import server from "../../../../services/server.js";
import toastService from "../../../../services/toast.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import TimeSelector from "../time_selector.js";
const TPL = /*html*/`
diff --git a/apps/client/src/widgets/type_widgets/options/other/revision_snapshots_limit.ts b/apps/client/src/widgets/type_widgets/options/other/revision_snapshots_limit.ts
index 62781de9fe..55f7348186 100644
--- a/apps/client/src/widgets/type_widgets/options/other/revision_snapshots_limit.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/revision_snapshots_limit.ts
@@ -2,7 +2,7 @@ import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
import server from "../../../../services/server.js";
import toastService from "../../../../services/toast.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/other/search_engine.ts b/apps/client/src/widgets/type_widgets/options/other/search_engine.ts
index 345d3dc471..b512a3caeb 100644
--- a/apps/client/src/widgets/type_widgets/options/other/search_engine.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/search_engine.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import utils from "../../../../services/utils.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/other/share_settings.ts b/apps/client/src/widgets/type_widgets/options/other/share_settings.ts
index 1b1eba047a..7d51bb499f 100644
--- a/apps/client/src/widgets/type_widgets/options/other/share_settings.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/share_settings.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import options from "../../../../services/options.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap, OptionNames } from "../../../../../../services/options_interface.js";
+import type { OptionMap, OptionNames } from "@triliumnext/commons";
import searchService from "../../../../services/search.js";
const TPL = /*html*/`
diff --git a/apps/client/src/widgets/type_widgets/options/other/tray.ts b/apps/client/src/widgets/type_widgets/options/other/tray.ts
index e314dd777a..3760fe6d6c 100644
--- a/apps/client/src/widgets/type_widgets/options/other/tray.ts
+++ b/apps/client/src/widgets/type_widgets/options/other/tray.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
import utils from "../../../../services/utils.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/password/password.ts b/apps/client/src/widgets/type_widgets/options/password/password.ts
index e61f5e92a1..c23b3a7a03 100644
--- a/apps/client/src/widgets/type_widgets/options/password/password.ts
+++ b/apps/client/src/widgets/type_widgets/options/password/password.ts
@@ -3,7 +3,7 @@ import server from "../../../../services/server.js";
import protectedSessionHolder from "../../../../services/protected_session_holder.js";
import toastService from "../../../../services/toast.js";
import OptionsWidget from "../options_widget.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.ts b/apps/client/src/widgets/type_widgets/options/shortcuts.ts
index c25cbebf4e..04d75262dc 100644
--- a/apps/client/src/widgets/type_widgets/options/shortcuts.ts
+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.ts
@@ -3,8 +3,7 @@ import utils from "../../../services/utils.js";
import dialogService from "../../../services/dialog.js";
import OptionsWidget from "./options_widget.js";
import { t } from "../../../services/i18n.js";
-import type { KeyboardShortcut } from "../../../../../services/keyboard_actions_interface.js";
-import type { OptionNames } from "../../../../../services/options_interface.js";
+import type { OptionNames, KeyboardShortcut } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section shortcuts-options-section tn-no-card">
diff --git a/apps/client/src/widgets/type_widgets/options/spellcheck.ts b/apps/client/src/widgets/type_widgets/options/spellcheck.ts
index 87994909d3..43aca1c69a 100644
--- a/apps/client/src/widgets/type_widgets/options/spellcheck.ts
+++ b/apps/client/src/widgets/type_widgets/options/spellcheck.ts
@@ -1,7 +1,7 @@
import utils from "../../../services/utils.js";
import OptionsWidget from "./options_widget.js";
import { t } from "../../../services/i18n.js";
-import type { OptionMap } from "../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL_WEB = `
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/sync.ts b/apps/client/src/widgets/type_widgets/options/sync.ts
index f2be3f40db..0fd94a4f90 100644
--- a/apps/client/src/widgets/type_widgets/options/sync.ts
+++ b/apps/client/src/widgets/type_widgets/options/sync.ts
@@ -2,7 +2,7 @@ import server from "../../../services/server.js";
import toastService from "../../../services/toast.js";
import OptionsWidget from "./options_widget.js";
import { t } from "../../../services/i18n.js";
-import type { OptionMap } from "../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/text_notes/editor.ts b/apps/client/src/widgets/type_widgets/options/text_notes/editor.ts
index dc5ef53da0..d55a704a56 100644
--- a/apps/client/src/widgets/type_widgets/options/text_notes/editor.ts
+++ b/apps/client/src/widgets/type_widgets/options/text_notes/editor.ts
@@ -1,4 +1,4 @@
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
import { t } from "../../../../services/i18n.js";
import utils from "../../../../services/utils.js";
import OptionsWidget from "../options_widget.js";
diff --git a/apps/client/src/widgets/type_widgets/options/text_notes/heading_style.ts b/apps/client/src/widgets/type_widgets/options/text_notes/heading_style.ts
index c45ce08cab..a82a57c509 100644
--- a/apps/client/src/widgets/type_widgets/options/text_notes/heading_style.ts
+++ b/apps/client/src/widgets/type_widgets/options/text_notes/heading_style.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/text_notes/highlights_list.ts b/apps/client/src/widgets/type_widgets/options/text_notes/highlights_list.ts
index 555cdf6eb6..b54bd635a7 100644
--- a/apps/client/src/widgets/type_widgets/options/text_notes/highlights_list.ts
+++ b/apps/client/src/widgets/type_widgets/options/text_notes/highlights_list.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/text_notes/table_of_contents.ts b/apps/client/src/widgets/type_widgets/options/text_notes/table_of_contents.ts
index 3ca0094260..aa20e6998b 100644
--- a/apps/client/src/widgets/type_widgets/options/text_notes/table_of_contents.ts
+++ b/apps/client/src/widgets/type_widgets/options/text_notes/table_of_contents.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/text_notes/text_auto_read_only_size.ts b/apps/client/src/widgets/type_widgets/options/text_notes/text_auto_read_only_size.ts
index f69db7a9e5..ef48abaaa8 100644
--- a/apps/client/src/widgets/type_widgets/options/text_notes/text_auto_read_only_size.ts
+++ b/apps/client/src/widgets/type_widgets/options/text_notes/text_auto_read_only_size.ts
@@ -1,6 +1,6 @@
import OptionsWidget from "../options_widget.js";
import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "../../../../../../services/options_interface.js";
+import type { OptionMap } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section">
diff --git a/apps/client/src/widgets/type_widgets/options/time_selector.ts b/apps/client/src/widgets/type_widgets/options/time_selector.ts
index 71115a45c9..b9de250142 100644
--- a/apps/client/src/widgets/type_widgets/options/time_selector.ts
+++ b/apps/client/src/widgets/type_widgets/options/time_selector.ts
@@ -1,7 +1,7 @@
import OptionsWidget from "./options_widget.js";
import toastService from "../../../services/toast.js";
import { t } from "../../../services/i18n.js";
-import type { OptionDefinitions, OptionMap } from "../../../../../services/options_interface.js";
+import type { OptionDefinitions, OptionMap } from "@triliumnext/commons";
import optionsService from "../../../services/options.js";
type TimeSelectorConstructor = {
diff --git a/package-lock.json b/package-lock.json
index 9854bb652f..b502029d91 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6242,19 +6242,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "apps/client/node_modules/typescript": {
- "version": "5.8.3",
- "dev": true,
- "license": "Apache-2.0",
- "peer": true,
- "bin": {
- "tsc": "bin/tsc",
- "tsserver": "bin/tsserver"
- },
- "engines": {
- "node": ">=14.17"
- }
- },
"apps/client/node_modules/ufo": {
"version": "1.6.1",
"dev": true,
@@ -6877,10 +6864,27 @@
"resolved": "packages/commons",
"link": true
},
+ "node_modules/typescript": {
+ "version": "5.8.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
+ "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
"packages/commons": {
"name": "@triliumnext/commons",
"version": "0.0.1",
- "license": "AGPL-3.0-only"
+ "license": "AGPL-3.0-only",
+ "devDependencies": {
+ "typescript": "5.8.3"
+ }
}
}
}
diff --git a/packages/commons/.gitignore b/packages/commons/.gitignore
new file mode 100644
index 0000000000..c795b054e5
--- /dev/null
+++ b/packages/commons/.gitignore
@@ -0,0 +1 @@
+build
\ No newline at end of file
diff --git a/packages/commons/package.json b/packages/commons/package.json
index 759ff99a87..4191be150a 100644
--- a/packages/commons/package.json
+++ b/packages/commons/package.json
@@ -17,8 +17,12 @@
"url": "https://github.com/TriliumNext/Notes"
},
"type": "module",
- "main": "index.js",
+ "main": "build/index.js",
+ "types": "build/index.d.ts",
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "build": "tsc"
+ },
+ "devDependencies": {
+ "typescript": "5.8.3"
}
}
diff --git a/packages/commons/src/i18n.ts b/packages/commons/src/i18n.ts
new file mode 100644
index 0000000000..43fa82eb8f
--- /dev/null
+++ b/packages/commons/src/i18n.ts
@@ -0,0 +1,10 @@
+export interface Locale {
+ id: string;
+ name: string;
+ /** `true` if the language is a right-to-left one, or `false` if it's left-to-right. */
+ rtl?: boolean;
+ /** `true` if the language is not supported by the application as a display language, but it is selectable by the user for the content. */
+ contentOnly?: boolean;
+ /** The value to pass to `--lang` for the Electron instance in order to set it as a locale. Not setting it will hide it from the list of supported locales. */
+ electronLocale?: string;
+}
\ No newline at end of file
diff --git a/packages/commons/src/index.ts b/packages/commons/src/index.ts
new file mode 100644
index 0000000000..b5c128e897
--- /dev/null
+++ b/packages/commons/src/index.ts
@@ -0,0 +1,3 @@
+export * from "./i18n.js";
+export * from "./options_interface.js";
+export * from "./keyboard_actions_interface.js";
\ No newline at end of file
diff --git a/packages/commons/tsconfig.json b/packages/commons/tsconfig.json
new file mode 100644
index 0000000000..917a4a20c6
--- /dev/null
+++ b/packages/commons/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "compilerOptions": {
+ "module": "ESNext",
+ "declaration": true,
+ "outDir": "build",
+ },
+ "include": [ "./src/**/*.ts" ]
+}
\ No newline at end of file