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 3ca009426..aa20e6998 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*/`
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 f69db7a9e..ef48abaaa 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*/`
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 71115a45c..b9de25014 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 9854bb652..b502029d9 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 000000000..c795b054e
--- /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 759ff99a8..4191be150 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 000000000..43fa82eb8
--- /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 000000000..b5c128e89
--- /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 000000000..917a4a20c
--- /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