From 4312d294c95b99a5b1a679e99d5872cf319529e1 Mon Sep 17 00:00:00 2001 From: platinum1154 Date: Sun, 8 Nov 2026 12:10:54 +0800 Subject: [PATCH 01/18] fix(legacy): complete settings translations and preserve task refresh repairs --- .github/workflows/ci.yml | 14 +- .github/workflows/release.yml | 10 +- README.md | 5 + RELEASING.zh-CN.md | 45 + VALIDATION.zh-CN.md | 37 + manifest.json | 4 +- package.json | 12 +- packages/calendar | 2 +- scripts/check-release-version.cjs | 8 + scripts/check-settings-i18n.cjs | 33 + scripts/settings-i18n-keys.json | 1802 +++++++++++++++++ .../fluent-status-menu-regression.test.ts | 55 + .../legacy-settings-invalidation.test.ts | 40 + .../legacy-settings-language.test.ts | 30 + src/__tests__/removeBlankTasks.test.ts | 30 + .../features/calendar/views/tg-agenda-view.ts | 3 +- .../features/calendar/views/tg-year-view.ts | 3 +- .../fluent/managers/FluentActionHandlers.ts | 69 +- src/components/features/habit/habit.ts | 11 +- .../features/habit/modals/HabitChartModal.ts | 3 +- .../quick-capture/components/FileNameInput.ts | 11 +- .../components/FileSourceSettingsSection.ts | 3 +- .../tabs/DesktopIntegrationSettingsTab.ts | 7 +- .../features/settings/tabs/IcsSettingsTab.ts | 17 +- .../settings/tabs/IndexSettingsTab.ts | 3 +- .../tabs/McpIntegrationSettingsTab.ts | 23 +- .../settings/tabs/ProgressSettingsTab.ts | 9 +- .../settings/tabs/QuickCaptureSettingsTab.ts | 11 +- .../settings/tabs/TaskHandlerSettingsTab.ts | 27 +- .../settings/tabs/TaskStatusSettingsTab.ts | 47 +- .../settings/tabs/TaskTimerSettingsTab.ts | 57 +- .../settings/tabs/TimeParsingSettingsTab.ts | 5 +- .../settings/tabs/WorkflowSettingsTab.ts | 5 +- .../task/filter/in-view/filter-pill.ts | 3 +- .../features/task/view/InlineEditor.ts | 21 +- src/components/features/task/view/listItem.ts | 19 +- src/components/features/task/view/treeItem.ts | 19 +- .../ui/date-picker/BulkDateOffsetModal.ts | 3 +- .../ui/modals/CalendarViewConfigModal.ts | 15 +- src/components/ui/modals/IframeModal.ts | 5 +- src/components/ui/modals/McpLogModal.ts | 27 +- src/dataflow/Orchestrator.ts | 39 +- src/dataflow/api/QueryAPI.ts | 5 + src/dataflow/augment/Augmentor.ts | 5 + src/dataflow/indexer/Repository.ts | 21 +- src/dataflow/settings-signature.ts | 21 + src/index.ts | 5 + src/setting.ts | 3 +- src/translations/locale/en.ts | 547 +++++ src/translations/locale/zh-cn.ts | 612 +++++- src/utils/task/removeBlankTasks.ts | 23 + versions.json | 5 +- 52 files changed, 3570 insertions(+), 269 deletions(-) create mode 100644 RELEASING.zh-CN.md create mode 100644 VALIDATION.zh-CN.md create mode 100644 scripts/check-release-version.cjs create mode 100644 scripts/check-settings-i18n.cjs create mode 100644 scripts/settings-i18n-keys.json create mode 100644 src/__tests__/fluent-status-menu-regression.test.ts create mode 100644 src/__tests__/legacy-settings-invalidation.test.ts create mode 100644 src/__tests__/legacy-settings-language.test.ts create mode 100644 src/__tests__/removeBlankTasks.test.ts create mode 100644 src/dataflow/settings-signature.ts create mode 100644 src/utils/task/removeBlankTasks.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b28ebd22c..0ec7fc71c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: [master, main] + branches: [master, main, "legacy/**"] pull_request: - branches: [master, main] + branches: [master, main, "legacy/**"] jobs: build: @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + submodules: true - name: Setup Node.js uses: actions/setup-node@v4 @@ -22,7 +24,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 10 + version: 10.26.0 - name: Get pnpm store directory shell: bash @@ -38,10 +40,10 @@ jobs: ${{ runner.os }}-pnpm-store- - name: Install dependencies - run: pnpm install + run: pnpm install --frozen-lockfile --ignore-scripts - name: Build - run: pnpm run build + run: pnpm build:release - name: Run tests - run: pnpm run test --passWithNoTests + run: pnpm exec jest --runInBand --passWithNoTests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a90a75f12..b1d2c3a79 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + submodules: true - name: Setup Node.js uses: actions/setup-node@v4 @@ -25,7 +26,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 10 + version: 10.26.0 - name: Get pnpm store directory shell: bash @@ -41,10 +42,13 @@ jobs: ${{ runner.os }}-pnpm-store- - name: Install dependencies - run: pnpm install + run: pnpm install --frozen-lockfile --ignore-scripts + + - name: Verify tag matches plugin version + run: node scripts/check-release-version.cjs "${GITHUB_REF_NAME}" - name: Build - run: pnpm run build + run: pnpm build:release - name: Get version from tag id: get_version diff --git a/README.md b/README.md index 785e9e4f2..c9b6bc044 100644 --- a/README.md +++ b/README.md @@ -77,3 +77,8 @@ Join our active community for help, tips, and feature discussions: [FSL-1.1-ALv2](./LICENSE) Feel free to use any part in the `src/components`, such as the Inline Markdown Editor or the Kanban component. +## 旧布局维护分支 + +`legacy/9.13.1` 从官方 9.13.1 标签维护,保留原设置导航与布局。设置中文、状态菜单和索引刷新修复在此分支独立实现。 + +发布步骤见 [RELEASING.zh-CN.md](RELEASING.zh-CN.md)。使用 `pnpm build:release` 生成 `dist/main.js`、`dist/manifest.json`、`dist/styles.css`,随后由仓库所有者自行创建 GitHub Release。PR 或构建成功本身不会发布 Release。 diff --git a/RELEASING.zh-CN.md b/RELEASING.zh-CN.md new file mode 100644 index 000000000..1f3f07d86 --- /dev/null +++ b/RELEASING.zh-CN.md @@ -0,0 +1,45 @@ +# 自行发布旧布局版本 + +本维护分支从官方 `9.13.1` 标签建立,保留旧设置布局。新 PR 合并目标是 `legacy/9.13.1`,与仓库原来的 `master` 分开。当前准备发布的插件版本是 **9.13.2**。 + +## 第一次发布:通过 GitHub 网页 + +1. 合并本 PR 到 `legacy/9.13.1`。 +2. 打开仓库右侧的 **Releases**,点击 **Draft a new release**。 +3. 在 **Choose a tag** 输入 `9.13.2`,选择创建新标签。在 **Target** 选择 `legacy/9.13.1`。标签与 `manifest.json` 中的版本号保持一致,不要加 `v`。 +4. 标题填写 `9.13.2:旧布局设置中文完善`,说明中写本次改动。 +5. 在附件区域上传构建生成的 **main.js、manifest.json、styles.css**。可以额外上传 `task-genius-9.13.2.zip`,但 BRAT 所需的三个文件仍应分别作为附件提供。 +6. 自测版本可以勾选 **This is a pre-release**。确认可用、希望 BRAT 的 `latest` 自动获取时,发布正式版本并选择 **Set as latest release**。 +7. 最后点击 **Publish release**。发布后检查附件列表是否真的有三个独立文件;GitHub 自动提供的 Source code 压缩包只是源码。 + +官方网页操作说明:https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository + +## 怎样从源码生成附件 + +需要 Git、Node.js 20 及 pnpm 10.26.0。在终端执行: + +```powershell +git clone --branch legacy/9.13.1 --recurse-submodules https://github.com/Platinum1154/taskgenius-plugin.git +cd taskgenius-plugin +pnpm install --frozen-lockfile --ignore-scripts +pnpm build:release +node scripts/zip.mjs +``` + +三个发布文件和可选压缩包都在 `dist` 文件夹。`build:release` 会先构建工作区组件,再检查翻译、版本号与 TypeScript,最后生成插件文件。构建不负责发布,也不要求 GitHub token。 + +`packages/calendar` 已固定为官方仍可下载的提交;不要用空目录代替子模块,也不要从其他 fork 拷贝编译产物。 + +## 以后发布下一版 + +例如发布 `9.13.3`,先在维护分支修改: + +- `package.json` 的 `version` 为 `9.13.3`。 +- `manifest.json` 的 `version` 为 `9.13.3`。 +- 在 `versions.json` 中添加 `"9.13.3": "0.15.2"`;最低 Obsidian 版本沿用 manifest 的实际值。 + +提交并推送这些更改,再重新构建。创建 Release 时也使用 `9.13.3`,上传这次新构建的附件。只改 Release 标题或标签,不会改变插件文件中的版本号。 + +标签推送还会运行仓库的 Release workflow;它会核对版本、构建并上传附件。网页上传仍可直接提供本地验证过的构建文件。CI 会保留原版完整测试的真实结果,不会为通过检查而跳过既有失败用例。 + +这条旧版维护分支没有更改默认分支。若通过 `release-it` 发布,原有脚本限制分支为 master;请按本指南的构建及网页发布步骤操作。 diff --git a/VALIDATION.zh-CN.md b/VALIDATION.zh-CN.md new file mode 100644 index 000000000..9b8e1a3e6 --- /dev/null +++ b/VALIDATION.zh-CN.md @@ -0,0 +1,37 @@ +# 验证记录:旧布局 9.13.2 + +基线:官方 9.13.1 标签,提交 `7d8e83bddfa4e8ba95de4be40247ee38d42658b8`。新增实现未移植 zm4341 fork 的改动。 + +## 通过的检查 + +- `pnpm build:release`:工作区组件构建、翻译检查、版本一致性检查、TypeScript 检查与生产打包通过。 +- 设置检查覆盖 1,800 个英文/中文条目,插值占位符一致。新增翻译来自此次旧版补齐工作。 +- 新增 4 组、18 项回归测试全部通过,覆盖中文/英文文本、空任务处理、右键状态切换、嵌套设置变更、失败重试与顺序处理。 +- `node scripts/zip.mjs`:成功生成发布压缩包。 +- `git diff --check`:通过。 + +## 全量测试的实际结果 + +相同依赖环境下分别运行未修改的 9.13.1 与本 PR: + +| 项目 | 原版 9.13.1 | 本 PR | +| --- | ---: | ---: | +| 通过测试 | 1,331 | 1,350 | +| 失败测试 | 147 | 146 | +| 失败测试套件 | 38 | 38 | + +按测试完整名称比较,本 PR 新增失败为 0。原版有一项性能阈值测试在本次通过,结果可能有时序波动,不将其视为已修复的问题。原有失败包括主动抛错的调试测试及旧测试夹具问题;本次没有删除、跳过或放宽这些测试来制造全绿结果。 + +因此,完整测试套件**尚未全绿**。CI 继续展示真实结果。发布前请先试用本源码构建的插件文件。 + +## 界面验证的范围 + +本次翻译补充曾在运行中的旧版 Obsidian 插件中用原生设置渲染器检查全部 26 页:当前配置与展开选项各一轮,共 52 次渲染、569 行设置;普通文案无英文残留,主题/客户端名称及格式示例保留原文。 + +上述界面验证使用的是旧版本地补丁。本 PR 是从官方标签重新整理的源码构建,且为修复不可获取的依赖提交而更新了 calendar 固定版本;没有用新的构建覆盖正在使用的 Obsidian。源码构建仍需要安装试用,不能把先前界面验证当成这个新构建的完整人工验收。 + +## 依赖与发布 + +原版 calendar 固定提交 `3107a754e650b64cb5dd68101ebbad99ac422f27` 已无法从官方仓库取得。本 PR 固定到官方可获取的 `3cb570633ae01ab569b26a956639fc167da398ba`,并明确构建工作区包,使构建可以重现。 + +版本元数据已统一为 `9.13.2`。没有创建或发布 GitHub Release。自行发布说明见 [RELEASING.zh-CN.md](RELEASING.zh-CN.md)。 diff --git a/manifest.json b/manifest.json index fa2b10c63..0bdea569e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "id": "obsidian-task-progress-bar", "name": "Task Genius", - "version": "9.13.1", + "version": "9.13.2", "minAppVersion": "0.15.2", "description": "Comprehensive task management that includes progress bars, task status cycling, and advanced task tracking features.", "author": "Boninall", "authorUrl": "https://github.com/Quorafind", "isDesktopOnly": false -} \ No newline at end of file +} diff --git a/package.json b/package.json index 781e2d9a3..6721acb02 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "task-genius", - "version": "9.13.1", + "version": "9.13.2", "description": "Comprehensive task management plugin for Obsidian with progress bars, task status cycling, and advanced task tracking features.", "main": "main.js", "scripts": { "dev": "node esbuild.config.mjs", - "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", + "build": "pnpm check:i18n && pnpm check:release && tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", "version": "node version-bump.mjs && git add manifest.json manifest-beta.json versions.json", "e-t": "cross-env node scripts/extract-translations.cjs", "g-l": "cross-env node scripts/generate-locale-files.cjs", @@ -22,7 +22,10 @@ "release:beta:patch": "node scripts/smart-beta-release.mjs patch", "release:beta:minor": "node scripts/smart-beta-release.mjs minor", "release:beta:major": "node scripts/smart-beta-release.mjs major", - "release:beta:dry": "node scripts/smart-beta-release.mjs --dry-run" + "release:beta:dry": "node scripts/smart-beta-release.mjs --dry-run", + "check:i18n": "node scripts/check-settings-i18n.cjs", + "check:release": "node scripts/check-release-version.cjs", + "build:release": "pnpm --filter esbuild-plugin-inline-worker build && pnpm --filter @taskgenius/calendar build && pnpm build" }, "keywords": [ "obsidian", @@ -80,5 +83,6 @@ "regexp-match-indices": "^1.0.2", "rrule": "^2.8.1", "sortablejs": "^1.15.6" - } + }, + "packageManager": "pnpm@10.26.0" } diff --git a/packages/calendar b/packages/calendar index 3107a754e..3cb570633 160000 --- a/packages/calendar +++ b/packages/calendar @@ -1 +1 @@ -Subproject commit 3107a754e650b64cb5dd68101ebbad99ac422f27 +Subproject commit 3cb570633ae01ab569b26a956639fc167da398ba diff --git a/scripts/check-release-version.cjs b/scripts/check-release-version.cjs new file mode 100644 index 000000000..c13f55df2 --- /dev/null +++ b/scripts/check-release-version.cjs @@ -0,0 +1,8 @@ +const fs = require("fs"); +const pkg = JSON.parse(fs.readFileSync("package.json", "utf8")); +const manifest = JSON.parse(fs.readFileSync("manifest.json", "utf8")); +const versions = JSON.parse(fs.readFileSync("versions.json", "utf8")); +const expected = process.argv[2]; +if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(manifest.version) || pkg.version !== manifest.version || versions[manifest.version] !== manifest.minAppVersion || (expected && expected !== manifest.version)) { + console.error("Release version mismatch: package.json, manifest.json, versions.json and the release tag must agree."); process.exitCode = 1; +} else console.log("Release files agree on version " + manifest.version); diff --git a/scripts/check-settings-i18n.cjs b/scripts/check-settings-i18n.cjs new file mode 100644 index 000000000..5fa995511 --- /dev/null +++ b/scripts/check-settings-i18n.cjs @@ -0,0 +1,33 @@ +const fs = require("fs"); +const path = require("path"); +const ts = require("typescript"); +const vm = require("vm"); + +function locale(name) { + const filename = path.join("src/translations/locale", name + ".ts"); + const js = ts.transpileModule(fs.readFileSync(filename, "utf8"), { compilerOptions: { module: ts.ModuleKind.CommonJS } }).outputText; + const context = { exports: {} }; vm.runInNewContext(js, context); return context.exports.default; +} +function settingsKeys() { + const keys = new Set(JSON.parse(fs.readFileSync("scripts/settings-i18n-keys.json", "utf8"))); + function visitFile(filename) { + const source = ts.createSourceFile(filename, fs.readFileSync(filename, "utf8"), ts.ScriptTarget.Latest, true); + function visit(node) { + if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && ["t", "settingsText"].includes(node.expression.text) && node.arguments[0] && ts.isStringLiteralLike(node.arguments[0])) keys.add(node.arguments[0].text); + ts.forEachChild(node, visit); + } visit(source); + } + function directory(folder) { for (const entry of fs.readdirSync(folder, { withFileTypes: true })) { const file = path.join(folder, entry.name); if (entry.isDirectory()) directory(file); else if (/\.tsx?$/.test(file)) visitFile(file); } } + directory("src/components/features/settings"); visitFile("src/setting.ts"); return [...keys]; +} +const en = locale("en"), zh = locale("zh-cn"), keys = settingsKeys(); +const tokens = text => (text.match(/\{\{[^{}]+\}\}|\{[A-Za-z_][\w]*\}/g) || []).sort().join("|"); +const errors = []; +for (const key of keys) { + for (const [name, dictionary] of [["en", en], ["zh-cn", zh]]) { + if (typeof dictionary[key] !== "string" || !dictionary[key].trim()) errors.push(name + ": missing " + key); + else if (tokens(key) !== tokens(dictionary[key])) errors.push(name + ": placeholder mismatch " + key); + } +} +if (errors.length) { console.error(errors.slice(0, 25).join("\n")); console.error(errors.length + " settings translation errors"); process.exitCode = 1; } +else console.log("Settings coverage: " + keys.length + " English/Chinese keys; interpolation placeholders match."); diff --git a/scripts/settings-i18n-keys.json b/scripts/settings-i18n-keys.json new file mode 100644 index 000000000..ebf155c5f --- /dev/null +++ b/scripts/settings-i18n-keys.json @@ -0,0 +1,1802 @@ +[ + " (truncated)", + " for more information.", + "# heading", + "(Copy)", + "(Optional) Maximum value for the count", + "(Optional) Minimum value for the count", + "(Optional) Specific text representing completion, leave blank for any non-empty value to be considered completed", + "(Optional) Trigger a notification when this value is reached", + "(Optional) Unit for the count, such as 'cups', 'times', etc.", + "(space)", + "+ Add Custom Cycle", + "+ Add Status", + ", Replacement: ", + "- [ ] Your task here", + "0.0.0.0 (All interfaces - for external access)", + "1 → 2 → 3 → 4 → 5", + "1) Initialize", + "12-hour format (1:30 PM)", + "127.0.0.1 (Local only)", + "2) Call tool with session id", + "24-hour format (13:30)", + "A basic linear workflow with sequential stages", + "A descriptive name for the workflow", + "A descriptive name for the workspace", + "A descriptive name for this workflow stage", + "A descriptive name for your workflow", + "A link to the current file will be added to the parent task of the moved incomplete tasks.", + "A link to the current file will be added to the parent task of the moved tasks.", + "A unique identifier for the stage (used in tags)", + "A unique identifier for the workflow (used in tags)", + "AM (Morning)", + "AND", + "AND NOT", + "API Documentation", + "Abandoned", + "About", + "Academic or professional research workflow", + "Active", + "Active Rules", + "Active strategies: ", + "Add", + "Add Column", + "Add Custom Mapping", + "Add Custom View", + "Add Cycle", + "Add Detailed Cycle", + "Add Detection Method", + "Add File", + "Add File Rule", + "Add Filter Rule", + "Add Folder", + "Add Folder Rule", + "Add ICS Source", + "Add Item", + "Add Metadata Mapping", + "Add New Calendar Source", + "Add New Preset", + "Add New Workflow", + "Add Number Cycle", + "Add Path Mapping", + "Add Pattern", + "Add Pattern Rule", + "Add Simple Cycle", + "Add Sort Criterion", + "Add Stage", + "Add Sub-stage", + "Add Template", + "Add Text Replacement Rule", + "Add a new progress percentage range with custom text", + "Add custom date format patterns. Date patterns: yyyy (4-digit year), yy (2-digit year), MM (2-digit month), M (1-2 digit month), dd (2-digit day), d (1-2 digit day), MMM (short month name), MMMM (full month name). Time patterns: HH (2-digit hour), mm (2-digit minute), ss (2-digit second). Use single quotes for literals (e.g., 'T' for ISO format).", + "Add custom status mappings for your workflow.", + "Add filter", + "Add filter group", + "Add headings to focus on. Only tasks under these headings will be included in indexing. Examples: '## Project', '## Inbox', '# Tasks'", + "Add headings to ignore. Tasks under these headings will be excluded from indexing. Examples: '## Project', '## Inbox', '# Archive'", + "Add metadata fields that indicate a file should be treated as a task (e.g., dueDate, status, priority)", + "Add multiple events that need to be completed", + "Add new event", + "Add new habit", + "Add new mapping", + "Add new range", + "Add occurrence level", + "Add paths that contain task files (e.g., Projects/, Tasks/2024/, Work/TODO/)", + "Add progress bar to Heading", + "Add progress bar to Projects view", + "Add progress bar to non-task bullet", + "Add reward item", + "Add tags that indicate a file should be treated as a task (e.g., #task, #todo, #actionable)", + "Add {{value0}} Theme as New Cycle?", + "Additional stages that can follow this one (for right-click menu)", + "Advanced", + "Advanced Filter", + "Advanced Filtering", + "Advanced Settings", + "Advanced view management features that extend the default Task Genius views with additional functionality.", + "After heading", + "Agenda", + "Agenda View", + "All", + "All Fields", + "All Workspaces", + "All history", + "All settings have been reset to their default values", + "All tasks", + "Allow Task Genius to recognize files as tasks using metadata, tags, or templates.", + "Allow cross-origin requests (required for web clients)", + "Allow files to be recognized and treated as tasks based on their metadata, tags, or file paths. This provides advanced recognition strategies beyond simple metadata parsing.", + "Allow subtasks to inherit metadata from file frontmatter. When disabled, only top-level tasks inherit file metadata", + "Allow tasks to inherit metadata properties from their file's frontmatter", + "Almost there", + "Almost there {{PROGRESS}}%", + "Analysis", + "Any", + "Append", + "Append to file", + "Applied recommended configuration: ", + "Apply", + "Apply Theme", + "Apply {{value0}} Theme?", + "Are you sure you want to delete \"{{name}}\"? This action cannot be undone.", + "Are you sure you want to delete the '{{value0}}' workflow?", + "Are you sure you want to delete the habit ", + "Are you sure you want to delete this calendar source?", + "Are you sure you want to delete this filter configuration?", + "Are you sure you want to delete this text replacement rule?", + "Are you sure you want to force reindex all tasks?", + "Are you sure you want to reset all settings to their default values?\n\nThis action cannot be undone.", + "Arguments:", + "Ascending", + "Ascending respects status order (Overdue first). Descending reverses it.", + "Ascending: A-Z. Descending: Z-A", + "Ascending: Earlier -> Later -> None. Descending: None -> Later -> Earlier", + "Ascending: High -> Low -> None. Descending: None -> Low -> High", + "Authentication", + "Authentication (Optional)", + "Authentication Method", + "Authentication Token", + "Authentication Type", + "Auto Date Manager", + "Auto Update Priority", + "Auto Update Tags", + "Auto complete parent checkbox", + "Auto remove last stage marker", + "Auto-add next task", + "Auto-add task prefix", + "Auto-add timestamp", + "Auto-detect Status Mappings", + "Auto-expand project tree", + "Auto-open on startup", + "Auto-start timer", + "Automatically add a timestamp to the task when it is created", + "Automatically add cancelled dates when tasks are marked as abandoned, and remove them when changed to other statuses.", + "Automatically add completion dates when tasks are marked as completed, and remove them when changed to other statuses.", + "Automatically add start dates when tasks are marked as in progress, and remove them when changed to other statuses.", + "Automatically add task checkbox prefix to captured content", + "Automatically add/remove urgent/important tags when moved between quadrants", + "Automatically convert between metadata status values and task symbols", + "Automatically create a new task with the next stage when completing a task", + "Automatically detect and group holiday events", + "Automatically expand all project nodes when opening the project view in tree mode.", + "Automatically manage dates based on checkbox status changes", + "Automatically map ICS events to specific task statuses", + "Automatically move completed tasks to a default file without manual selection.", + "Automatically move incomplete tasks to a default file without manual selection.", + "Automatically open the timeline sidebar when Obsidian starts.", + "Automatically parse natural language time expressions and specific times (12:00, 1:30 PM, 12:00-13:00)", + "Automatically refresh calendar sources in the background", + "Automatically remove the last stage marker when a task is completed", + "Automatically start the timer when creating a new task via quick capture (checkbox mode only)", + "Automatically sync settings from the Daily Notes plugin", + "Automatically sync with task status configuration", + "Automatically update task priority when moved between quadrants", + "Available Tools", + "Available placeholders: {{COMPLETED}}, {{TOTAL}}, {{IN_PROGRESS}}, {{ABANDONED}}, {{PLANNED}}, {{NOT_STARTED}}, {{PERCENT}}, {{COMPLETED_SYMBOL}}, {{IN_PROGRESS_SYMBOL}}, {{ABANDONED_SYMBOL}}, {{PLANNED_SYMBOL}}", + "Back to main settings", + "Badge", + "Base View", + "Base View Type", + "Based on current date", + "Based on due date", + "Based on scheduled date", + "Based on: ", + "Bases Support", + "Basic", + "Basic Auth", + "Basic Task", + "Bearer Token", + "Bearer token for authenticating MCP requests (keep this secret)", + "Beginning of file", + "Beta Features", + "Beta Features Warning", + "Beta Feedback", + "Beta Test Features", + "Blacklist", + "Blacklist (Exclude)", + "Block References", + "Block reference prefix", + "Both", + "Both graphical and text", + "Bottom Section", + "Bracketed fraction ([3/4])", + "Bracketed percentage ([75%])", + "Built-in View Templates", + "Cache Size", + "Cache TTL", + "Calculate and display the time spent on the task when moving to the next stage", + "Calculate full spent time", + "Calculate spent time", + "Calculate spent time when move to next stage.", + "Calculate the full spent time from the start of the task to the last stage", + "Calendar Sources", + "Calendar Sync", + "Calendar View Configuration", + "Calendar Views", + "Calendar view created: ", + "Calendar view updated: ", + "Can proceed to", + "Cancel", + "Cancelled", + "Cannot enable views without indexer. Please enable the indexer first in Index & Sources settings.", + "Capture as:", + "Capture to:", + "Capture your thoughts...", + "Case Sensitive Matching", + "Categories", + "Category Mapping", + "Chance (%)", + "Chance must be between 0 and 100.", + "Changelog", + "Character to trigger the suggestion menu", + "Character used to separate project hierarchy levels (e.g., '/' in 'Project/SubProject').", + "Characters used to separate time ranges (comma-separated)", + "Chat with us", + "Checkbox Status", + "Checkbox Status Settings", + "Checkbox Switcher", + "Checkbox Tasks", + "Checkbox task indexing disabled. The index will prune inline tasks shortly.", + "Child Tasks", + "Choose a color for this workspace", + "Choose a preset or customize the time range", + "Choose a template to start with or create a custom workflow", + "Choose an icon for this view", + "Choose an icon for this workspace", + "Choose how rewards are displayed when earned.", + "Choose how task marks are displayed: default checkboxes, custom text marks, or Task Genius icons.", + "Choose how to calculate the next date for recurring tasks", + "Choose how to classify tasks into quadrants", + "Choose how to display task progress", + "Choose how to display the task progress", + "Choose the authentication method for client configurations", + "Choose the default display mode for all views. This affects how tasks are displayed when you first open a view or create a new view.", + "Choose the note that should be copied; {{CONTENT}} placeholders are replaced, otherwise the captured text is appended.", + "Choose what type of marker to add to moved incomplete tasks", + "Choose what type of marker to add to moved tasks", + "Choose where this view appears in the sidebar. Views in the bottom section are visually separated from top section views.", + "Choose whether to capture to a fixed file or daily note", + "Choose whether to display projects as a flat list or hierarchical tree by default.", + "Choose whether to include only specified files/folders (whitelist) or exclude them (blacklist)", + "Choose whether to include or exclude tasks that match the filters", + "Choose whether to show or hide tasks that match the filters", + "Choose your preferred interface style and configure how Task Genius displays in your workspace.", + "Claim Reward", + "Classic", + "Classic & Familiar", + "Clear Logs", + "Clear search", + "Clearing task cache and rebuilding index...", + "Click the button above to add your first habit", + "Click the button below to automatically add this MCP server to Cursor:", + "Click to open the timeline sidebar view.", + "Client Configuration", + "Close", + "Coding", + "Collapse/Expand", + "Color", + "Color for events from this source (optional)", + "Color-coded Status", + "Column Title", + "Columns that are currently hidden from view. Click the eye icon to show them again.", + "Combine emoji and dataview syntax as needed", + "Comma-separated list of folder paths where task timer should be enabled", + "Comma-separated list of tags that enable task timer", + "Common Mappings", + "Common Metadata Symbols", + "Complete all moved tasks", + "Completed", + "Completed Task Mover", + "Completed Tasks", + "Completed tasks", + "Completion text", + "Condition (e.g., #tag AND project)", + "Config File-based Project Detection", + "Config file name", + "Configure Custom Date Formats", + "Configure Date Formats", + "Configure Focus Headings", + "Configure Ignore Headings", + "Configure Symbols", + "Configure Task Fields", + "Configure Task Paths", + "Configure Task Tags", + "Configure additional methods to detect project files", + "Configure checkbox status settings", + "Configure custom columns for the selected grouping property", + "Configure custom date format patterns.", + "Configure external calendar sources to display events in your task views.", + "Configure fallback project naming when no explicit project is found", + "Configure file filtering to improve indexing performance and focus on relevant content", + "Configure global filter rules that apply to all Views by default. Individual Views can override these settings.", + "Configure habit settings, including adding new habits, editing existing habits, and managing habit completion.", + "Configure headings to focus on. Only tasks under these headings will be included in indexing.", + "Configure headings to ignore. Tasks under these headings will be excluded from indexing.", + "Configure hidden modules", + "Configure how ICS events are mapped to task statuses", + "Configure how Task Genius discovers and indexes tasks from various sources including inline tasks, file metadata, and projects.", + "Configure how dates and times are displayed in views.", + "Configure how files are recognized as tasks. At least one strategy must be enabled.", + "Configure how holiday events are detected and displayed", + "Configure how metadata fields are mapped and transformed", + "Configure how projects are displayed in tree view.", + "Configure how tasks are parsed from markdown content.", + "Configure how tasks are sorted in the document.", + "Configure how tasks inherit metadata from file frontmatter", + "Configure inline editing and metadata positioning.", + "Configure keywords for date parsing", + "Configure metadata fields that indicate a file should be treated as a task (e.g., dueDate, status, priority)", + "Configure multiple status cycles with different workflows. You can apply preset themes or create custom cycles.", + "Configure options specific to the Fluent interface.", + "Configure paths that contain task files (e.g., Projects/, Tasks/2024/, Work/TODO/)", + "Configure performance-related indexing settings", + "Configure project detection from file frontmatter", + "Configure project detection from project configuration files", + "Configure project display, organization and metadata mappings", + "Configure project names based on file paths", + "Configure rewards for completing tasks. Define items, their occurrence chances, and conditions.", + "Configure rules to modify event text using regular expressions", + "Configure symbols that represent abandoned tasks in square brackets", + "Configure symbols that represent completed tasks in square brackets", + "Configure symbols that represent not started tasks in square brackets. Default is space \" \"", + "Configure symbols that represent planned tasks in square brackets", + "Configure symbols that represent tasks in progress in square brackets", + "Configure system tray, notifications, and desktop features", + "Configure tags that indicate a file should be treated as a task (e.g., #task, #todo, #actionable)", + "Configure task workflows for project and process management", + "Configure the Task Genius sidebar views, visibility, order, and create custom views.", + "Configure the format of time expressions", + "Configure the task gutter.", + "Configure which files and folders to include or exclude from task indexing", + "Configure which files, folders, or patterns are included during task indexing.", + "Configure which modules should be hidden in this workspace. Hidden views will not appear in the sidebar.", + "Configure which task markers to count or exclude", + "Configure workflow templates for different types of processes", + "Connection test failed: ", + "Connection test successful! MCP server is working.", + "Contains match", + "Content", + "Context", + "Context tag prefix", + "Contexts", + "Control which days are displayed in the calendar", + "Copied!", + "Copy", + "Copy Install Link", + "Copy Settings From", + "Copy URL", + "Copy View", + "Copy of ", + "Copy settings from an existing workspace", + "Copy this cycle", + "Copy view: ", + "Core Settings", + "Count habit", + "Count other statuses as", + "Count sub children of current Task", + "Create", + "Create Calendar View", + "Create Custom View", + "Create New Calendar View", + "Create New Workflow", + "Create New Workspace", + "Create Workflow", + "Create a backup of active timers", + "Create a custom view from the templates above to get started.", + "Create a custom workflow from scratch", + "Create a new workspace with custom settings", + "Create and manage preset filters for quick access to commonly used task filters.", + "Create custom calendar views based on Month, Week, or Day views. Each custom view can have its own display settings.", + "Create custom view", + "Create new habit", + "Create task timer backup", + "Created", + "Created Date", + "Creating a copy based on: ", + "Current Events Status", + "Current Workspace", + "Current status management and date management may conflict with the Tasks plugin. Please check the ", + "Currently supports English and Chinese time expressions. More languages may be added in future updates.", + "Custom", + "Custom Calendar Views", + "Custom Columns", + "Custom Content Field", + "Custom Cycle", + "Custom Date Formats", + "Custom Headers", + "Custom Mappings", + "Custom Project Detection Methods", + "Custom Range", + "Custom Selection", + "Custom Workflow", + "Custom date formats", + "Custom days", + "Custom format", + "Custom marker", + "Custom marker text", + "Custom metadata field", + "Custom text marks", + "Customize how dates are displayed in headers", + "Customize progress ranges", + "Customize the prefix used for context tags (e.g., '@home' for @home). Changes require reindexing.", + "Customize the prefix used for context tags in dataview format (e.g., 'context' for [context:: home]). Changes require reindexing.", + "Customize the prefix used for project tags (e.g., 'project' for #project/myproject). Changes require reindexing.", + "Customize the prefix used for project tags in dataview format (e.g., 'project' for [project:: myproject]). Changes require reindexing.", + "Cycle (repeatable)", + "Daily Note", + "Daily Notes plugin is not enabled", + "Daily habit", + "Daily note", + "Daily note folder", + "Daily note format", + "Daily note path", + "Daily note template", + "Daily notes settings synced successfully", + "Daily summary", + "Data Collection", + "Data Management", + "Dataview metadata", + "Date Filter", + "Date Keywords Configuration", + "Date and Time Display", + "Date format for daily notes (e.g., YYYY-MM-DD)", + "Date formats updated. The parser will now recognize these custom formats.", + "Date marker", + "Date marker text", + "Date picker", + "Dates & Priority", + "Day", + "Day Filter", + "Day Header Format", + "Day View", + "Days to Show", + "Debug", + "Default", + "Default AM/PM Period", + "Default Archive File", + "Default Archive Section", + "Default Cycle", + "Default Event Color", + "Default Project Naming", + "Default Task Status", + "Default checkboxes", + "Default color for events without a specific color", + "Default field to sort tasks by within each column.", + "Default file for archive action", + "Default file name template", + "Default file to move completed tasks to (e.g., 'Archive.md')", + "Default file to move incomplete tasks to (e.g., 'Backlog.md')", + "Default folder for new files", + "Default format preference for ambiguous time expressions", + "Default heading name", + "Default heading name for incomplete tasks", + "Default insertion mode", + "Default insertion mode for incomplete tasks", + "Default order to sort tasks within each column.", + "Default period when AM/PM is ambiguous in 12-hour format", + "Default project view mode", + "Default refresh interval for all sources (minutes)", + "Default section for archive action", + "Default settings", + "Default sort field", + "Default sort order", + "Default status for newly created file tasks", + "Default target file", + "Default target file for incomplete tasks", + "Default title for the right column (tasks list)", + "Default view mode", + "Default workspace", + "Default workspace cannot be deleted", + "Define cycle sub-stages (optional)", + "Define different levels of reward rarity and their probability.", + "Define mappings from numeric values to display text", + "Define progress ranges and their corresponding text representations.", + "Define the order in which tasks should be sorted. Criteria are applied sequentially.", + "Define the statuses in cycling order", + "Delegate - Interruptions & distractions", + "Delete", + "Delete Filter Configuration", + "Delete Level", + "Delete View", + "Delete Workspace", + "Delete habit", + "Delete item", + "Delete reward item", + "Delete rule", + "Delete this calendar source", + "Delete this cycle", + "Delete this item", + "Delete workflow", + "Descending", + "Describe the purpose and use of this workflow...", + "Describe your workflow...", + "Description", + "Descriptive name for this replacement rule", + "Desktop Integration", + "Desktop integration features are only available in the desktop app", + "Desktop only", + "Detailed", + "Detailed ([3✓ 1⟳ 0✗ 1? / 5])", + "Details", + "Detect project from file frontmatter metadata", + "Detect project from project configuration files", + "Detected features: ", + "Detection Patterns", + "Development", + "Disable", + "Disable this source", + "Disabled", + "Discord", + "Display", + "Display & Progress", + "Display a full year with 12 mini-month calendars", + "Display days with no events", + "Display event count badges on date cells", + "Display name for this calendar source", + "Display name for this calendar view", + "Display name of the habit", + "Display project folders even if they don't contain any tasks.", + "Display tasks for a single day with detailed time slots", + "Display tasks in a monthly calendar grid", + "Display tasks in a weekly time grid with hourly slots", + "Display timer usage statistics", + "Display upcoming tasks in a list format grouped by day", + "Display week numbers in the month view", + "Do First - Crisis & emergencies", + "Documentation", + "Donate", + "Done", + "Drag to reorder", + "Drag views between sections or within sections to reorder them. Toggle visibility with the eye icon.", + "Drink a cup of good tea", + "Due", + "Due Date", + "Due Date Keywords", + "Due Dates", + "Due date", + "Duplicate", + "Duplicate filter group", + "Eat a piece of chocolate", + "Edit", + "Edit Calendar View", + "Edit File Filter Rules", + "Edit Filter", + "Edit Filter: ", + "Edit ICS Source", + "Edit Stage", + "Edit Text Replacement Rule", + "Edit View", + "Edit Workflow", + "Edit habit", + "Edit this calendar source", + "Edit view: ", + "Edit workflow", + "Editor Configuration", + "Eliminate - Time wasters", + "Emoji Progress Bar", + "Emoji metadata", + "Empty state text", + "Enable", + "Enable Background Refresh", + "Enable Base View", + "Enable Base View functionality. This feature provides enhanced view management capabilities but may be affected by future Obsidian API changes.", + "Enable Base View functionality. This feature provides enhanced view management capabilities but may be affected by future Obsidian API changes. You may need to restart Obsidian to see the changes.", + "Enable CORS", + "Enable File Filter", + "Enable File Task", + "Enable Holiday Detection", + "Enable Indexer", + "Enable MCP Server", + "Enable OnCompletion", + "Enable Status Mapping", + "Enable Task Filter", + "Enable Task Genius Views", + "Enable Task Genius Views above to configure view settings.", + "Enable Task Genius sidebar views to display and manage tasks. Requires the indexer to be enabled.", + "Enable Task Sorting", + "Enable Task Timer", + "Enable Time Filter", + "Enable Time Parsing", + "Enable Timeline Sidebar", + "Enable auto date manager", + "Enable auto-move for completed tasks", + "Enable auto-move for incomplete tasks", + "Enable automatic actions when tasks are completed", + "Enable case-sensitive matching for status values", + "Enable checkbox status switcher", + "Enable checkbox tasks", + "Enable completed task mover", + "Enable config file project detection", + "Enable custom date format patterns for parsing dates. When enabled, the parser will try your custom formats before falling back to default formats.", + "Enable custom date formats", + "Enable cycle complete status", + "Enable date picker", + "Enable default project naming", + "Enable dynamic metadata positioning", + "Enable file metadata inheritance", + "Enable file tasks", + "Enable focus mode by default, which highlights today's events and dims past/future events.", + "Enable habits", + "Enable incomplete task mover", + "Enable inline editing of task content and metadata directly in task views. When disabled, tasks can only be edited in the source file.", + "Enable inline editor", + "Enable metadata project detection", + "Enable minimal mode", + "Enable notifications", + "Enable path-based, metadata-based, and config file-based project detection", + "Enable priority keyboard shortcuts", + "Enable priority picker", + "Enable progress bar in reading mode", + "Enable project features", + "Enable quick capture", + "Enable rewards", + "Enable simplified single-line quick capture with inline suggestions", + "Enable task gutter", + "Enable task timer functionality for tracking time spent on tasks", + "Enable text mark in source mode", + "Enable this source", + "Enable worker processing", + "Enable workflow", + "Enable/disable the ability to automatically cycle through task states when pressing a mark.", + "Enable/disable the ability to cycle through task states by clicking.", + "Enable/disable this cycle", + "Enabled", + "Enabled:", + "End Hour", + "End of file", + "Enhanced", + "Enter a description for this filter configuration (optional)", + "Enter a name for this filter configuration", + "Enter a task using any of the formats shown above", + "Enter any Lucide icon name (e.g., list-checks, filter, inbox)", + "Enter date format (e.g., yyyy-MM-dd or yyyyMMdd_HHmmss)", + "Enter details for {{value0}}...", + "Enter file name...", + "Enter heading (e.g., ## Inbox)", + "Enter heading (e.g., ## Tasks)", + "Enter metadata field name", + "Enter metadata key (e.g., project-name)", + "Enter metadata value and symbol (e.g., 'done:x')", + "Enter new name", + "Enter path (e.g., Projects/, Tasks/**/*.md)", + "Enter tag (e.g., #task)", + "Enter template...", + "Enter text to test the replacement rule", + "Enter value", + "Enter workflow name", + "Enter workspace name", + "Error", + "Error loading statistics", + "Error rendering format", + "Error:", + "Error: View ID already exists.", + "Event", + "Event categories that indicate holidays (one per line)", + "Event details", + "Event name", + "Event name cannot be empty", + "Events", + "Exact match", + "Example", + "Example Request", + "Examples", + "Examples of advanced formats using expressions", + "Examples of time expressions", + "Examples:", + "Exclude Archive Folder", + "Exclude Temporary Files", + "Exclude specific task markers", + "Experimental features that are currently in testing phase. These features may be unstable and could change or be removed in future updates.", + "Export all timer data to JSON", + "Export task timer data", + "Export task timer data (YAML)", + "Export to YAML format", + "Expression examples", + "Failed to delete filter configuration", + "Failed to force reindex tasks", + "Failed to load filter configuration", + "Failed to load tools. Is the MCP server running?", + "Failed to open quick capture. Please try again later.", + "Failed to reindex tasks", + "Failed to restart server: ", + "Failed to save filter configuration", + "Failed to sync daily notes settings", + "Failed to sync mapping", + "Features to be enabled", + "Field name in frontmatter to check for enabling task timer (e.g., 'task-timer: true')", + "File", + "File Content", + "File Creation Mode", + "File Filter", + "File Filter Mode", + "File Filter Rules", + "File Metadata Inheritance", + "File Name", + "File Path", + "File Task is disabled", + "File Task is enabled and monitoring files", + "File Tasks", + "File filtering helps you focus on relevant content while improving performance, especially in large vaults.", + "File task recognition disabled. Existing file tasks will be pruned shortly.", + "File tasks are disabled. Enable them to configure recognition strategies.", + "FileSource status mapping synced", + "Filename", + "Files", + "Filter Configuration Description", + "Filter Configuration Name", + "Filter Mode", + "Filter Rules", + "Filter Summary", + "Filter Tasks", + "Filter blanks", + "Filter configuration deleted successfully", + "Filter configuration loaded successfully", + "Filter configuration name is required", + "Filter configuration saved successfully", + "Filter files during task indexing to improve performance", + "Filter name", + "Filter out blank tasks in this view.", + "Filter query", + "First Day of Week", + "First H1 heading", + "First day of week", + "First hour to display (0-23)", + "Fixed file", + "Flagged", + "Fluent", + "Fluent Interface Settings", + "Focus all tasks behind heading", + "Focus mode by default", + "Focus on Projects", + "Folder", + "Folder path for daily notes (leave empty for root)", + "Folder paths", + "Folder that contains Quick Capture templates for File mode.", + "Force a complete rebuild of the task index. Use this if you notice missing or incorrect tasks.", + "Forecast", + "Format Examples:", + "Format Pattern", + "Format for day headers (e.g., dddd, MMMM D)", + "Format for day view header (e.g., yyyy'年'M'月'd'日')", + "Format for grouped holiday display. Use {title}, {count}, {startDate}, {endDate}", + "Format for month view header (e.g., yyyy M)", + "Format for spent time:", + "Fraction (3/4)", + "Friday", + "Frontmatter field", + "Frontmatter title", + "Full project workflow", + "Full year", + "Future Events Status", + "Gamification", + "General", + "Glob pattern (e.g., Projects/**/*.md)", + "Global Filter Configuration", + "Global Refresh Interval", + "Global Settings", + "Good progress", + "Good progress {{PROGRESS}}%", + "Graphical progress bar", + "Group Display Format", + "Group by", + "Group by task property", + "Grouping Strategy", + "Habit", + "Habit added", + "Habit deleted", + "Habit name", + "Habit type", + "Habit updated", + "Habit with multiple events", + "Habits", + "Half way", + "Half way {{PROGRESS}}%", + "Heading filters updated. Rebuild the task index to apply to existing tasks.", + "Heading name to insert incomplete tasks after (will be created if it doesn't exist)", + "Heading name to insert tasks after (will be created if it doesn't exist)", + "Help improve these features by providing feedback on your experience.", + "Hidden Columns", + "Hidden Days", + "Hidden Modules Configuration", + "Hide", + "Hide Empty Quadrants", + "Hide Weekends", + "Hide by folders", + "Hide by metadata", + "Hide by tags", + "Hide columns that have no tasks.", + "Hide completed and abandoned tasks", + "Hide completed and abandoned tasks in this view.", + "Hide empty columns", + "Hide from sidebar", + "Hide matching tasks", + "Hide progress bars", + "Hide progress bars based on conditions", + "Hide quadrants that have no tasks", + "Hide weekend columns (Saturday and Sunday) in calendar views.", + "Hide weekend columns (Saturday and Sunday) in forecast calendar.", + "Hide weekends", + "High", + "High priority", + "Higher priority", + "Highest", + "Highest priority", + "Holiday Configuration", + "Holiday Status", + "Host", + "Host changed to 0.0.0.0. Server is now accessible from external networks.", + "How long to keep cached data (hours)", + "How often to refresh this source (minutes)", + "How paths should be matched", + "How tags should be matched against file tags", + "How to add captured content to the target location", + "How to display events from this source in calendar views", + "How to handle consecutive holiday events", + "How to handle time ranges that cross midnight (e.g., 23:00-01:00)", + "How to use", + "ICS Auth None", + "ICS Bearer Token", + "ICS Calendar Integration", + "ICS Disabled", + "ICS Enabled", + "ICS Password", + "ICS Source Name", + "ICS URL", + "ICS Username", + "Icon", + "Icon name", + "If enabled, #tags in the editor content are written into YAML frontmatter tags (merged and deduplicated)", + "If enabled, abandoned tasks will be treated as completed.", + "If enabled, all moved tasks will be marked as completed.", + "If enabled, the daily note path will be used as the date for tasks.", + "If you encounter any issues with beta features, please report them to help improve the plugin.", + "If you like this plugin, consider donating to support continued development:", + "Ignore all tasks behind heading", + "Ignore system and temporary files", + "Image not found:", + "Image url (optional)", + "Import task timer data", + "Import timer data from JSON file", + "Important Priority Threshold", + "Important Tag", + "In Progress", + "In progress", + "In progress tasks", + "Inbox", + "Include Abandoned Tasks", + "Include Child Tasks", + "Include Completed Tasks", + "Include In Progress Tasks", + "Include Not Started Tasks", + "Include Parent Tasks", + "Include Planned Tasks", + "Include Related Tasks", + "Include Sibling Tasks", + "Include all-day events from this source", + "Include completed tasks in the timeline view. When disabled, only incomplete tasks will be shown.", + "Include or exclude tasks based on their status", + "Include parent, child, and sibling tasks in the filter", + "Include task creation guide", + "Include time", + "Include timed events from this source", + "Incomplete Task Mover", + "Incomplete Tasks", + "Incomplete custom marker text", + "Incomplete date marker text", + "Incomplete task marker type", + "Incomplete tasks", + "Incomplete version marker text", + "Index & Sources", + "Index & Task Source Configuration", + "Index Maintenance", + "Index markdown checkbox tasks. Disable this if you only want to use file-based or external task sources.", + "Index only specific project folders", + "Info", + "Information", + "Inherit from frontmatter", + "Inherit from frontmatter for subtasks", + "Inline", + "Inline task parsing", + "Input: ", + "Integration", + "Intelligently position task metadata. When enabled, metadata appears on the same line as short tasks and below long tasks. When disabled, metadata always appears below the task content.", + "Interface", + "Interface Mode", + "Interface Style", + "Invalid inventory number.", + "Invalid regular expression pattern", + "Inventory (-1 for ∞)", + "Items", + "JSON object with custom headers", + "Just started", + "Just started {{PROGRESS}}%", + "Keep open after capture", + "Keep the familiar interface and interaction style you know", + "Keep the modal open after capturing content", + "Keywords", + "Keywords that indicate due dates (comma-separated)", + "Keywords that indicate scheduled dates (comma-separated)", + "Keywords that indicate start dates (comma-separated)", + "Keywords to detect in event text (one per line)", + "Last hour to display (0-23)", + "Last month", + "Last updated: {{date}}", + "Last week", + "Last year", + "Learn the different ways to create and format tasks in Task Genius. You can use either emoji-based or Dataview-style syntax.", + "Left column title", + "Legacy", + "Level Name (e.g., common)", + "Line Number", + "Linear (sequential)", + "Link Filter", + "Linked Note", + "List View", + "Literature Review", + "Load", + "Load Filter Configuration", + "Load Saved Filter", + "Loading tools...", + "Locale Default", + "Location", + "Log Level", + "Logging verbosity for debugging", + "Low", + "Low priority", + "Lower priority", + "Lowest", + "Lowest priority", + "MCP Integration", + "MCP Server Logs", + "MCP Server Status", + "MCP Server enabled. Keep your authentication token secure!", + "MCP Server not initialized", + "MCP integration is only available on desktop", + "MCP server is not running", + "MCP server restarted", + "Make the text mark in source mode follow the checkbox status cycle when clicked.", + "Making progress", + "Making progress {{PROGRESS}}%", + "Manage Views", + "Manage Workspaces...", + "Manage cancelled dates", + "Manage completion dates", + "Manage file name templates for quick selection in File mode", + "Manage start dates", + "Manage the specific rewards that can be obtained.", + "Manage workspaces to organize different contexts with their own settings and filters.", + "Manual Configuration", + "Manually refresh filter statistics to see current data", + "Map between human-readable metadata values (e.g., 'completed') and task symbols (e.g., 'x').", + "Map specific categories to statuses (format: category:status, one per line)", + "Mapping", + "Mapping habit", + "Mapping key must be a number", + "Mark", + "Mark parent as 'In Progress' when partially complete", + "Match", + "Matrix", + "Max Events Per Row", + "Max Events Per Source", + "Max other views before overflow", + "Max percentage (0-100)", + "Maximum Cache Age", + "Maximum Gap Days", + "Maximum days between events to consider them consecutive", + "Maximum events to show", + "Maximum events to show per day cell before showing '+N more'", + "Maximum number of events to display in the timeline. Higher numbers may affect performance.", + "Maximum number of events to load from each source", + "Maximum value", + "Medium", + "Medium priority", + "Meeting", + "Metadata", + "Metadata Detection", + "Metadata Mappings", + "Metadata Property", + "Metadata Value", + "Metadata field to use as project name", + "Metadata key", + "Metadata-based Project Detection", + "Metadata-based Recognition", + "Method", + "Method A (Custom Header):", + "Method A: Custom Headers", + "Method B (Combined Bearer):", + "Method B: Combined Bearer (Recommended)", + "Midnight Crossing Behavior", + "Migrated from legacy settings", + "Min percentage (0-100)", + "Minimal Mode", + "Minimum value", + "Missed", + "Mixed Format", + "Modal dialog", + "Modern", + "Modern & Sleek", + "Mon first", + "Monday", + "Month", + "Month Header Format", + "Month View", + "Move Down", + "Move Up", + "Move down", + "Move up", + "Multi-select Text", + "My Calendar", + "My Custom Task View", + "My Custom View", + "NOR", + "Name and ID are required.", + "Name of the metadata field to use as task content", + "Name of the project configuration file", + "Naming strategy", + "Network Timeout", + "New Calendar View", + "New Column", + "New Filter", + "New Level", + "New Name", + "New Preset", + "New Reward", + "New Sub-stage", + "New Workflow", + "New custom view", + "New token generated", + "New visual design with elegant animations and modern interactions", + "Next day (23:00 today - 01:00 tomorrow)", + "Next stage", + "Next: ", + "No additional destination stages defined.", + "No available port found in range", + "No calendar sources configured. Add a source to get started.", + "No changes to save", + "No custom calendar views yet", + "No custom columns defined. Add columns below.", + "No filter rules configured yet", + "No habits yet", + "No items configured. Click 'Add Item' to get started.", + "No items selected", + "No levels defined", + "No logs match your search.", + "No logs yet. Tool calls will appear here.", + "No markdown notes were found in the selected folder.", + "No metadata mappings configured yet.", + "No path mappings configured yet.", + "No preset filters created yet. Click 'Add New Preset' to create one.", + "No priority", + "No progress indicators", + "No reward items defined yet.", + "No saved filter configurations", + "No settings found", + "No sort criteria defined. Add criteria below.", + "No stages defined yet. Add a stage to get started.", + "No stages defined. Choose a template or add stages manually.", + "No sub-stages defined yet.", + "No text replacement rules configured", + "No tools available", + "No weekends", + "No workflow definitions created yet. Click 'Add New Workflow' to create one.", + "None", + "Not Started", + "Not Urgent & Important", + "Not Urgent & Not Important", + "Not started", + "Note:", + "Notes", + "Notice (Auto-accept)", + "Notice threshold", + "Notify shortly before each task's due time", + "Number of 'Other Views' to show before grouping the rest into an overflow menu (ellipsis)", + "Number of days to display in the agenda", + "Numeric progress tracking", + "OR", + "Occurrence levels", + "On Completion", + "Onboarding", + "Only count specific task markers", + "Only show certain hours of the day", + "Open Discord", + "Open Documentation", + "Open Timeline", + "Open Timeline Sidebar", + "Open in external browser", + "Optimize Performance", + "Optional description for the workflow", + "Optional description of the workflow purpose", + "Optional habit description", + "Optional heading to append content under (leave empty to append to file)", + "Optional rules based on event properties (higher priority than timing rules)", + "Optional: Only match links containing this text", + "Other Views", + "Output: ", + "Override ICS Status", + "Override original ICS event status with mapped status", + "Overrides the locale default for calendar views.", + "Overrides the locale default for forecast views.", + "PM (Afternoon/Evening)", + "Parent Tasks", + "Past Events Status", + "Path Matching Mode", + "Path pattern (e.g., Projects/Work)", + "Path-based Project Mappings", + "Path-based Recognition", + "Path:", + "Paths", + "Pattern", + "Pattern (Regular Expression)", + "Pattern: ", + "Per-task reminders", + "Percentage (75%)", + "Performance", + "Performance Configuration", + "Placeholder text", + "Placeholder text to display in the capture panel", + "Plan", + "Planned", + "Planning", + "Play a game", + "Please add at least one event", + "Please add at least one mapping value", + "Please add at least one stage to the workflow", + "Please enter a URL for the source", + "Please enter a habit name", + "Please enter a name", + "Please enter a name for the rule", + "Please enter a name for the source", + "Please enter a pattern", + "Please enter a property name", + "Please enter a task to validate", + "Please enter a valid URL", + "Please enter a workspace name", + "Please enter details", + "Please enter text for all mapping values", + "Please provide a workflow name and ID", + "Please restart Obsidian for the Indexer change to take effect.", + "Populate FileSource status mapping from your checkbox status configuration", + "Port", + "Port updated to ", + "Practice Task", + "Practice creating a task with the format you prefer:", + "Prefer Frontmatter Title", + "Prefer metadata format of task", + "Preferred Time Format", + "Prefix (e.g., Projects/ matches Projects/App.md)", + "Prefix for generated block reference IDs (e.g., 'timer' creates ^timer-123456-7890)", + "Prefix match", + "Prepend", + "Preset", + "Preset Filters", + "Preset filters", + "Preset name", + "Preset saved", + "Preview", + "Preview of workflow stages (edit after creation for advanced options)", + "Preview:", + "Priorities", + "Priority", + "Priority A", + "Priority B", + "Priority C", + "Priority Picker Settings", + "Progress Display", + "Progress Ranges", + "Progress Tracker", + "Progress bar", + "Progress display mode", + "Progress format", + "Project", + "Project Management", + "Project Tree View Settings", + "Project Workflow", + "Project name", + "Project path separator", + "Project tag prefix", + "Project tags", + "Project/tag", + "Projects", + "Projects List", + "Property Rules", + "Property name", + "Published", + "Quadrant Classification Method", + "Query", + "Quick Add Rules", + "Quick Capture", + "Quick Install", + "Quick Name Templates", + "Quick TODO/DONE cycle", + "Quick Templates", + "Quick Workflow Creation", + "Quick capture", + "Quick capture is now enabled in your configuration!", + "Quickly add common workflow patterns", + "Range", + "Range-based text", + "Rebuild", + "Rebuild index", + "Recognition Strategies", + "Recognize files as tasks based on their file path", + "Recognize files as tasks if they have specific frontmatter fields", + "Recognize files as tasks if they have specific tags", + "Recommended Configurations", + "Record Details for {{value0}}", + "Record numeric values, e.g., how many cups of water", + "Recurrence", + "Recurrence date calculation", + "Recurring task", + "Refresh", + "Refresh Interval", + "Refresh Statistics", + "Refreshing...", + "Regenerate", + "Regex Flags", + "Regex patterns to match in event titles (one per line)", + "Regular expression (advanced)", + "Regular expression flags (e.g., 'g' for global, 'i' for case-insensitive)", + "Regular expression pattern to match. Use parentheses for capture groups.", + "Reindex", + "Related Tasks", + "Remember last mode", + "Remember the last used quick capture mode", + "Remove", + "Remove Column", + "Remove Criterion", + "Remove Meeting Prefix", + "Remove Original Time Expressions", + "Remove file extension from filename when using as project name", + "Remove filter", + "Remove filter group", + "Remove parsed time expressions from the task text", + "Remove prefix", + "Remove stage", + "Remove the .md extension from filename when using as task content", + "Remove the timestamp from the current task when moving to the next stage", + "Remove this status", + "Remove timestamp when moving to next stage", + "Remove workflow", + "Rename", + "Rename Workspace", + "Replace", + "Replace room numbers", + "Replacement", + "Report Issue", + "Report Issues", + "Request timeout in seconds", + "Requests", + "Require All Fields", + "Require all specified fields to be present (otherwise any field is sufficient)", + "Research Process", + "Reset", + "Reset All Settings", + "Reset Columns", + "Reset Settings", + "Reset all settings to their default values", + "Reset progress ranges to default values", + "Reset to Default Presets", + "Reset to Defaults", + "Reset to defaults", + "Restart", + "Restart Onboarding", + "Restart Server", + "Restart the welcome guide and setup wizard", + "Result:", + "Review", + "Review Projects", + "Review Your Configuration", + "Review the settings that will be applied for your selected mode", + "Reward Name/Text", + "Reward display type", + "Reward items", + "Rewards", + "Right column title", + "Root condition", + "Rule Name", + "Rule {{value0}}", + "Running", + "Same day (treat as error)", + "Sat first", + "Saturday", + "Save", + "Save Current Filter", + "Save Filter Configuration", + "Saved. Reopen the view to apply.", + "Scan now", + "Schedule - Planning & development", + "Scheduled", + "Scheduled Date", + "Scheduled Date Keywords", + "Scheduled Dates", + "Scheduled date", + "Scheduled events", + "Scheduled habit", + "Scope:", + "Search logs...", + "Search results", + "Search settings", + "Search settings...", + "Security Warning", + "Select a predefined checkbox status collection or customize your own", + "Select a preset...", + "Select a project to review its tasks.", + "Select a project to see related tasks", + "Select a saved filter configuration", + "Select a saved filter preset to apply", + "Select a tag to see related tasks", + "Select a template folder above to enable the dropdown.", + "Select a template...", + "Select between the modern Fluent interface or the classic Legacy interface.", + "Select target field", + "Select the folder that contains the daily note.", + "Select the interface style to use.", + "Select the status to count other statuses as. Default is \"Not Started\".", + "Select the type of view to create", + "Select which days to hide from the calendar", + "Select which task property to use for creating columns", + "Select which task property to use for left column grouping", + "Selected folder was not found in the vault.", + "Send now", + "Send one notification for today's due tasks at a specific time (HH:mm)", + "Server Actions", + "Server Configuration", + "Server Endpoint", + "Server host address. Use 127.0.0.1 for local only, 0.0.0.0 for all interfaces", + "Server port number (default: 7777)", + "Set value", + "Show", + "Show Advanced Options", + "Show All Days", + "Show All Events", + "Show All-Day Events", + "Show Empty Days", + "Show Event Counts", + "Show First Day Only", + "Show First and Last", + "Show Summary", + "Show Timed Events", + "Show Type", + "Show Week Numbers", + "Show a bell with count in system tray, status bar, or both", + "Show a checkbox for each task in the kanban view.", + "Show a quick tutorial on creating your first task", + "Show advanced configuration options in task editors", + "Show changelog after plugin updates", + "Show checkbox", + "Show completed tasks", + "Show empty project folders", + "Show error", + "Show in Calendar", + "Show in Forecast", + "Show in sidebar", + "Show indicator with checkbox", + "Show matching tasks", + "Show percentage", + "Show progress bars based on heading", + "Show project progress in Projects header", + "Show task timer statistics", + "Show the status indicator directly next to the checkbox. When enabled, a indicator will be shown next to the checkbox.", + "Sibling Tasks", + "Sidebar Components", + "Sidebar Position", + "Simple", + "Simple Linear Workflow", + "Simple daily check-in habit", + "Skip", + "Skip archived content", + "Sort Criteria", + "Source key (e.g., proj)", + "Specific task markers to count", + "Specify folder paths that will hide progress bars (comma-separated). Example: \"Daily Notes,Projects/Hidden\"", + "Specify frontmatter metadata that will hide progress bars. Example: \"hide-progress-bar: true\"", + "Specify tags that will hide progress bars (comma-separated, without #). Example: \"no-progress-bar,hide-progress\"", + "Specify task markers to exclude from counting. Example: \"?|/\"", + "Specify which task markers to count. Example: \"x|X|>|/\"", + "Spent time format", + "Stage ID", + "Stage name", + "Stage type", + "Standard project management workflow", + "Standard task lifecycle with all states", + "Standard view", + "Start", + "Start Date", + "Start Date Keywords", + "Start Dates", + "Start Hour", + "Start date", + "Start the MCP server to allow external tool connections", + "Statistics", + "Status", + "Status Cancelled", + "Status Complete", + "Status Cycles Management", + "Status In Progress", + "Status Incomplete", + "Status Mapping", + "Status Question", + "Status bar", + "Status for events detected as holidays", + "Status for events happening today", + "Status for events in the future", + "Status for events that have already ended", + "Status mappings work with your Task Status Settings. ", + "Status name", + "Status sequence", + "Status with Icons", + "Stop and restart the MCP server", + "Stopped", + "Strategy for generating default project names", + "Strip File Extension", + "Strip file extension", + "Sub-stage", + "Sub-stage ID", + "Sub-stage name", + "Sub-stages", + "Submit", + "Suggest trigger character", + "Summary Patterns", + "Summary/Title", + "Sunday", + "Support expression in format, like using data.percentages to get the percentage of completed tasks. And using math or even repeat functions to get the result.", + "Support hover to show progress info", + "Supported Authentication Methods:", + "Supported Languages", + "Swap words", + "Switch", + "Switch Workspace", + "Sync", + "Sync completed successfully", + "Sync failed: ", + "Sync from Task Status Settings", + "Sync now", + "Sync this calendar source now", + "Sync with Daily Notes plugin", + "Syncing...", + "System Default", + "System tray", + "TODO → PLAN → IN PROGRESS → DONE", + "TODO ↔ DONE", + "TODO.md in any direct subfolder of Work", + "Table", + "Tag", + "Tag Matching Mode", + "Tag to identify important tasks (e.g., #important, #key)", + "Tag to identify urgent tasks (e.g., #urgent, #fire)", + "Tag-based Recognition", + "Tags", + "Target", + "Target Field", + "Target file", + "Target heading", + "Target type", + "Task", + "Task Content", + "Task Counting Settings", + "Task Fields", + "Task Filter", + "Task Format Examples", + "Task Genius Icons", + "Task Genius icons", + "Task Genius icons are designed by", + "Task Genius will use moment.js and also this format to parse the daily note path.", + "Task Gutter", + "Task Handler", + "Task Management", + "Task Paths", + "Task Properties", + "Task Properties for Files", + "Task Sorting", + "Task Status Markers", + "Task Symbol", + "Task Tags", + "Task Timer", + "Task Title Source", + "Task fields updated. Rebuild the task index to apply to existing files.", + "Task index completely rebuilt", + "Task mark display style", + "Task marker type", + "Task paths updated. Rebuild the task index to apply to existing files.", + "Task prefix format", + "Task tags updated. Rebuild the task index to apply to existing files.", + "Tasks", + "Tasks Plugin Detected", + "Tasks due within this many days are considered urgent", + "Tasks inherit metadata properties like priority, context, etc. from file frontmatter when not explicitly set on the task", + "Tasks with priority >= this value are considered important (1-5)", + "Tasks with priority >= this value are considered urgent (1-5)", + "Template file path for new daily notes (optional)", + "Template folder", + "Template folder is invalid; update the folder to continue.", + "Template for displaying completed task time. Use {h} for hours, {m} for minutes, {s} for seconds", + "Template note", + "Template text with", + "Templates", + "Templates/Quick Capture", + "Terminal (end stage)", + "Test", + "Test Connection", + "Test Input", + "Test Rule", + "Test the MCP server connection", + "Testing", + "Testing...", + "Text Progress Bar", + "Text Replacements", + "Text progress indicator", + "Text template (use {{PROGRESS}})", + "Text to append to incomplete tasks when moved (e.g., 'moved on 2023-12-31')", + "Text to append to incomplete tasks when moved (e.g., 'version 1.0')", + "Text to append to tasks when moved (e.g., 'archived on 2023-12-31')", + "Text to append to tasks when moved (e.g., 'version 1.0')", + "Text to replace matches with. Use $1, $2, etc. for capture groups.", + "Text to show when multiple items are selected", + "Text to show when no items are selected", + "The calendar layout this view is based on", + "The file where captured text will be saved. You can include a path, e.g., 'folder/Quick Capture.md'. Supports date templates like {{DATE:YYYY-MM-DD}} or {{date:YYYY-MM-DD-HHmm}}", + "The frontmatter key to use for project name", + "The prefix to add before captured content (e.g., '- [ ]' for task, '- ' for list item)", + "The property name in daily note front matter to store count values", + "The property name in daily note front matter to store mapping values", + "The property name of the daily note front matter", + "The stage to proceed to after this one", + "The symbols defined here should match those in your checkbox status configuration.", + "The type of this workflow stage", + "These features are experimental and may be unstable. They could change significantly or be removed in future updates due to Obsidian API changes or other factors. Please use with caution and provide feedback to help improve these features.", + "This action cannot be undone.", + "This change affects how tasks inherit metadata from files. Rebuild the index now so changes take effect immediately?", + "This doesn't look like a valid task. Tasks should start with '- [ ]'", + "This will add a new status cycle based on the {{value0}} theme.", + "This will override your current checkbox status settings with the {{value0}} theme. Do you want to continue?", + "This will replace all your current presets with the default set. Are you sure?", + "Thursday", + "Time Filter", + "Time Format", + "Time Format Configuration", + "Time Parsing", + "Time Parsing Settings", + "Time Range Preset", + "Time Range Separators", + "Time filter is only available for Week and Day views", + "Time filter is only available for Week and Day views.", + "Time format template", + "Time-to-live for cached results in milliseconds (default: 300000 = 5 minutes)", + "Timeline Sidebar", + "Timeline sidebar opened", + "Timer Integration", + "Timestamp format", + "Timestamp format:", + "Timing Rules", + "Title for the left column (items list)", + "To Do", + "Toggle between date-only and date+time input", + "Toggle this to allow adding progress bars to regular list items (non-task bullets).", + "Toggle this to allow this plugin to add progress bar for Task below the headings.", + "Toggle this to allow this plugin to auto complete parent checkbox when all child tasks are completed.", + "Toggle this to allow this plugin to count sub tasks when generating progress bar.", + "Toggle this to allow this plugin to find the pattern g::number as goal of the parent task.", + "Toggle this to allow this plugin to show progress bars in reading mode.", + "Toggle this to allow this plugin to show progress info when hovering over the progress bar.", + "Toggle this to customize the text for different progress ranges.", + "Toggle this to enable Org-mode style quick capture panel.", + "Toggle this to enable automatic date management when checkbox status changes. Dates will be added/removed based on your preferred metadata format (Tasks emoji format or Dataview format).", + "Toggle this to enable commands for moving completed tasks to another file.", + "Toggle this to enable commands for moving incomplete tasks to another file.", + "Toggle this to enable commands for sorting tasks.", + "Toggle this to enable date picker for tasks. This will add a calendar icon near your tasks which you can click to select a date.", + "Toggle this to enable file and folder filtering during task indexing. This can significantly improve performance for large vaults.", + "Toggle this to enable hiding progress bars based on tags, folders, or metadata.", + "Toggle this to enable showing progress bars based on heading.", + "Toggle this to enable the task filter panel", + "Toggle this to enable the task gutter.", + "Toggle this to enable the timeline sidebar view for quick access to your daily events and tasks.", + "Toggle this to only count specific task markers", + "Toggle this to show percentage instead of completed/total count.", + "Toggle to enable keyboard shortcuts for setting task priorities.", + "Toggle to enable or disable the reward system.", + "Toggle to enable priority picker dropdown for emoji and letter format priorities.", + "Toggle to enable the workflow system for tasks", + "Token copied to clipboard", + "Tools for managing and rebuilding the task index", + "Top Section", + "Total: {{value0}} | Success: {{value1}} | Errors: {{value2}}", + "Tray indicator", + "Treat abandoned tasks as completed", + "Tree View", + "Try It Yourself", + "Try Quick Capture", + "Tuesday", + "Two column view", + "Two column view settings", + "Type of authentication required", + "Type:", + "URL", + "URL to the ICS/iCal file (supports http://, https://, and webcal:// protocols)", + "URL: ", + "Unhide column", + "Unique identifier (auto-generated from name)", + "Unit", + "Unnamed View", + "Unsaved Changes", + "Untitled View", + "Update now", + "Updated", + "Uptime", + "Urgent & Important", + "Urgent & Not Important", + "Urgent Priority Threshold", + "Urgent Tag", + "Urgent Threshold Days", + "Use", + "Use Next Available Port", + "Use advanced multi-group filtering with complex conditions", + "Use as date type", + "Use background worker for file parsing to improve performance. Recommended for large vaults.", + "Use boolean operations: AND, OR, NOT. Example: 'text content AND #tag1 AND DATE:<2022-01-02 NOT PRIORITY:>=#B' - Supports >, <, =, >=, <=, != for PRIORITY and DATE.", + "Use boolean operations: AND, OR, NOT. Example: 'text content AND #tag1'", + "Use custom goal for progress bar", + "Use daily note path as date", + "Use default naming strategy when no project is explicitly defined", + "Use different values to map, e.g., emotion tracking", + "Use filename", + "Use folder name", + "Use left/right workspace side leaves for Sidebar and Details. When enabled, the main fluent view won't render in-view sidebar or details.", + "Use metadata field", + "Use placeholders like {{COMPLETED}}, {{TOTAL}}, {{PERCENT}}, etc.", + "Use quick capture panel to quickly capture tasks from anywhere in Obsidian.", + "Use relative time for date", + "Use relative time for date in task list item, e.g. 'yesterday', 'today', 'tomorrow', 'in 2 days', '3 months ago', etc.", + "Use system notifications when possible", + "Use template for new files", + "Use the command palette to access timer data management:", + "Use these templates as a starting point to create your own custom calendar views.", + "Use timing rules", + "Use workspace side leaves", + "Use {{DATE:format}} for date formatting (e.g., {{DATE:YYYY-MM-DD}}", + "Used by File mode (requires FileSource). Leave empty for vault root.", + "Used by File mode to prefill the file name input (supports date templates like {{DATE:YYYY-MM-DD}})", + "User Interface", + "Valid task format!", + "Validate Task", + "Value", + "Value cannot be empty", + "Value mapping", + "Version", + "Version marker", + "Version marker text", + "View Configuration", + "View Icon", + "View Logs", + "View Name", + "View Server Logs", + "View all MCP server tool calls and their results", + "View configuration saved.", + "View copied successfully: ", + "View deleted: ", + "View duplicated: ", + "View the documentation for this plugin", + "View type", + "Views", + "Views are disabled", + "WARNING: Enabling the MCP server will allow external AI tools and applications to access and modify your task data. This includes:\n\n• Reading all tasks and their details\n• Creating new tasks\n• Updating existing tasks\n• Deleting tasks\n• Accessing task metadata and properties\n\nOnly enable this if you trust the applications that will connect to the MCP server. Make sure to keep your authentication token secure.\n\nDo you want to continue?", + "Warning", + "Watch an episode of a favorite series", + "Wednesday", + "Week", + "Week View", + "Weekends Only", + "Weekends only", + "What should be used as the task title when a file becomes a task", + "When File mode is used, create the new note from a template and then insert the captured content.", + "When some but not all child tasks are completed, mark the parent checkbox as 'In Progress'. Only works when 'Auto complete parent' is enabled.", + "When updating task content, prefer updating frontmatter title over renaming the file. This protects the original filename.", + "Where to insert completed tasks in the target file", + "Where to insert incomplete tasks in the target file", + "Whether this rule is active", + "Whether this source is active", + "Whether to show holiday events in calendar view", + "Whether to show holiday events in forecast view", + "Which day should the week start on", + "Which field to apply the replacement to", + "Whitelist", + "Whitelist (Include only)", + "Whitelist: Include only specified paths | Blacklist: Exclude specified paths", + "Whitelist: include only specified paths. Blacklist: exclude specified paths.", + "Why File Filtering?", + "With Dataview Metadata", + "With Emoji Metadata", + "With current file link", + "With current file link for incomplete tasks", + "Workflow", + "Workflow & Automation", + "Workflow ID", + "Workflow Name", + "Workflow Stages", + "Workflow Template", + "Workflow definitions", + "Workflow name", + "Workflows", + "Working Hours (9:00-18:00)", + "Working On", + "Workspace \"{{name}}\" created", + "Workspace \"{{name}}\" deleted", + "Workspace Color", + "Workspace Icon", + "Workspace Management", + "Workspace Name", + "Workspace manager is not available.", + "Workspace updated", + "Workspaces", + "Write content tags to frontmatter", + "Writing", + "Year", + "Year View", + "Year view displays 12 mini-month calendars. Use the Date Filter tab to hide weekends if needed.", + "Yes, I understand the risks", + "You can choose dataview format or tasks format, that will influence both index and save format.", + "You can choose due, start, or scheduled as the date type for tasks.", + "You can customize any of these settings later in the plugin settings", + "You can customize the progress bar behind the parent task(usually at the end of the task). You can also customize the progress bar for the task below the heading.", + "You can modify all settings below. The original view will remain unchanged.", + "You have unsaved changes. Save before closing?", + "You need to close all bases view if you already create task view in them and remove unused view via edit them manually when disable this feature.", + "You need to set `yyyy` instead of `YYYY` in the format string. And `dd` instead of `DD`.", + "You've Earned a Reward!", + "Your custom calendar views. Drag to reorder, toggle visibility, or edit settings.", + "Your reward:", + "all .md files in Projects and subfolders", + "all .md files in Projects folder", + "archived on", + "archived on {{date}}", + "as a placeholder for the percentage value", + "common", + "compatibility documentation", + "contains", + "does not contain", + "e.g., every day, every week", + "ends with", + "equals", + "files ending with .task.md in Tasks folder", + "files starting with date in Tasks", + "filter", + "filter group", + "filter in this group", + "is", + "is empty", + "is false", + "is not", + "is not empty", + "is not set", + "is set", + "is true", + "legendary", + "matches all files under Projects folder", + "matches all files under Tasks/2024 folder", + "min", + "moved", + "moved on", + "moved on {{date}}", + "placeholder", + "projects selected", + "rare", + "selected items", + "starts with", + "tags selected", + "version 1.0", + "{title} ({count} days)", + "{{count}} field(s) configured", + "{{count}} format(s) configured", + "{{count}} heading(s) configured", + "{{count}} path(s) configured", + "{{count}} symbol(s) configured", + "{{count}} tag(s) configured", + "{{hidden}}/{{total}} hidden", + "{{status}} Task Symbols", + "{{value0}} theme workflow", + "{{value0}} · Heatmap", + "{{value0}}: Error", + "{{value0}}ms", + "⚠️ **WARNING**: Switching to 0.0.0.0 will make the MCP server accessible from external networks.\n\nThis could expose your Obsidian data to:\n- Other devices on your local network\n- Potentially the internet if your firewall is misconfigured\n\n**Only proceed if you:**\n- Understand the security implications\n- Have properly configured your firewall\n- Need external access for legitimate reasons\n\nAre you sure you want to continue?", + "📅 = Due date, 🔺 = High priority, #project/ = Docs project tag" +] diff --git a/src/__tests__/fluent-status-menu-regression.test.ts b/src/__tests__/fluent-status-menu-regression.test.ts new file mode 100644 index 000000000..98815cf2f --- /dev/null +++ b/src/__tests__/fluent-status-menu-regression.test.ts @@ -0,0 +1,55 @@ +jest.mock("@/components/features/quick-capture/modals/QuickCaptureModalWithSwitch", () => ({ QuickCaptureModal: class {} })); +jest.mock("@/components/features/task/view/details", () => ({ createTaskCheckbox: jest.fn() })); +jest.mock("@/components/ui/modals/ConfirmModal", () => ({ ConfirmModal: class {} })); +jest.mock("@/components/ui/date-picker/DatePickerModal", () => ({ DatePickerModal: class {} })); +jest.mock("@/components/ui/modals/TextPromptModal", () => ({ TextPromptModal: class {} })); +const mockMenuItems: any[] = []; +jest.mock("obsidian", () => { + const original = jest.requireActual("obsidian"); + class TestMenu { + addItem(callback: (item: any) => void) { + const item: any = { label: "", callback: undefined }; + item.titleEl = { createEl: (_tag: string, options: any) => { if (options?.text) item.label = options.text; return item.titleEl; } }; + const proxy = new Proxy(item, { get(target, name) { + if (name in target) return target[name]; + if (name === "setSubmenu") return () => new TestMenu(); + if (name === "setTitle") return (text: string) => { target.label = text; return proxy; }; + if (name === "onClick") return (fn: any) => { target.callback = fn; return proxy; }; + return () => proxy; + } }); + callback(proxy); mockMenuItems.push(item); return this; + } + addSeparator() { return this; } + showAtMouseEvent() {} + } + return { ...original, Menu: TestMenu }; +}); +import { FluentActionHandlers } from "@/components/features/fluent/managers/FluentActionHandlers"; +import type { Task } from "@/types/task"; + +const marks = { "Not Started": " ", Planned: "?", "In Progress": "/", Completed: "x", Paused: "=", Abandoned: "-" }; +function harness() { + mockMenuItems.length = 0; + const plugin: any = { settings: { taskStatuses: { completed: "x", inProgress: "/", abandoned: "-", notStarted: " ", planned: "?" }, statusCycles: [{ id: "default", name: "Default", enabled: true, priority: 0, cycle: Object.keys(marks), marks }] } }; + const handler: any = new FluentActionHandlers({} as any, plugin, () => "default", () => false); + for (const method of ["addPriorityMenuItems", "addDateMenuItems", "addTimerMenuItems"]) handler[method] = jest.fn(); + const update = jest.spyOn(handler, "handleTaskUpdate").mockResolvedValue(undefined); + const task = Object.freeze({ id: "one", content: "Write report", status: " ", completed: false, metadata: Object.freeze({ tags: [], children: [] }) }) as unknown as Task; + handler.handleTaskContextMenu({} as MouseEvent, task); + return { handler, update, task }; +} +describe("Fluent status context menu", () => { + for (const [name, mark] of Object.entries(marks).filter(([, mark]) => mark !== " ")) it(`writes the selected ${name} status using the original task`, async () => { + const { update, task } = harness(); + const item = mockMenuItems.find(item => item.label === name); + expect(item?.callback).toBeDefined(); await item.callback(); + expect(update).toHaveBeenCalledWith(task, expect.objectContaining({ status: mark, completed: mark === "x" })); + expect(task.status).toBe(" "); expect(task.metadata.completedDate).toBeUndefined(); + }); + it("writes the next cycle status instead of comparing an already changed task", async () => { + const { update, task } = harness(); + const item = mockMenuItems.find(item => item.label.includes("→") && item.label.includes("Planned")); + expect(item?.callback).toBeDefined(); await item.callback(); + expect(update).toHaveBeenCalledWith(task, expect.objectContaining({ status: "?" })); + }); +}); diff --git a/src/__tests__/legacy-settings-invalidation.test.ts b/src/__tests__/legacy-settings-invalidation.test.ts new file mode 100644 index 000000000..5ac6c8e9d --- /dev/null +++ b/src/__tests__/legacy-settings-invalidation.test.ts @@ -0,0 +1,40 @@ +import { DataflowOrchestrator } from "@/dataflow/Orchestrator"; +import { snapshotIndexSettings } from "@/dataflow/settings-signature"; + +describe("legacy settings invalidation", () => { + function harness() { + const settings = { projectConfig: { metadataConfig: { metadataKey: "project" } }, taskStatuses: { completed: "x" }, showProgress: true }; + const orchestrator: any = Object.create(DataflowOrchestrator.prototype); + Object.assign(orchestrator, { + indexSettingsSignature: snapshotIndexSettings(settings), settingsUpdateQueue: Promise.resolve(), + app: { workspace: { trigger: jest.fn() } }, plugin: { settings }, + augmentor: { updateSettings: jest.fn() }, projectResolver: { updateOptions: jest.fn() }, + workerOrchestrator: { setWorkerProcessingEnabled: jest.fn() }, onSettingsChange: jest.fn().mockResolvedValue(undefined), + }); + return { settings, orchestrator }; + } + it("detects nested edits to the same settings object and invalidates only once", async () => { + const { settings, orchestrator } = harness(); settings.projectConfig.metadataConfig.metadataKey = "project_name"; + await orchestrator.updateSettings(settings); await orchestrator.updateSettings(settings); + expect(orchestrator.onSettingsChange).toHaveBeenCalledTimes(1); + expect(orchestrator.onSettingsChange).toHaveBeenCalledWith(["parser", "augment", "project"]); + }); + it("does not rebuild the index for display-only changes", async () => { + const { settings, orchestrator } = harness(); settings.showProgress = false; + await orchestrator.updateSettings(settings); expect(orchestrator.onSettingsChange).not.toHaveBeenCalled(); + }); + it("retries failed invalidation instead of recording the change as completed", async () => { + const { settings, orchestrator } = harness(); settings.taskStatuses.completed = "X"; + orchestrator.onSettingsChange.mockRejectedValueOnce(new Error("temporary failure")); + await expect(orchestrator.updateSettings(settings)).rejects.toThrow("temporary failure"); + await orchestrator.updateSettings(settings); expect(orchestrator.onSettingsChange).toHaveBeenCalledTimes(2); + }); + it("serializes a newer change while an earlier rebuild is pending", async () => { + const { settings, orchestrator } = harness(); let finish!: () => void; let entered!: () => void; const started = new Promise(resolve => { entered = resolve; }); + orchestrator.onSettingsChange.mockImplementationOnce(() => new Promise(resolve => { finish = resolve; entered(); })); + settings.taskStatuses.completed = "X"; const first = orchestrator.updateSettings(settings); await started; + settings.taskStatuses.completed = "*"; const second = orchestrator.updateSettings(settings); finish(); + await Promise.all([first, second]); expect(orchestrator.onSettingsChange).toHaveBeenCalledTimes(2); + expect(orchestrator.indexSettingsSignature).toBe(snapshotIndexSettings(settings)); + }); +}); diff --git a/src/__tests__/legacy-settings-language.test.ts b/src/__tests__/legacy-settings-language.test.ts new file mode 100644 index 000000000..c453ec5da --- /dev/null +++ b/src/__tests__/legacy-settings-language.test.ts @@ -0,0 +1,30 @@ +import { readFileSync } from "fs"; +import { join } from "path"; +import english from "@/translations/locale/en"; +import chinese from "@/translations/locale/zh-cn"; +import { translationManager } from "@/translations/manager"; + +describe("legacy settings language coverage", () => { + const keys: string[] = JSON.parse(readFileSync(join(process.cwd(), "scripts/settings-i18n-keys.json"), "utf8")); + afterEach(() => translationManager.setLocale("en")); + it("provides both language entries for every audited settings label and preserves substitutions", () => { + const placeholders = (value: string) => (value.match(/\{\{[^{}]+\}\}|\{[A-Za-z_][\w]*\}/g) || []).sort(); + for (const key of keys) { + for (const dictionary of [english, chinese] as Record[]) { + expect(dictionary[key]).toBeTruthy(); + expect(placeholders(dictionary[key])).toEqual(placeholders(key)); + } + } + }); + it("renders the index and timer labels in Chinese while keeping user names in messages", () => { + translationManager.setLocale("zh-cn"); + expect(translationManager.t("Index & Sources")).toBe("索引与来源"); + expect(translationManager.t("Enable Task Timer")).toBe("启用任务计时器"); + expect(translationManager.t("{{value0}} theme workflow", { interpolation: { value0: "My personal theme" } })).toBe("My personal theme 主题工作流"); + }); + it("keeps English available without fetching a language pack", () => { + translationManager.setLocale("en"); + expect(translationManager.t("Enable Task Timer")).toBe("Enable Task Timer"); + expect(translationManager.t("Index & Sources")).toBe("Index & Sources"); + }); +}); diff --git a/src/__tests__/removeBlankTasks.test.ts b/src/__tests__/removeBlankTasks.test.ts new file mode 100644 index 000000000..5de58ebec --- /dev/null +++ b/src/__tests__/removeBlankTasks.test.ts @@ -0,0 +1,30 @@ +import { removeBlankTasks } from "@/utils/task/removeBlankTasks"; +import type { Task } from "@/types/task"; + +const task = (id: string, content: string, parent?: string, children: string[] = []): Task => ({ id, content, status: " ", completed: false, filePath: "a.md", line: 0, originalMarkdown: "", metadata: { tags: [], children, parent } } as Task); + +describe("empty task placeholders", () => { + it("drops empty and whitespace placeholders without deleting real tasks", () => { + const tasks = [task("empty", ""), task("spaces", " \t\u200b"), task("real", "Prepare report")]; + expect(removeBlankTasks(tasks).map(t => t.id)).toEqual(["real"]); + }); + it("promotes children through blank containers and preserves the surrounding hierarchy", () => { + const tasks = [task("root", "Project", undefined, ["blank"]), task("blank", "", "root", ["child"]), task("child", "Write draft", "blank")]; + const before = JSON.stringify(tasks); + const result = removeBlankTasks(tasks); + expect(result[0].metadata.children).toEqual(["child"]); + expect(result[1].metadata.parent).toBe("root"); + expect(JSON.stringify(tasks)).toBe(before); + }); + it("promotes a task below a blank root to a root task", () => { + expect(removeBlankTasks([task("blank", ""), task("child", "Read", "blank")])[0].metadata.parent).toBeUndefined(); + }); + it("terminates malformed cycles in blank parents", () => { + const result = removeBlankTasks([task("a", "", "b"), task("b", "", "a"), task("child", "Read", "a")]); + expect(result[0].metadata.parent).toBeUndefined(); + }); + it("retains completed and custom-status tasks that have titles", () => { + const tasks = [{ ...task("done", "Read"), status: "x", completed: true }, { ...task("pause", "Draft"), status: "=" }]; + expect(removeBlankTasks(tasks)).toBe(tasks); + }); +}); diff --git a/src/components/features/calendar/views/tg-agenda-view.ts b/src/components/features/calendar/views/tg-agenda-view.ts index ff8324f81..82cf4307e 100644 --- a/src/components/features/calendar/views/tg-agenda-view.ts +++ b/src/components/features/calendar/views/tg-agenda-view.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; /** * TGAgendaView - Agenda view extending @taskgenius/calendar BaseView * @@ -57,7 +58,7 @@ export interface AgendaViewOptions { export class TGAgendaView extends BaseView { static meta: ViewMeta = { type: "agenda", - label: "Agenda", + label: settingsText("Agenda"), shortLabel: "A", order: 40, }; diff --git a/src/components/features/calendar/views/tg-year-view.ts b/src/components/features/calendar/views/tg-year-view.ts index 05a22f986..78c63ffad 100644 --- a/src/components/features/calendar/views/tg-year-view.ts +++ b/src/components/features/calendar/views/tg-year-view.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; /** * TGYearView - Year view extending @taskgenius/calendar BaseView * @@ -65,7 +66,7 @@ export interface YearViewOptions { export class TGYearView extends BaseView { static meta: ViewMeta = { type: "year", - label: "Year", + label: settingsText("Year"), shortLabel: "Y", order: 50, }; diff --git a/src/components/features/fluent/managers/FluentActionHandlers.ts b/src/components/features/fluent/managers/FluentActionHandlers.ts index ec18ab90c..1475ca309 100644 --- a/src/components/features/fluent/managers/FluentActionHandlers.ts +++ b/src/components/features/fluent/managers/FluentActionHandlers.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { App, Component, Menu, Notice, TFile } from "obsidian"; import TaskProgressBarPlugin from "@/index"; import { StandardTaskMetadata, Task } from "@/types/task"; @@ -310,30 +311,7 @@ export class FluentActionHandlers extends Component { text: `${priorityIndicator}${cycle.name}: → ${nextStatusResult.statusName}`, }); subItem.onClick(async () => { - const willComplete = this.isCompletedMark( - nextStatusResult.mark - ); - const updatedTask = { - ...task, - status: nextStatusResult.mark, - completed: willComplete, - }; - - if (!task.completed && willComplete) { - updatedTask.metadata.completedDate = - Date.now(); - } else if ( - task.completed && - !willComplete - ) { - updatedTask.metadata.completedDate = - undefined; - } - - await this.handleKanbanTaskStatusUpdate( - updatedTask, - nextStatusResult.mark - ); + await this.handleKanbanTaskStatusUpdate(task, nextStatusResult.mark); }); }); } @@ -375,23 +353,7 @@ export class FluentActionHandlers extends Component { text: statusName, }); subItem.onClick(async () => { - const willComplete = this.isCompletedMark(mark); - const updatedTask = { - ...task, - status: mark, - completed: willComplete, - }; - - if (!task.completed && willComplete) { - updatedTask.metadata.completedDate = Date.now(); - } else if (task.completed && !willComplete) { - updatedTask.metadata.completedDate = undefined; - } - - await this.handleKanbanTaskStatusUpdate( - updatedTask, - mark - ); + await this.handleKanbanTaskStatusUpdate(task, mark); }); }); } @@ -416,20 +378,7 @@ export class FluentActionHandlers extends Component { text: status, }); subItem.onClick(async () => { - const willComplete = this.isCompletedMark(mark); - const updatedTask = { - ...task, - status: mark, - completed: willComplete, - }; - - if (!task.completed && willComplete) { - updatedTask.metadata.completedDate = Date.now(); - } else if (task.completed && !willComplete) { - updatedTask.metadata.completedDate = undefined; - } - - await this.handleTaskUpdate(task, updatedTask); + await this.handleKanbanTaskStatusUpdate(task, mark); }); }); } @@ -505,11 +454,11 @@ export class FluentActionHandlers extends Component { .setSubmenu(); const priorityLevels = [ - { level: 5, label: "Highest", icon: "alert-triangle" }, - { level: 4, label: "High", icon: "arrow-up" }, - { level: 3, label: "Medium", icon: "minus" }, - { level: 2, label: "Low", icon: "arrow-down" }, - { level: 1, label: "Lowest", icon: "chevron-down" }, + { level: 5, label: settingsText("Highest"), icon: "alert-triangle" }, + { level: 4, label: settingsText("High"), icon: "arrow-up" }, + { level: 3, label: settingsText("Medium"), icon: "minus" }, + { level: 2, label: settingsText("Low"), icon: "arrow-down" }, + { level: 1, label: settingsText("Lowest"), icon: "chevron-down" }, ] as const; priorityLevels.forEach(({ level, label, icon }) => { diff --git a/src/components/features/habit/habit.ts b/src/components/features/habit/habit.ts index 9485e5ef3..f13cda011 100644 --- a/src/components/features/habit/habit.ts +++ b/src/components/features/habit/habit.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Component, App, @@ -214,12 +215,12 @@ export class EventDetailModal extends Modal { const {contentEl} = this; contentEl.addClass("habit-event-modal"); contentEl.createEl("h2", { - text: `Record Details for ${this.eventName}`, + text: settingsText("Record Details for {{value0}}", { interpolation: { value0: String(this.eventName) } }), }); - new Setting(contentEl).setName("Details").addText((text) => + new Setting(contentEl).setName(settingsText("Details")).addText((text) => text - .setPlaceholder(`Enter details for ${this.eventName}...`) + .setPlaceholder(settingsText("Enter details for {{value0}}...", { interpolation: { value0: String(this.eventName) } })) .onChange((value) => { this.details = value; }) @@ -228,7 +229,7 @@ export class EventDetailModal extends Modal { new Setting(contentEl) .addButton((btn) => btn - .setButtonText("Cancel") + .setButtonText(settingsText("Cancel")) .setWarning() .onClick(() => { this.close(); @@ -236,7 +237,7 @@ export class EventDetailModal extends Modal { ) .addButton((btn) => btn - .setButtonText("Submit") + .setButtonText(settingsText("Submit")) .setCta() .onClick(() => { this.close(); diff --git a/src/components/features/habit/modals/HabitChartModal.ts b/src/components/features/habit/modals/HabitChartModal.ts index fa968ae95..158fcb463 100644 --- a/src/components/features/habit/modals/HabitChartModal.ts +++ b/src/components/features/habit/modals/HabitChartModal.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { App, Modal, Setting } from "obsidian"; import { DailyHabitProps } from "@/types/habit-card"; import { @@ -35,7 +36,7 @@ export class HabitChartModal extends Modal { contentEl.empty(); this.modalEl.toggleClass("habit-chart-modal", true); - this.setTitle(`${this.habit.name} · Heatmap`); + this.setTitle(settingsText("{{value0}} · Heatmap", { interpolation: { value0: String(this.habit.name) } })); // Controls (use Obsidian Setting + dropdowns) const controls = contentEl.createDiv({ cls: "habit-chart-controls" }); diff --git a/src/components/features/quick-capture/components/FileNameInput.ts b/src/components/features/quick-capture/components/FileNameInput.ts index af93eb1fb..6e64b0976 100644 --- a/src/components/features/quick-capture/components/FileNameInput.ts +++ b/src/components/features/quick-capture/components/FileNameInput.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { App, TFile, @@ -178,11 +179,11 @@ export class FileNameInput { // Get templates from settings and normalize legacy data if needed const defaultTemplates: QuickCaptureTemplateDefinition[] = [ - { name: "Daily Note", template: "{{DATE:YYYY-MM-DD}}" }, - { name: "Meeting", template: "{{DATE:YYYY-MM-DD}} - Meeting" }, - { name: "Task", template: "{{DATE:YYYY-MM-DD}} - Task" }, - { name: "Project", template: "Project - {{DATE:YYYY-MM}}" }, - { name: "Notes", template: "Notes - {{DATE:YYYY-MM-DD-HHmm}}" }, + { name: settingsText("Daily Note"), template: "{{DATE:YYYY-MM-DD}}" }, + { name: settingsText("Meeting"), template: "{{DATE:YYYY-MM-DD}} - Meeting" }, + { name: settingsText("Task"), template: "{{DATE:YYYY-MM-DD}} - Task" }, + { name: settingsText("Project"), template: "Project - {{DATE:YYYY-MM}}" }, + { name: settingsText("Notes"), template: "Notes - {{DATE:YYYY-MM-DD-HHmm}}" }, ]; const rawTemplates = this.plugin.settings.quickCapture diff --git a/src/components/features/settings/components/FileSourceSettingsSection.ts b/src/components/features/settings/components/FileSourceSettingsSection.ts index 9b9a6aa56..e00547191 100644 --- a/src/components/features/settings/components/FileSourceSettingsSection.ts +++ b/src/components/features/settings/components/FileSourceSettingsSection.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; /** * FileTaskSettings - UI component for File Task configuration * @@ -913,7 +914,7 @@ function createStatusMappingSection( row.createEl("td", { text: example.metadata }); row.createEl("td", { text: "→" }); row.createEl("td", { - text: example.symbol === " " ? "(space)" : example.symbol, + text: example.symbol === " " ? settingsText("(space)") : example.symbol, }); }); diff --git a/src/components/features/settings/tabs/DesktopIntegrationSettingsTab.ts b/src/components/features/settings/tabs/DesktopIntegrationSettingsTab.ts index 08e9c2e06..48875ff36 100644 --- a/src/components/features/settings/tabs/DesktopIntegrationSettingsTab.ts +++ b/src/components/features/settings/tabs/DesktopIntegrationSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Setting, Platform } from "obsidian"; import { t } from "@/translations/helper"; import { TaskProgressBarSettingTab } from "@/setting"; @@ -182,9 +183,9 @@ export function renderDesktopIntegrationSettingsTab( }; const mode = s.desktopIntegration.trayMode || "status"; dd.addOptions({ - system: "System tray", - status: "Status bar", - both: "Both", + system: settingsText("System tray"), + status: settingsText("Status bar"), + both: settingsText("Both"), }) .setValue(mode) .onChange((v) => { diff --git a/src/components/features/settings/tabs/IcsSettingsTab.ts b/src/components/features/settings/tabs/IcsSettingsTab.ts index 4036abecc..de9d44a53 100644 --- a/src/components/features/settings/tabs/IcsSettingsTab.ts +++ b/src/components/features/settings/tabs/IcsSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; /** * ICS Settings Component * Provides UI for managing ICS calendar sources @@ -682,7 +683,7 @@ class IcsSourceModal extends Modal { "text-replacement-header" ); const titleEl = ruleHeader.createEl("strong", { - text: rule.name || `Rule ${index + 1}`, + text: rule.name || settingsText("Rule {{value0}}", { interpolation: { value0: String(index + 1) } }), }); const statusEl = ruleHeader.createEl("span", { @@ -1069,7 +1070,7 @@ class IcsSourceModal extends Modal { ) .setClass("holiday-setting") .addText((text) => { - text.setPlaceholder("{title} ({count} days)") + text.setPlaceholder(settingsText("{title} ({count} days)")) .setValue( this.source.holidayConfig!.groupDisplayFormat || "" ) @@ -1482,25 +1483,25 @@ class TextReplacementModal extends Modal { // Remove prefix example const example1 = examplesList.createEl("li"); example1.createEl("strong", { text: t("Remove prefix") + ": " }); - example1.createSpan({ text: "Pattern: " }); + example1.createSpan({ text: settingsText("Pattern: ") }); example1.createEl("code", { text: "^Meeting: " }); - example1.createSpan({ text: ", Replacement: " }); + example1.createSpan({ text: settingsText(", Replacement: ") }); example1.createEl("code", { text: "" }); // Replace room numbers example const example2 = examplesList.createEl("li"); example2.createEl("strong", { text: t("Replace room numbers") + ": " }); - example2.createSpan({ text: "Pattern: " }); + example2.createSpan({ text: settingsText("Pattern: ") }); example2.createEl("code", { text: "Room (\\d+)" }); - example2.createSpan({ text: ", Replacement: " }); + example2.createSpan({ text: settingsText(", Replacement: ") }); example2.createEl("code", { text: "Conference Room $1" }); // Swap words example const example3 = examplesList.createEl("li"); example3.createEl("strong", { text: t("Swap words") + ": " }); - example3.createSpan({ text: "Pattern: " }); + example3.createSpan({ text: settingsText("Pattern: ") }); example3.createEl("code", { text: "(\\w+) with (\\w+)" }); - example3.createSpan({ text: ", Replacement: " }); + example3.createSpan({ text: settingsText(", Replacement: ") }); example3.createEl("code", { text: "$2 and $1" }); // Test section diff --git a/src/components/features/settings/tabs/IndexSettingsTab.ts b/src/components/features/settings/tabs/IndexSettingsTab.ts index e4c9ce038..ef589a4f1 100644 --- a/src/components/features/settings/tabs/IndexSettingsTab.ts +++ b/src/components/features/settings/tabs/IndexSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Setting, Notice, setIcon } from "obsidian"; import { TaskProgressBarSettingTab } from "@/setting"; import { t } from "@/translations/helper"; @@ -150,7 +151,7 @@ export function renderIndexSettingsTab( .addDropdown((dropdown) => { dropdown .addOption("dataview", "Dataview") - .addOption("tasks", "Tasks") + .addOption("tasks", settingsText("Tasks")) .setValue(settingTab.plugin.settings.preferMetadataFormat) .onChange(async (value) => { settingTab.plugin.settings.preferMetadataFormat = diff --git a/src/components/features/settings/tabs/McpIntegrationSettingsTab.ts b/src/components/features/settings/tabs/McpIntegrationSettingsTab.ts index 75a48094c..c080b9a54 100644 --- a/src/components/features/settings/tabs/McpIntegrationSettingsTab.ts +++ b/src/components/features/settings/tabs/McpIntegrationSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; /** * MCP Integration Settings Tab Component */ @@ -172,10 +173,10 @@ export function renderMcpIntegrationSettingsTab( ) .addDropdown((dropdown) => { dropdown - .addOption("127.0.0.1", "127.0.0.1 (Local only)") + .addOption("127.0.0.1", settingsText("127.0.0.1 (Local only)")) .addOption( "0.0.0.0", - "0.0.0.0 (All interfaces - for external access)" + settingsText("0.0.0.0 (All interfaces - for external access)") ) .setValue(plugin.settings.mcpIntegration?.host || "127.0.0.1") .onChange(async (value) => { @@ -605,7 +606,7 @@ export function renderMcpIntegrationSettingsTab( // Method A const methodAItem = authList.createEl("li"); - methodAItem.createEl("strong", { text: "Method A (Custom Header):" }); + methodAItem.createEl("strong", { text: settingsText("Method A (Custom Header):") }); methodAItem.appendText(" "); methodAItem.createEl("code", { text: `mcp-app-id: ${appId}` }); methodAItem.appendText(" + "); @@ -615,7 +616,7 @@ export function renderMcpIntegrationSettingsTab( // Method B const methodBItem = authList.createEl("li"); - methodBItem.createEl("strong", { text: "Method B (Combined Bearer):" }); + methodBItem.createEl("strong", { text: settingsText("Method B (Combined Bearer):") }); methodBItem.appendText(" "); methodBItem.createEl("code", { text: `Authorization: Bearer ${authToken}+${appId}`, @@ -1010,7 +1011,7 @@ export function renderMcpIntegrationSettingsTab( const endpointContent = endpointBox.createDiv("mcp-endpoint-content"); const endpointLabel = endpointContent.createSpan("mcp-endpoint-label"); - endpointLabel.setText("URL: "); + endpointLabel.setText(settingsText("URL: ")); const endpointUrl = serverUrl; endpointContent.createEl("code", { @@ -1165,7 +1166,7 @@ export function renderMcpIntegrationSettingsTab( "mcp-example-block active" ); curlExample.createEl("div", { - text: "1) Initialize", + text: settingsText("1) Initialize"), cls: "mcp-example-subtitle", }); const curlPreInit = curlExample.createEl("pre", { @@ -1190,7 +1191,7 @@ export function renderMcpIntegrationSettingsTab( } curlExample.createEl("div", { - text: "2) Call tool with session id", + text: settingsText("2) Call tool with session id"), cls: "mcp-example-subtitle", }); const curlPreCall = curlExample.createEl("pre", { @@ -1219,7 +1220,7 @@ export function renderMcpIntegrationSettingsTab( // JavaScript example (Init + Call) const jsExample = exampleCodeContainer.createDiv("mcp-example-block"); jsExample.createEl("div", { - text: "1) Initialize", + text: settingsText("1) Initialize"), cls: "mcp-example-subtitle", }); const jsPreInit = jsExample.createEl("pre", { @@ -1237,7 +1238,7 @@ export function renderMcpIntegrationSettingsTab( } jsExample.createEl("div", { - text: "2) Call tool with session id", + text: settingsText("2) Call tool with session id"), cls: "mcp-example-subtitle", }); const jsPreCall = jsExample.createEl("pre", { @@ -1258,7 +1259,7 @@ export function renderMcpIntegrationSettingsTab( const pythonExample = exampleCodeContainer.createDiv("mcp-example-block"); pythonExample.createEl("div", { - text: "1) Initialize", + text: settingsText("1) Initialize"), cls: "mcp-example-subtitle", }); const pythonPreInit = pythonExample.createEl("pre", { @@ -1301,7 +1302,7 @@ print(f"Session ID: {session_id}")`, } pythonExample.createEl("div", { - text: "2) Call tool with session id", + text: settingsText("2) Call tool with session id"), cls: "mcp-example-subtitle", }); const pythonPreCall = pythonExample.createEl("pre", { diff --git a/src/components/features/settings/tabs/ProgressSettingsTab.ts b/src/components/features/settings/tabs/ProgressSettingsTab.ts index b4837d17a..a37cf5001 100644 --- a/src/components/features/settings/tabs/ProgressSettingsTab.ts +++ b/src/components/features/settings/tabs/ProgressSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Setting, TextAreaComponent } from "obsidian"; import { DEFAULT_SETTINGS } from "@/common/setting-definition"; import { t } from "@/translations/helper"; @@ -471,7 +472,7 @@ function displayNumberToProgressbar( ); previewEl.setText(`${t("Preview")}: ${renderedText}`); } catch (error) { - previewEl.setText(`${t("Preview")}: Error`); + previewEl.setText(settingsText("{{value0}}: Error", { interpolation: { value0: String(t("Preview")) } })); previewEl.addClass("expression-preview-error"); } @@ -586,7 +587,7 @@ function addProgressRangesSettings( }) ) .addButton((button) => { - button.setButtonText("Delete").onClick(async () => { + button.setButtonText(settingsText("Delete")).onClick(async () => { settingTab.plugin.settings.progressRanges.splice(index, 1); settingTab.applySettingsUpdate(); settingTab.display(); @@ -628,7 +629,7 @@ function addProgressRangesSettings( }) ) .addButton((button) => { - button.setButtonText("Add").onClick(async () => { + button.setButtonText(settingsText("Add")).onClick(async () => { const settingsContainer = button.buttonEl.parentElement; if (!settingsContainer) return; @@ -730,7 +731,7 @@ function updateFormatPreview( previewContainer.setText(renderedText); previewContainer.removeClass("custom-format-preview-error"); } catch (error) { - previewContainer.setText("Error rendering format"); + previewContainer.setText(settingsText("Error rendering format")); previewContainer.addClass("custom-format-preview-error"); } } diff --git a/src/components/features/settings/tabs/QuickCaptureSettingsTab.ts b/src/components/features/settings/tabs/QuickCaptureSettingsTab.ts index b2d2c4897..37a3e4a72 100644 --- a/src/components/features/settings/tabs/QuickCaptureSettingsTab.ts +++ b/src/components/features/settings/tabs/QuickCaptureSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Setting, Notice, TFile, TFolder } from "obsidian"; import { TaskProgressBarSettingTab } from "@/setting"; import { t } from "@/translations/helper"; @@ -531,11 +532,11 @@ export function renderQuickCaptureSettingsTab( ); const defaultTemplates: QuickCaptureTemplateDefinition[] = [ - { name: "Daily Note", template: "{{DATE:YYYY-MM-DD}}" }, - { name: "Meeting", template: "{{DATE:YYYY-MM-DD}} - Meeting" }, - { name: "Task", template: "{{DATE:YYYY-MM-DD}} - Task" }, - { name: "Project", template: "Project - {{DATE:YYYY-MM}}" }, - { name: "Notes", template: "Notes - {{DATE:YYYY-MM-DD-HHmm}}" }, + { name: settingsText("Daily Note"), template: "{{DATE:YYYY-MM-DD}}" }, + { name: settingsText("Meeting"), template: "{{DATE:YYYY-MM-DD}} - Meeting" }, + { name: settingsText("Task"), template: "{{DATE:YYYY-MM-DD}} - Task" }, + { name: settingsText("Project"), template: "Project - {{DATE:YYYY-MM}}" }, + { name: settingsText("Notes"), template: "Notes - {{DATE:YYYY-MM-DD-HHmm}}" }, ]; const rawTemplates = settingTab.plugin.settings.quickCapture diff --git a/src/components/features/settings/tabs/TaskHandlerSettingsTab.ts b/src/components/features/settings/tabs/TaskHandlerSettingsTab.ts index 78819b48f..7d4b1ad25 100644 --- a/src/components/features/settings/tabs/TaskHandlerSettingsTab.ts +++ b/src/components/features/settings/tabs/TaskHandlerSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Setting } from "obsidian"; import { SortCriterion, @@ -63,9 +64,9 @@ export function renderTaskHandlerSettingsTab( .setDesc(t("Choose what type of marker to add to moved tasks")) .addDropdown((dropdown) => { dropdown - .addOption("version", "Version marker") - .addOption("date", "Date marker") - .addOption("custom", "Custom marker") + .addOption("version", settingsText("Version marker")) + .addOption("date", settingsText("Date marker")) + .addOption("custom", settingsText("Custom marker")) .setValue( settingTab.plugin.settings.completedTaskMover .taskMarkerType @@ -91,7 +92,7 @@ export function renderTaskHandlerSettingsTab( ) .addText((text) => text - .setPlaceholder("version 1.0") + .setPlaceholder(settingsText("version 1.0")) .setValue( settingTab.plugin.settings.completedTaskMover .versionMarker @@ -112,7 +113,7 @@ export function renderTaskHandlerSettingsTab( ) .addText((text) => text - .setPlaceholder("archived on {{date}}") + .setPlaceholder(settingsText("archived on {{date}}")) .setValue( settingTab.plugin.settings.completedTaskMover .dateMarker @@ -280,7 +281,7 @@ export function renderTaskHandlerSettingsTab( ) .addText((text) => text - .setPlaceholder("Completed Tasks") + .setPlaceholder(settingsText("Completed Tasks")) .setValue( settingTab.plugin.settings.completedTaskMover .defaultHeadingName @@ -328,9 +329,9 @@ export function renderTaskHandlerSettingsTab( ) .addDropdown((dropdown) => { dropdown - .addOption("version", "Version marker") - .addOption("date", "Date marker") - .addOption("custom", "Custom marker") + .addOption("version", settingsText("Version marker")) + .addOption("date", settingsText("Date marker")) + .addOption("custom", settingsText("Custom marker")) .setValue( settingTab.plugin.settings.completedTaskMover .incompletedTaskMarkerType @@ -357,7 +358,7 @@ export function renderTaskHandlerSettingsTab( ) .addText((text) => text - .setPlaceholder("version 1.0") + .setPlaceholder(settingsText("version 1.0")) .setValue( settingTab.plugin.settings.completedTaskMover .incompletedVersionMarker @@ -378,7 +379,7 @@ export function renderTaskHandlerSettingsTab( ) .addText((text) => text - .setPlaceholder("moved on {{date}}") + .setPlaceholder(settingsText("moved on {{date}}")) .setValue( settingTab.plugin.settings.completedTaskMover .incompletedDateMarker @@ -516,7 +517,7 @@ export function renderTaskHandlerSettingsTab( ) .addText((text) => text - .setPlaceholder("Incomplete Tasks") + .setPlaceholder(settingsText("Incomplete Tasks")) .setValue( settingTab.plugin.settings.completedTaskMover .incompletedDefaultHeadingName @@ -771,7 +772,7 @@ export function renderTaskHandlerSettingsTab( .setDesc(t("Default section for archive action")) .addText((text) => text - .setPlaceholder("Completed Tasks") + .setPlaceholder(settingsText("Completed Tasks")) .setValue( settingTab.plugin.settings.onCompletion.defaultArchiveSection ) diff --git a/src/components/features/settings/tabs/TaskStatusSettingsTab.ts b/src/components/features/settings/tabs/TaskStatusSettingsTab.ts index bf3ee1d4f..d40fdbd96 100644 --- a/src/components/features/settings/tabs/TaskStatusSettingsTab.ts +++ b/src/components/features/settings/tabs/TaskStatusSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Modal, setIcon, Setting } from "obsidian"; import { t } from "@/translations/helper"; import { allStatusCollections } from "@/common/task-status"; @@ -110,7 +111,7 @@ export function renderTaskStatusSettingsTab( ) .setHeading() .addDropdown((dropdown) => { - dropdown.addOption("custom", "Custom"); + dropdown.addOption("custom", settingsText("Custom")); for (const statusCollection of allStatusCollections) { dropdown.addOption(statusCollection, statusCollection); } @@ -125,11 +126,11 @@ export function renderTaskStatusSettingsTab( // Confirm before applying the theme const modal = new Modal(settingTab.app); - modal.titleEl.setText(`Apply ${value} Theme?`); + modal.titleEl.setText(settingsText("Apply {{value0}} Theme?", { interpolation: { value0: String(value) } })); const content = modal.contentEl.createDiv(); content.setText( - `This will override your current checkbox status settings with the ${value} theme. Do you want to continue?`, + settingsText("This will override your current checkbox status settings with the {{value0}} theme. Do you want to continue?", { interpolation: { value0: String(value) } }), ); const buttonContainer = modal.contentEl.createDiv({ @@ -342,45 +343,45 @@ export function renderTaskStatusSettingsTab( // Configure Completed status createStatusConfigButton("completed", { - title: "Completed", + title: settingsText("Completed"), description: - "Configure symbols that represent completed tasks in square brackets", + settingsText("Configure symbols that represent completed tasks in square brackets"), placeholder: "x", icon: "completed", }); // Configure Planned status createStatusConfigButton("planned", { - title: "Planned", + title: settingsText("Planned"), description: - "Configure symbols that represent planned tasks in square brackets", + settingsText("Configure symbols that represent planned tasks in square brackets"), placeholder: "?", icon: "planned", }); // Configure In Progress status createStatusConfigButton("inProgress", { - title: "In Progress", + title: settingsText("In Progress"), description: - "Configure symbols that represent tasks in progress in square brackets", + settingsText("Configure symbols that represent tasks in progress in square brackets"), placeholder: "/", icon: "inProgress", }); // Configure Abandoned status createStatusConfigButton("abandoned", { - title: "Abandoned", + title: settingsText("Abandoned"), description: - "Configure symbols that represent abandoned tasks in square brackets", + settingsText("Configure symbols that represent abandoned tasks in square brackets"), placeholder: "-", icon: "abandoned", }); // Configure Not Started status (preserves empty spaces) createStatusConfigButton("notStarted", { - title: "Not Started", + title: settingsText("Not Started"), description: - 'Configure symbols that represent not started tasks in square brackets. Default is space " "', + settingsText('Configure symbols that represent not started tasks in square brackets. Default is space " "'), placeholder: " ", icon: "notStarted", preserveEmpty: true, @@ -394,11 +395,11 @@ export function renderTaskStatusSettingsTab( ), ) .addDropdown((dropdown) => { - dropdown.addOption("notStarted", "Not Started"); - dropdown.addOption("abandoned", "Abandoned"); - dropdown.addOption("planned", "Planned"); - dropdown.addOption("completed", "Completed"); - dropdown.addOption("inProgress", "In Progress"); + dropdown.addOption("notStarted", settingsText("Not Started")); + dropdown.addOption("abandoned", settingsText("Abandoned")); + dropdown.addOption("planned", settingsText("Planned")); + dropdown.addOption("completed", settingsText("Completed")); + dropdown.addOption("inProgress", settingsText("In Progress")); dropdown.setValue( settingTab.plugin.settings.countOtherStatusesAs || "notStarted", ); @@ -634,7 +635,7 @@ export function renderTaskStatusSettingsTab( ), ) .addDropdown((dropdown) => { - dropdown.addOption("custom", "Custom"); + dropdown.addOption("custom", settingsText("Custom")); for (const statusCollection of allStatusCollections) { dropdown.addOption(statusCollection, statusCollection); } @@ -649,13 +650,11 @@ export function renderTaskStatusSettingsTab( // Confirm before applying the theme const modal = new Modal(settingTab.app); - modal.titleEl.setText(`Add ${value} Theme as New Cycle?`); + modal.titleEl.setText(settingsText("Add {{value0}} Theme as New Cycle?", { interpolation: { value0: String(value) } })); const content = modal.contentEl.createDiv(); content.setText( - t( - `This will add a new status cycle based on the ${value} theme.`, - ), + settingsText("This will add a new status cycle based on the {{value0}} theme.", { interpolation: { value0: String(value) } }), ); const buttonContainer = modal.contentEl.createDiv({ @@ -711,7 +710,7 @@ export function renderTaskStatusSettingsTab( const newStatusCycle: StatusCycle = { id: `cycle-${Date.now()}`, name: value, - description: t(`${value} theme workflow`), + description: settingsText("{{value0}} theme workflow", { interpolation: { value0: String(value) } }), priority: settingTab.plugin.settings.statusCycles! .length, diff --git a/src/components/features/settings/tabs/TaskTimerSettingsTab.ts b/src/components/features/settings/tabs/TaskTimerSettingsTab.ts index 4db76edbf..176ec5754 100644 --- a/src/components/features/settings/tabs/TaskTimerSettingsTab.ts +++ b/src/components/features/settings/tabs/TaskTimerSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Setting } from "obsidian"; import { TaskProgressBarSettingTab } from "@/setting"; @@ -11,9 +12,9 @@ export function renderTaskTimerSettingTab( // Main enable/disable setting new Setting(timerSection) - .setName("Enable Task Timer") + .setName(settingsText("Enable Task Timer")) .setDesc( - "Enable task timer functionality for tracking time spent on tasks", + settingsText("Enable task timer functionality for tracking time spent on tasks"), ) .addToggle((toggle) => { toggle @@ -46,14 +47,14 @@ export function renderTaskTimerSettingTab( metadataSection.addClass("task-timer-metadata-section"); const metadataHeading = metadataSection.createEl("h3"); - metadataHeading.setText("Metadata Detection"); + metadataHeading.setText(settingsText("Metadata Detection")); metadataHeading.addClass("task-timer-section-heading"); // Frontmatter field setting new Setting(metadataSection) - .setName("Frontmatter field") + .setName(settingsText("Frontmatter field")) .setDesc( - "Field name in frontmatter to check for enabling task timer (e.g., 'task-timer: true')", + settingsText("Field name in frontmatter to check for enabling task timer (e.g., 'task-timer: true')"), ) .addText((text) => { text.setValue( @@ -70,9 +71,9 @@ export function renderTaskTimerSettingTab( // Folder paths setting new Setting(metadataSection) - .setName("Folder paths") + .setName(settingsText("Folder paths")) .setDesc( - "Comma-separated list of folder paths where task timer should be enabled", + settingsText("Comma-separated list of folder paths where task timer should be enabled"), ) .addTextArea((textArea) => { textArea @@ -99,8 +100,8 @@ export function renderTaskTimerSettingTab( // Tags setting new Setting(metadataSection) - .setName("Tags") - .setDesc("Comma-separated list of tags that enable task timer") + .setName(settingsText("Tags")) + .setDesc(settingsText("Comma-separated list of tags that enable task timer")) .addTextArea((textArea) => { textArea .setValue( @@ -129,14 +130,14 @@ export function renderTaskTimerSettingTab( formatSection.addClass("task-timer-format-section"); const formatHeading = formatSection.createEl("h3"); - formatHeading.setText("Time Format"); + formatHeading.setText(settingsText("Time Format")); formatHeading.addClass("task-timer-section-heading"); // Time format template setting new Setting(formatSection) - .setName("Time format template") + .setName(settingsText("Time format template")) .setDesc( - "Template for displaying completed task time. Use {h} for hours, {m} for minutes, {s} for seconds", + settingsText("Template for displaying completed task time. Use {h} for hours, {m} for minutes, {s} for seconds"), ) .addText((text) => { text.setValue( @@ -156,7 +157,7 @@ export function renderTaskTimerSettingTab( const examplesTitle = examplesDiv.createDiv(); examplesTitle.addClass("task-timer-examples-title"); - examplesTitle.setText("Format Examples:"); + examplesTitle.setText(settingsText("Format Examples:")); const examplesList = examplesDiv.createEl("ul"); @@ -179,14 +180,14 @@ export function renderTaskTimerSettingTab( blockRefSection.addClass("task-timer-blockref-section"); const blockRefHeading = blockRefSection.createEl("h3"); - blockRefHeading.setText("Block References"); + blockRefHeading.setText(settingsText("Block References")); blockRefHeading.addClass("task-timer-section-heading"); // Block reference prefix setting new Setting(blockRefSection) - .setName("Block reference prefix") + .setName(settingsText("Block reference prefix")) .setDesc( - "Prefix for generated block reference IDs (e.g., 'timer' creates ^timer-123456-7890)", + settingsText("Prefix for generated block reference IDs (e.g., 'timer' creates ^timer-123456-7890)"), ) .addText((text) => { text.setValue( @@ -206,7 +207,7 @@ export function renderTaskTimerSettingTab( commandsSection.addClass("task-timer-commands-section"); const commandsHeading = commandsSection.createEl("h3"); - commandsHeading.setText("Data Management"); + commandsHeading.setText(settingsText("Data Management")); commandsHeading.addClass("task-timer-section-heading"); const commandsDesc = commandsSection.createDiv(); @@ -214,31 +215,31 @@ export function renderTaskTimerSettingTab( const descParagraph = commandsDesc.createEl("p"); descParagraph.setText( - "Use the command palette to access timer data management:", + settingsText("Use the command palette to access timer data management:"), ); const commandsList = commandsDesc.createEl("ul"); const commands = [ { - name: "Export task timer data", - desc: "Export all timer data to JSON", + name: settingsText("Export task timer data"), + desc: settingsText("Export all timer data to JSON"), }, { - name: "Import task timer data", - desc: "Import timer data from JSON file", + name: settingsText("Import task timer data"), + desc: settingsText("Import timer data from JSON file"), }, { - name: "Export task timer data (YAML)", - desc: "Export to YAML format", + name: settingsText("Export task timer data (YAML)"), + desc: settingsText("Export to YAML format"), }, { - name: "Create task timer backup", - desc: "Create a backup of active timers", + name: settingsText("Create task timer backup"), + desc: settingsText("Create a backup of active timers"), }, { - name: "Show task timer statistics", - desc: "Display timer usage statistics", + name: settingsText("Show task timer statistics"), + desc: settingsText("Display timer usage statistics"), }, ]; diff --git a/src/components/features/settings/tabs/TimeParsingSettingsTab.ts b/src/components/features/settings/tabs/TimeParsingSettingsTab.ts index ad1625e94..8cd5e8db4 100644 --- a/src/components/features/settings/tabs/TimeParsingSettingsTab.ts +++ b/src/components/features/settings/tabs/TimeParsingSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { PluginSettingTab, Setting } from "obsidian"; import { t } from "@/translations/helper"; import { TaskProgressBarSettingTab } from "@/setting"; @@ -339,7 +340,7 @@ export function renderTimeParsingSettingsTab( cls: "time-parsing-example", }); exampleEl.createEl("span", { - text: "Input: ", + text: settingsText("Input: "), cls: "example-label", }); exampleEl.createEl("code", { @@ -348,7 +349,7 @@ export function renderTimeParsingSettingsTab( }); exampleEl.createEl("br"); exampleEl.createEl("span", { - text: "Output: ", + text: settingsText("Output: "), cls: "example-label", }); exampleEl.createEl("code", { diff --git a/src/components/features/settings/tabs/WorkflowSettingsTab.ts b/src/components/features/settings/tabs/WorkflowSettingsTab.ts index 5699163c9..b048883fe 100644 --- a/src/components/features/settings/tabs/WorkflowSettingsTab.ts +++ b/src/components/features/settings/tabs/WorkflowSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Setting, Modal } from "obsidian"; import { t } from "@/translations/helper"; import { TaskProgressBarSettingTab } from "@/setting"; @@ -297,9 +298,7 @@ export function renderWorkflowSettingsTab( const content = modal.contentEl.createDiv(); content.setText( - t( - `Are you sure you want to delete the '${workflow.name}' workflow?` - ) + settingsText("Are you sure you want to delete the '{{value0}}' workflow?", { interpolation: { value0: String(workflow.name) } }) ); const buttonContainer = modal.contentEl.createDiv({ diff --git a/src/components/features/task/filter/in-view/filter-pill.ts b/src/components/features/task/filter/in-view/filter-pill.ts index 79648472e..a11e6bfbb 100644 --- a/src/components/features/task/filter/in-view/filter-pill.ts +++ b/src/components/features/task/filter/in-view/filter-pill.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Component, ExtraButtonComponent } from "obsidian"; import { ActiveFilter, FilterPillOptions } from "./filter-type"; @@ -37,7 +38,7 @@ export class FilterPill extends Component { // Create the remove button const removeButton = pill.createEl("span", { cls: "filter-pill-remove", - attr: { "aria-label": "Remove filter" }, + attr: { "aria-label": settingsText("Remove filter") }, }); // Create and append the remove icon span inside the button diff --git a/src/components/features/task/view/InlineEditor.ts b/src/components/features/task/view/InlineEditor.ts index 3c6d21e28..72e39a446 100644 --- a/src/components/features/task/view/InlineEditor.ts +++ b/src/components/features/task/view/InlineEditor.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { App, Component, debounce, setIcon, Menu } from "obsidian"; import { StandardTaskMetadata, Task } from "@/types/task"; import TaskProgressBarPlugin from "@/index"; @@ -587,7 +588,7 @@ export class InlineEditor extends Component { // Add priority options const options = [ - { value: "", text: "None" }, + { value: "", text: settingsText("None") }, { value: "1", text: "⏬️ Lowest" }, { value: "2", text: "🔽 Low" }, { value: "3", text: "🔼 Medium" }, @@ -995,17 +996,17 @@ export class InlineEditor extends Component { const menu = new Menu(); const availableFields = [ - { key: "project", label: "Project", icon: "folder" }, - { key: "tags", label: "Tags", icon: "tag" }, - { key: "context", label: "Context", icon: "at-sign" }, - { key: "dueDate", label: "Due Date", icon: "calendar" }, - { key: "startDate", label: "Start Date", icon: "play" }, - { key: "scheduledDate", label: "Scheduled Date", icon: "clock" }, + { key: "project", label: settingsText("Project"), icon: "folder" }, + { key: "tags", label: settingsText("Tags"), icon: "tag" }, + { key: "context", label: settingsText("Context"), icon: "at-sign" }, + { key: "dueDate", label: settingsText("Due Date"), icon: "calendar" }, + { key: "startDate", label: settingsText("Start Date"), icon: "play" }, + { key: "scheduledDate", label: settingsText("Scheduled Date"), icon: "clock" }, { key: "cancelledDate", label: "Cancelled Date", icon: "x" }, { key: "completedDate", label: "Completed Date", icon: "check" }, - { key: "priority", label: "Priority", icon: "alert-triangle" }, - { key: "recurrence", label: "Recurrence", icon: "repeat" }, - { key: "onCompletion", label: "On Completion", icon: "flag" }, + { key: "priority", label: settingsText("Priority"), icon: "alert-triangle" }, + { key: "recurrence", label: settingsText("Recurrence"), icon: "repeat" }, + { key: "onCompletion", label: settingsText("On Completion"), icon: "flag" }, { key: "dependsOn", label: "Depends On", icon: "link" }, { key: "id", label: "Task ID", icon: "hash" }, ]; diff --git a/src/components/features/task/view/listItem.ts b/src/components/features/task/view/listItem.ts index 1d57155c4..dd86594bf 100644 --- a/src/components/features/task/view/listItem.ts +++ b/src/components/features/task/view/listItem.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { App, Component, @@ -960,17 +961,17 @@ export class TaskListItemComponent extends Component { const menu = new Menu(); const availableFields = [ - { key: "project", label: "Project", icon: "folder" }, - { key: "tags", label: "Tags", icon: "tag" }, - { key: "context", label: "Context", icon: "at-sign" }, - { key: "dueDate", label: "Due Date", icon: "calendar" }, - { key: "startDate", label: "Start Date", icon: "play" }, - { key: "scheduledDate", label: "Scheduled Date", icon: "clock" }, + { key: "project", label: settingsText("Project"), icon: "folder" }, + { key: "tags", label: settingsText("Tags"), icon: "tag" }, + { key: "context", label: settingsText("Context"), icon: "at-sign" }, + { key: "dueDate", label: settingsText("Due Date"), icon: "calendar" }, + { key: "startDate", label: settingsText("Start Date"), icon: "play" }, + { key: "scheduledDate", label: settingsText("Scheduled Date"), icon: "clock" }, { key: "cancelledDate", label: "Cancelled Date", icon: "x" }, { key: "completedDate", label: "Completed Date", icon: "check" }, - { key: "priority", label: "Priority", icon: "alert-triangle" }, - { key: "recurrence", label: "Recurrence", icon: "repeat" }, - { key: "onCompletion", label: "On Completion", icon: "flag" }, + { key: "priority", label: settingsText("Priority"), icon: "alert-triangle" }, + { key: "recurrence", label: settingsText("Recurrence"), icon: "repeat" }, + { key: "onCompletion", label: settingsText("On Completion"), icon: "flag" }, { key: "dependsOn", label: "Depends On", icon: "link" }, { key: "id", label: "Task ID", icon: "hash" }, ]; diff --git a/src/components/features/task/view/treeItem.ts b/src/components/features/task/view/treeItem.ts index 42d371716..70d319e28 100644 --- a/src/components/features/task/view/treeItem.ts +++ b/src/components/features/task/view/treeItem.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { App, Component, @@ -1038,17 +1039,17 @@ export class TaskTreeItemComponent extends Component { const menu = new Menu(); const availableFields = [ - { key: "project", label: "Project", icon: "folder" }, - { key: "tags", label: "Tags", icon: "tag" }, - { key: "context", label: "Context", icon: "at-sign" }, - { key: "dueDate", label: "Due Date", icon: "calendar" }, - { key: "startDate", label: "Start Date", icon: "play" }, - { key: "scheduledDate", label: "Scheduled Date", icon: "clock" }, + { key: "project", label: settingsText("Project"), icon: "folder" }, + { key: "tags", label: settingsText("Tags"), icon: "tag" }, + { key: "context", label: settingsText("Context"), icon: "at-sign" }, + { key: "dueDate", label: settingsText("Due Date"), icon: "calendar" }, + { key: "startDate", label: settingsText("Start Date"), icon: "play" }, + { key: "scheduledDate", label: settingsText("Scheduled Date"), icon: "clock" }, { key: "cancelledDate", label: "Cancelled Date", icon: "x" }, { key: "completedDate", label: "Completed Date", icon: "check" }, - { key: "priority", label: "Priority", icon: "alert-triangle" }, - { key: "recurrence", label: "Recurrence", icon: "repeat" }, - { key: "onCompletion", label: "On Completion", icon: "flag" }, + { key: "priority", label: settingsText("Priority"), icon: "alert-triangle" }, + { key: "recurrence", label: settingsText("Recurrence"), icon: "repeat" }, + { key: "onCompletion", label: settingsText("On Completion"), icon: "flag" }, { key: "dependsOn", label: "Depends On", icon: "link" }, { key: "id", label: "Task ID", icon: "hash" }, ]; diff --git a/src/components/ui/date-picker/BulkDateOffsetModal.ts b/src/components/ui/date-picker/BulkDateOffsetModal.ts index 8f6a8452f..a544fba20 100644 --- a/src/components/ui/date-picker/BulkDateOffsetModal.ts +++ b/src/components/ui/date-picker/BulkDateOffsetModal.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; /** * Bulk Date Offset Modal * Modal for postponing/advancing dates by a relative offset for bulk operations @@ -104,7 +105,7 @@ export class BulkDateOffsetModal extends Modal { customInput.max = "365"; new ButtonComponent(customInputContainer) - .setButtonText("Apply") + .setButtonText(settingsText("Apply")) .setCta() .onClick(() => { const days = parseInt(customInput.value) || 0; diff --git a/src/components/ui/modals/CalendarViewConfigModal.ts b/src/components/ui/modals/CalendarViewConfigModal.ts index bd3a5f3ea..2f8af679f 100644 --- a/src/components/ui/modals/CalendarViewConfigModal.ts +++ b/src/components/ui/modals/CalendarViewConfigModal.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { App, Modal, @@ -22,13 +23,13 @@ import { attachIconMenu } from "@/components/ui/menus/IconMenu"; * Days of the week for custom day filter */ const WEEKDAYS = [ - { value: 0, label: "Sunday", short: "Sun" }, - { value: 1, label: "Monday", short: "Mon" }, - { value: 2, label: "Tuesday", short: "Tue" }, - { value: 3, label: "Wednesday", short: "Wed" }, - { value: 4, label: "Thursday", short: "Thu" }, - { value: 5, label: "Friday", short: "Fri" }, - { value: 6, label: "Saturday", short: "Sat" }, + { value: 0, label: settingsText("Sunday"), short: "Sun" }, + { value: 1, label: settingsText("Monday"), short: "Mon" }, + { value: 2, label: settingsText("Tuesday"), short: "Tue" }, + { value: 3, label: settingsText("Wednesday"), short: "Wed" }, + { value: 4, label: settingsText("Thursday"), short: "Thu" }, + { value: 5, label: settingsText("Friday"), short: "Fri" }, + { value: 6, label: settingsText("Saturday"), short: "Sat" }, ]; /** diff --git a/src/components/ui/modals/IframeModal.ts b/src/components/ui/modals/IframeModal.ts index c826f06f0..90a22997c 100644 --- a/src/components/ui/modals/IframeModal.ts +++ b/src/components/ui/modals/IframeModal.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { App, Modal, setIcon } from "obsidian"; export class IframeModal extends Modal { @@ -21,8 +22,8 @@ export class IframeModal extends Modal { const externalLinkBtn = headerActions.createEl('button', { cls: 'clickable-icon task-genius-external-link-btn', attr: { - 'aria-label': 'Open in external browser', - 'title': 'Open in external browser' + 'aria-label': settingsText('Open in external browser'), + 'title': settingsText('Open in external browser') } }); diff --git a/src/components/ui/modals/McpLogModal.ts b/src/components/ui/modals/McpLogModal.ts index df0e3f961..7b4e5f24e 100644 --- a/src/components/ui/modals/McpLogModal.ts +++ b/src/components/ui/modals/McpLogModal.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { Modal, ButtonComponent, ExtraButtonComponent } from "obsidian"; import TaskProgressBarPlugin from "@/index"; import { McpLogEntry } from "@/mcp/McpServer"; @@ -22,7 +23,7 @@ export class McpLogModal extends Modal { } onOpen() { - this.titleEl.setText("MCP Server Logs"); + this.titleEl.setText(settingsText("MCP Server Logs")); this.modalEl.addClass("mcp-log-modal"); // Header section with search and clear @@ -34,14 +35,14 @@ export class McpLogModal extends Modal { }); this.searchInput = searchContainer.createEl("input", { type: "text", - placeholder: "Search logs...", + placeholder: settingsText("Search logs..."), cls: "mcp-log-search-input", }); this.searchInput.addEventListener("input", () => this.filterLogs()); // Clear logs button new ButtonComponent(headerEl) - .setButtonText("Clear Logs") + .setButtonText(settingsText("Clear Logs")) .setIcon("trash") .setWarning() .onClick(() => { @@ -68,7 +69,7 @@ export class McpLogModal extends Modal { cls: "modal-button-container", }); - new ButtonComponent(footerEl).setButtonText("Refresh").onClick(() => { + new ButtonComponent(footerEl).setButtonText(settingsText("Refresh")).onClick(() => { if (this.plugin.mcpServerManager?.getServer()) { this.logs = this.plugin.mcpServerManager.getServer()?.getLogs() || []; @@ -76,7 +77,7 @@ export class McpLogModal extends Modal { } }); - new ButtonComponent(footerEl).setButtonText("Close").onClick(() => { + new ButtonComponent(footerEl).setButtonText(settingsText("Close")).onClick(() => { this.close(); }); } @@ -107,7 +108,7 @@ export class McpLogModal extends Modal { const statsText = container.createDiv({ cls: "mcp-log-stats-text" }); statsText.setText( - `Total: ${totalLogs} | Success: ${successCount} | Errors: ${errorCount}` + settingsText("Total: {{value0}} | Success: {{value1}} | Errors: {{value2}}", { interpolation: { value0: String(totalLogs), value1: String(successCount), value2: String(errorCount) } }) ); } @@ -121,8 +122,8 @@ export class McpLogModal extends Modal { emptyEl.createEl("p", { text: this.logs.length === 0 - ? "No logs yet. Tool calls will appear here." - : "No logs match your search.", + ? settingsText("No logs yet. Tool calls will appear here.") + : settingsText("No logs match your search."), }); return; } @@ -151,7 +152,7 @@ export class McpLogModal extends Modal { // Duration const duration = headerRow.createDiv({ cls: "mcp-log-duration" }); - duration.setText(`${log.duration}ms`); + duration.setText(settingsText("{{value0}}ms", { interpolation: { value0: String(log.duration) } })); // Session ID (if available) if (log.sessionId) { @@ -184,7 +185,7 @@ export class McpLogModal extends Modal { }); argsSection.createEl("div", { cls: "mcp-log-section-title", - text: "Arguments:", + text: settingsText("Arguments:"), }); const argsContent = argsSection.createEl("pre", { cls: "mcp-log-section-content", @@ -199,7 +200,7 @@ export class McpLogModal extends Modal { }); errorSection.createEl("div", { cls: "mcp-log-section-title mcp-log-error-title", - text: "Error:", + text: settingsText("Error:"), }); const errorContent = errorSection.createEl("pre", { cls: "mcp-log-section-content mcp-log-error-content", @@ -211,13 +212,13 @@ export class McpLogModal extends Modal { }); const resultTitle = resultSection.createEl("div", { cls: "mcp-log-section-title", - text: "Result:", + text: settingsText("Result:"), }); if (log.truncated) { resultTitle.createEl("span", { cls: "mcp-log-truncated-badge", - text: " (truncated)", + text: settingsText(" (truncated)"), }); } diff --git a/src/dataflow/Orchestrator.ts b/src/dataflow/Orchestrator.ts index 0caca6244..8a3a68dbe 100644 --- a/src/dataflow/Orchestrator.ts +++ b/src/dataflow/Orchestrator.ts @@ -1,3 +1,4 @@ +import { snapshotIndexSettings } from "./settings-signature"; import { App, TFile, Vault, MetadataCache, EventRef, debounce } from "obsidian"; import type { Task, TgProject } from "../types/task"; import type { ProjectConfigManagerOptions } from "../managers/project-config-manager"; @@ -64,6 +65,9 @@ export class DataflowOrchestrator { // Track last processed sequence to avoid infinite loops private lastProcessedSeq: number = 0; + private indexSettingsSignature: string; + private fileFilterSignature: string | undefined; + private settingsUpdateQueue: Promise = Promise.resolve(); constructor( private app: App, @@ -72,6 +76,8 @@ export class DataflowOrchestrator { private plugin: any, // Plugin instance for parser access projectOptions?: Partial, ) { + this.indexSettingsSignature = snapshotIndexSettings(plugin.settings); + this.fileFilterSignature = JSON.stringify(plugin.settings?.fileFilter); // Initialize components this.queryAPI = new QueryAPI(app, vault, metadataCache); this.repository = this.queryAPI.getRepository(); @@ -461,6 +467,10 @@ export class DataflowOrchestrator { ); if (reason === "delete") { + const pending = this.processingQueue.get(path); + if (pending) clearTimeout(pending); + this.processingQueue.delete(path); + this.projectResolver.clearCache(path); // Remove file from index await this.repository.removeFile(path); } else { @@ -469,6 +479,11 @@ export class DataflowOrchestrator { path, ) as TFile; if (file) { + if (reason !== "error") { + this.projectResolver.clearCache(path); + this.augmentor.clearCache(); + await this.storage.clearFile(path); + } await this.processFile(file); } } @@ -822,6 +837,8 @@ export class DataflowOrchestrator { augmentedTasks = await this.augmentor.merge(augmentContext); } + if (!this.vault.getAbstractFileByPath(filePath)) return; + // Step 3: Update repository (index + storage + events) // Generate a unique sequence for this operation this.lastProcessedSeq = Seq.next(); @@ -848,7 +865,14 @@ export class DataflowOrchestrator { /** * Update settings and propagate to components */ - updateSettings(settings: any): void { + updateSettings(settings: any): Promise { + this.settingsUpdateQueue = this.settingsUpdateQueue.catch(() => {}).then(() => this.applySettings(settings)); + return this.settingsUpdateQueue; + } + + private async applySettings(settings: any): Promise { + const indexSignature = snapshotIndexSettings(settings); + const filterSignature = JSON.stringify(settings?.fileFilter); // Update worker processing setting const enableWorkerProcessing = settings?.fileSource?.performance?.enableWorkerProcessing ?? @@ -1002,7 +1026,7 @@ export class DataflowOrchestrator { (this.repository as any).setFileFilterManager?.( this.fileFilterManager, ); - fileFilterChanged = true; + fileFilterChanged = filterSignature !== this.fileFilterSignature; } if (fileFilterChanged) { @@ -1030,6 +1054,13 @@ export class DataflowOrchestrator { }); this.restoreByFilterDebounced?.(); } + if (indexSignature !== this.indexSettingsSignature) { + await this.onSettingsChange(["parser", "augment", "project"]); + } else { + emit(this.app, Events.SETTINGS_CHANGED, { scopes: [], timestamp: Date.now() }); + } + this.indexSettingsSignature = indexSignature; + this.fileFilterSignature = filterSignature; } /** @@ -1702,6 +1733,8 @@ export class DataflowOrchestrator { * Clear all data and rebuild */ async rebuild(): Promise { + this.projectResolver.clearCache(); + this.augmentor.clearCache(); // Clear all data await this.repository.clear(); @@ -1722,6 +1755,7 @@ export class DataflowOrchestrator { // Persist the rebuilt index await this.repository.persist(); + await this.queryAPI.refreshCache(); // Emit ready event emit(this.app, Events.CACHE_READY, { @@ -1744,6 +1778,7 @@ export class DataflowOrchestrator { await this.storage.clearNamespace("augmented"); await this.storage.clearNamespace("project"); this.projectResolver.clearCache(); + this.augmentor.clearCache(); } if (scopes.includes("index")) { diff --git a/src/dataflow/api/QueryAPI.ts b/src/dataflow/api/QueryAPI.ts index e7b551c4e..1c655d401 100644 --- a/src/dataflow/api/QueryAPI.ts +++ b/src/dataflow/api/QueryAPI.ts @@ -208,6 +208,11 @@ export class QueryAPI { /** * Update the synchronous cache with fresh data */ + /** Refresh synchronous readers after a repository rebuild. */ + public async refreshCache(): Promise { + await this.updateCache(); + } + private async updateCache(): Promise { this.taskCache = await this.repository.all(); this.cacheTimestamp = Date.now(); diff --git a/src/dataflow/augment/Augmentor.ts b/src/dataflow/augment/Augmentor.ts index 8e268ebbe..e067b692b 100644 --- a/src/dataflow/augment/Augmentor.ts +++ b/src/dataflow/augment/Augmentor.ts @@ -85,6 +85,11 @@ export class Augmentor { } } + /** Discard derived dates after source metadata or settings change. */ + public clearCache(): void { + this.dateInheritanceAugmentor?.clearCache(); + } + /** * Update settings from plugin to control inheritance behavior */ diff --git a/src/dataflow/indexer/Repository.ts b/src/dataflow/indexer/Repository.ts index ed9ab3d63..10e08ed6b 100644 --- a/src/dataflow/indexer/Repository.ts +++ b/src/dataflow/indexer/Repository.ts @@ -1,3 +1,4 @@ +import { removeBlankTasks } from "@/utils/task/removeBlankTasks"; import type { Task, TaskCache, @@ -84,6 +85,22 @@ export class Repository { `[Repository] Found persisted snapshot with ${snapshotTaskCount} tasks, restoring...` ); await this.indexer.restoreFromSnapshot(consolidated.data); + // Old snapshots can contain empty placeholders even when no file has + // changed since the upgrade. Normalize before publishing CACHE_READY. + const restored = await this.indexer.getAllTasks(); + const byFile = new Map(); + for (const task of restored) { + if (!byFile.has(task.filePath)) byFile.set(task.filePath, []); + byFile.get(task.filePath)!.push(task); + } + for (const [filePath, tasks] of byFile) { + const normalized = removeBlankTasks(tasks); + if (normalized !== tasks) { + await this.indexer.updateIndexWithTasks(filePath, normalized); + await this.storage.storeAugmented(filePath, normalized); + } + } + const taskCount = await this.indexer.getTotalTaskCount(); console.log( @@ -135,6 +152,7 @@ export class Repository { sourceSeq?: number, options?: { persist?: boolean; forceEmit?: boolean } ): Promise { + tasks = removeBlankTasks(tasks); const persist = options?.persist !== false; // default true const forceEmit = options?.forceEmit === true; // Check if tasks have actually changed relative to storage @@ -190,7 +208,8 @@ export class Repository { let hasActualChanges = false; // Process each file update and check for actual changes - for (const [filePath, tasks] of updates) { + for (const [filePath, incomingTasks] of updates) { + const tasks = removeBlankTasks(incomingTasks); // Check if tasks have actually changed relative to storage const existingAugmented = await this.storage.loadAugmented( filePath diff --git a/src/dataflow/settings-signature.ts b/src/dataflow/settings-signature.ts new file mode 100644 index 000000000..a8dbe88b3 --- /dev/null +++ b/src/dataflow/settings-signature.ts @@ -0,0 +1,21 @@ +/** Parser and inheritance settings that require rebuilding existing tasks. */ +export const INDEX_SETTING_FIELDS = [ + "taskStatuses", "fileParsingConfig", "timeParsing", "preferMetadataFormat", + "enableCustomDateFormats", "customDateFormats", "projectTagPrefix", + "contextTagPrefix", "areaTagPrefix", "useDailyNotePathAsDate", + "dailyNoteFormat", "useAsDateType", "dailyNotePath", "ignoreHeading", "focusHeading", + "fileSource.recognitionStrategies", "fileSource.fileTaskProperties", + "fileSource.relationships", "fileMetadataInheritance", "projectConfig", +] as const; + +/** Capture values, rather than references, because settings are edited in place. */ +export function snapshotIndexSettings(settings: unknown): string { + return JSON.stringify(INDEX_SETTING_FIELDS.map(field => { + let value = settings; + for (const key of field.split(".")) { + value = value && typeof value === "object" + ? (value as Record)[key] : undefined; + } + return value; + })); +} diff --git a/src/index.ts b/src/index.ts index 47bb748e9..5eeba7f04 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2093,6 +2093,11 @@ export default class TaskProgressBarPlugin extends Plugin { } } } + for (const leaf of this.app.workspace.getLeavesOfType("fluent-task-genius-view")) { + const view = leaf.view as any; + view.layoutManager?.sidebar?.render(); + await view.dataManager?.loadTasks(false); + } } /** diff --git a/src/setting.ts b/src/setting.ts index 7c6438df6..451a7564f 100644 --- a/src/setting.ts +++ b/src/setting.ts @@ -1,3 +1,4 @@ +import { t as settingsText } from "@/translations/helper"; import { App, PluginSettingTab, @@ -150,7 +151,7 @@ export class TaskProgressBarSettingTab extends PluginSettingTab { }, { id: "task-timer", - name: "Task Timer", + name: settingsText("Task Timer"), icon: "timer", category: "workflow", }, diff --git a/src/translations/locale/en.ts b/src/translations/locale/en.ts index 0cedf5156..50cc83c79 100644 --- a/src/translations/locale/en.ts +++ b/src/translations/locale/en.ts @@ -2630,6 +2630,553 @@ const translations = { "Automatically start the timer when creating a new task via quick capture (checkbox mode only)": "Automatically start the timer when creating a new task via quick capture (checkbox mode only)", "Timer started for new task": "Timer started for new task", + + " (truncated)": " (truncated)", + "(Copy)": "(Copy)", + "(space)": "(space)", + "+ Add Custom Cycle": "+ Add Custom Cycle", + "+ Add Status": "+ Add Status", + ", Replacement: ": ", Replacement: ", + "0.0.0.0 (All interfaces - for external access)": "0.0.0.0 (All interfaces - for external access)", + "1 → 2 → 3 → 4 → 5": "1 → 2 → 3 → 4 → 5", + "1) Initialize": "1) Initialize", + "127.0.0.1 (Local only)": "127.0.0.1 (Local only)", + "2) Call tool with session id": "2) Call tool with session id", + "A descriptive name for the workspace": "A descriptive name for the workspace", + "Active strategies: ": "Active strategies: ", + "Add Custom Mapping": "Add Custom Mapping", + "Add Cycle": "Add Cycle", + "Add Detailed Cycle": "Add Detailed Cycle", + "Add Detection Method": "Add Detection Method", + "Add File": "Add File", + "Add Folder": "Add Folder", + "Add Number Cycle": "Add Number Cycle", + "Add Pattern": "Add Pattern", + "Add Simple Cycle": "Add Simple Cycle", + "Add custom status mappings for your workflow.": "Add custom status mappings for your workflow.", + "Add metadata fields that indicate a file should be treated as a task (e.g., dueDate, status, priority)": "Add metadata fields that indicate a file should be treated as a task (e.g., dueDate, status, priority)", + "Add paths that contain task files (e.g., Projects/, Tasks/2024/, Work/TODO/)": "Add paths that contain task files (e.g., Projects/, Tasks/2024/, Work/TODO/)", + "Add progress bar to Projects view": "Add progress bar to Projects view", + "Add tags that indicate a file should be treated as a task (e.g., #task, #todo, #actionable)": "Add tags that indicate a file should be treated as a task (e.g., #task, #todo, #actionable)", + "Add {{value0}} Theme as New Cycle?": "Add {{value0}} Theme as New Cycle?", + "Agenda View": "Agenda View", + "All Workspaces": "All Workspaces", + "All history": "All history", + "All settings have been reset to their default values": "All settings have been reset to their default values", + "Allow files to be recognized and treated as tasks based on their metadata, tags, or file paths. This provides advanced recognition strategies beyond simple metadata parsing.": "Allow files to be recognized and treated as tasks based on their metadata, tags, or file paths. This provides advanced recognition strategies beyond simple metadata parsing.", + "Applied recommended configuration: ": "Applied recommended configuration: ", + "Apply {{value0}} Theme?": "Apply {{value0}} Theme?", + "Are you sure you want to delete \"{{name}}\"? This action cannot be undone.": "Are you sure you want to delete \"{{name}}\"? This action cannot be undone.", + "Are you sure you want to delete the '{{value0}}' workflow?": "Are you sure you want to delete the '{{value0}}' workflow?", + "Are you sure you want to delete the habit ": "Are you sure you want to delete the habit ", + "Are you sure you want to reset all settings to their default values?\n\nThis action cannot be undone.": "Are you sure you want to reset all settings to their default values?\n\nThis action cannot be undone.", + "Arguments:": "Arguments:", + "Auto-detect Status Mappings": "Auto-detect Status Mappings", + "Automatically convert between metadata status values and task symbols": "Automatically convert between metadata status values and task symbols", + "Automatically sync with task status configuration": "Automatically sync with task status configuration", + "Base View Type": "Base View Type", + "Based on: ": "Based on: ", + "Bases Support": "Bases Support", + "Basic": "Basic", + "Blacklist": "Blacklist", + "Block References": "Block References", + "Block reference prefix": "Block reference prefix", + "Both": "Both", + "Bottom Section": "Bottom Section", + "Built-in View Templates": "Built-in View Templates", + "Cache TTL": "Cache TTL", + "Calendar View Configuration": "Calendar View Configuration", + "Calendar Views": "Calendar Views", + "Calendar view created: ": "Calendar view created: ", + "Calendar view updated: ": "Calendar view updated: ", + "Cannot enable views without indexer. Please enable the indexer first in Index & Sources settings.": "Cannot enable views without indexer. Please enable the indexer first in Index & Sources settings.", + "Capture as:": "Capture as:", + "Capture to:": "Capture to:", + "Case Sensitive Matching": "Case Sensitive Matching", + "Changelog": "Changelog", + "Choose a color for this workspace": "Choose a color for this workspace", + "Choose a preset or customize the time range": "Choose a preset or customize the time range", + "Choose an icon for this view": "Choose an icon for this view", + "Choose an icon for this workspace": "Choose an icon for this workspace", + "Choose the note that should be copied; {{CONTENT}} placeholders are replaced, otherwise the captured text is appended.": "Choose the note that should be copied; {{CONTENT}} placeholders are replaced, otherwise the captured text is appended.", + "Choose where this view appears in the sidebar. Views in the bottom section are visually separated from top section views.": "Choose where this view appears in the sidebar. Views in the bottom section are visually separated from top section views.", + "Choose your preferred interface style and configure how Task Genius displays in your workspace.": "Choose your preferred interface style and configure how Task Genius displays in your workspace.", + "Classic": "Classic", + "Classic & Familiar": "Classic & Familiar", + "Clear Logs": "Clear Logs", + "Click the button below to automatically add this MCP server to Cursor:": "Click the button below to automatically add this MCP server to Cursor:", + "Collapse/Expand": "Collapse/Expand", + "Comma-separated list of folder paths where task timer should be enabled": "Comma-separated list of folder paths where task timer should be enabled", + "Comma-separated list of tags that enable task timer": "Comma-separated list of tags that enable task timer", + "Common Mappings": "Common Mappings", + "Completed Tasks": "Completed Tasks", + "Config File-based Project Detection": "Config File-based Project Detection", + "Configure Symbols": "Configure Symbols", + "Configure Task Fields": "Configure Task Fields", + "Configure Task Paths": "Configure Task Paths", + "Configure Task Tags": "Configure Task Tags", + "Configure additional methods to detect project files": "Configure additional methods to detect project files", + "Configure file filtering to improve indexing performance and focus on relevant content": "Configure file filtering to improve indexing performance and focus on relevant content", + "Configure hidden modules": "Configure hidden modules", + "Configure how dates and times are displayed in views.": "Configure how dates and times are displayed in views.", + "Configure how files are recognized as tasks. At least one strategy must be enabled.": "Configure how files are recognized as tasks. At least one strategy must be enabled.", + "Configure inline editing and metadata positioning.": "Configure inline editing and metadata positioning.", + "Configure keywords for date parsing": "Configure keywords for date parsing", + "Configure metadata fields that indicate a file should be treated as a task (e.g., dueDate, status, priority)": "Configure metadata fields that indicate a file should be treated as a task (e.g., dueDate, status, priority)", + "Configure multiple status cycles with different workflows. You can apply preset themes or create custom cycles.": "Configure multiple status cycles with different workflows. You can apply preset themes or create custom cycles.", + "Configure options specific to the Fluent interface.": "Configure options specific to the Fluent interface.", + "Configure paths that contain task files (e.g., Projects/, Tasks/2024/, Work/TODO/)": "Configure paths that contain task files (e.g., Projects/, Tasks/2024/, Work/TODO/)", + "Configure project detection from project configuration files": "Configure project detection from project configuration files", + "Configure project display, organization and metadata mappings": "Configure project display, organization and metadata mappings", + "Configure symbols that represent abandoned tasks in square brackets": "Configure symbols that represent abandoned tasks in square brackets", + "Configure symbols that represent completed tasks in square brackets": "Configure symbols that represent completed tasks in square brackets", + "Configure symbols that represent not started tasks in square brackets. Default is space \" \"": "Configure symbols that represent not started tasks in square brackets. Default is space \" \"", + "Configure symbols that represent planned tasks in square brackets": "Configure symbols that represent planned tasks in square brackets", + "Configure symbols that represent tasks in progress in square brackets": "Configure symbols that represent tasks in progress in square brackets", + "Configure system tray, notifications, and desktop features": "Configure system tray, notifications, and desktop features", + "Configure tags that indicate a file should be treated as a task (e.g., #task, #todo, #actionable)": "Configure tags that indicate a file should be treated as a task (e.g., #task, #todo, #actionable)", + "Configure the format of time expressions": "Configure the format of time expressions", + "Configure which files, folders, or patterns are included during task indexing.": "Configure which files, folders, or patterns are included during task indexing.", + "Configure which modules should be hidden in this workspace. Hidden views will not appear in the sidebar.": "Configure which modules should be hidden in this workspace. Hidden views will not appear in the sidebar.", + "Contains match": "Contains match", + "Control which days are displayed in the calendar": "Control which days are displayed in the calendar", + "Copy Install Link": "Copy Install Link", + "Copy Settings From": "Copy Settings From", + "Copy settings from an existing workspace": "Copy settings from an existing workspace", + "Copy this cycle": "Copy this cycle", + "Create": "Create", + "Create Calendar View": "Create Calendar View", + "Create New Calendar View": "Create New Calendar View", + "Create New Workspace": "Create New Workspace", + "Create a backup of active timers": "Create a backup of active timers", + "Create a custom view from the templates above to get started.": "Create a custom view from the templates above to get started.", + "Create a new workspace with custom settings": "Create a new workspace with custom settings", + "Create custom calendar views based on Month, Week, or Day views. Each custom view can have its own display settings.": "Create custom calendar views based on Month, Week, or Day views. Each custom view can have its own display settings.", + "Create task timer backup": "Create task timer backup", + "Current Workspace": "Current Workspace", + "Custom Calendar Views": "Custom Calendar Views", + "Custom Content Field": "Custom Content Field", + "Custom Cycle": "Custom Cycle", + "Custom Date Formats": "Custom Date Formats", + "Custom Mappings": "Custom Mappings", + "Custom Project Detection Methods": "Custom Project Detection Methods", + "Custom Range": "Custom Range", + "Custom Selection": "Custom Selection", + "Custom days": "Custom days", + "Custom marker": "Custom marker", + "Custom metadata field": "Custom metadata field", + "Customize how dates are displayed in headers": "Customize how dates are displayed in headers", + "Daily summary": "Daily summary", + "Data Management": "Data Management", + "Date Filter": "Date Filter", + "Date and Time Display": "Date and Time Display", + "Date marker": "Date marker", + "Day Filter": "Day Filter", + "Day Header Format": "Day Header Format", + "Day View": "Day View", + "Days to Show": "Days to Show", + "Default": "Default", + "Default Cycle": "Default Cycle", + "Default Task Status": "Default Task Status", + "Default file name template": "Default file name template", + "Default folder for new files": "Default folder for new files", + "Default settings": "Default settings", + "Default status for newly created file tasks": "Default status for newly created file tasks", + "Default workspace": "Default workspace", + "Default workspace cannot be deleted": "Default workspace cannot be deleted", + "Define the statuses in cycling order": "Define the statuses in cycling order", + "Delete Workspace": "Delete Workspace", + "Delete this cycle": "Delete this cycle", + "Desktop Integration": "Desktop Integration", + "Desktop integration features are only available in the desktop app": "Desktop integration features are only available in the desktop app", + "Desktop only": "Desktop only", + "Detailed": "Detailed", + "Display": "Display", + "Display a full year with 12 mini-month calendars": "Display a full year with 12 mini-month calendars", + "Display days with no events": "Display days with no events", + "Display event count badges on date cells": "Display event count badges on date cells", + "Display name for this calendar view": "Display name for this calendar view", + "Display tasks for a single day with detailed time slots": "Display tasks for a single day with detailed time slots", + "Display tasks in a monthly calendar grid": "Display tasks in a monthly calendar grid", + "Display tasks in a weekly time grid with hourly slots": "Display tasks in a weekly time grid with hourly slots", + "Display timer usage statistics": "Display timer usage statistics", + "Display upcoming tasks in a list format grouped by day": "Display upcoming tasks in a list format grouped by day", + "Display week numbers in the month view": "Display week numbers in the month view", + "Drag to reorder": "Drag to reorder", + "Drag views between sections or within sections to reorder them. Toggle visibility with the eye icon.": "Drag views between sections or within sections to reorder them. Toggle visibility with the eye icon.", + "Edit Calendar View": "Edit Calendar View", + "Edit File Filter Rules": "Edit File Filter Rules", + "Editor Configuration": "Editor Configuration", + "Enable Base View functionality. This feature provides enhanced view management capabilities but may be affected by future Obsidian API changes.": "Enable Base View functionality. This feature provides enhanced view management capabilities but may be affected by future Obsidian API changes.", + "Enable Base View functionality. This feature provides enhanced view management capabilities but may be affected by future Obsidian API changes. You may need to restart Obsidian to see the changes.": "Enable Base View functionality. This feature provides enhanced view management capabilities but may be affected by future Obsidian API changes. You may need to restart Obsidian to see the changes.", + "Enable File Task": "Enable File Task", + "Enable Task Genius Views": "Enable Task Genius Views", + "Enable Task Genius Views above to configure view settings.": "Enable Task Genius Views above to configure view settings.", + "Enable Task Genius sidebar views to display and manage tasks. Requires the indexer to be enabled.": "Enable Task Genius sidebar views to display and manage tasks. Requires the indexer to be enabled.", + "Enable Task Timer": "Enable Task Timer", + "Enable Time Filter": "Enable Time Filter", + "Enable case-sensitive matching for status values": "Enable case-sensitive matching for status values", + "Enable notifications": "Enable notifications", + "Enable project features": "Enable project features", + "Enable task timer functionality for tracking time spent on tasks": "Enable task timer functionality for tracking time spent on tasks", + "Enable/disable this cycle": "Enable/disable this cycle", + "End Hour": "End Hour", + "Enhanced": "Enhanced", + "Enter details for {{value0}}...": "Enter details for {{value0}}...", + "Enter metadata field name": "Enter metadata field name", + "Enter metadata value and symbol (e.g., 'done:x')": "Enter metadata value and symbol (e.g., 'done:x')", + "Enter new name": "Enter new name", + "Enter path (e.g., Projects/, Tasks/**/*.md)": "Enter path (e.g., Projects/, Tasks/**/*.md)", + "Enter tag (e.g., #task)": "Enter tag (e.g., #task)", + "Enter workspace name": "Enter workspace name", + "Error rendering format": "Error rendering format", + "Error:": "Error:", + "Exact match": "Exact match", + "Examples of time expressions": "Examples of time expressions", + "Examples:": "Examples:", + "Exclude Archive Folder": "Exclude Archive Folder", + "Exclude Temporary Files": "Exclude Temporary Files", + "Export all timer data to JSON": "Export all timer data to JSON", + "Export task timer data": "Export task timer data", + "Export task timer data (YAML)": "Export task timer data (YAML)", + "Export to YAML format": "Export to YAML format", + "Failed to sync mapping": "Failed to sync mapping", + "Features to be enabled": "Features to be enabled", + "Field name in frontmatter to check for enabling task timer (e.g., 'task-timer: true')": "Field name in frontmatter to check for enabling task timer (e.g., 'task-timer: true')", + "File Content": "File Content", + "File Creation Mode": "File Creation Mode", + "File Task is disabled": "File Task is disabled", + "File Task is enabled and monitoring files": "File Task is enabled and monitoring files", + "File filtering helps you focus on relevant content while improving performance, especially in large vaults.": "File filtering helps you focus on relevant content while improving performance, especially in large vaults.", + "FileSource status mapping synced": "FileSource status mapping synced", + "Filename": "Filename", + "Filter files during task indexing to improve performance": "Filter files during task indexing to improve performance", + "First H1 heading": "First H1 heading", + "First hour to display (0-23)": "First hour to display (0-23)", + "Fluent Interface Settings": "Fluent Interface Settings", + "Focus on Projects": "Focus on Projects", + "Folder paths": "Folder paths", + "Folder that contains Quick Capture templates for File mode.": "Folder that contains Quick Capture templates for File mode.", + "Format for day headers (e.g., dddd, MMMM D)": "Format for day headers (e.g., dddd, MMMM D)", + "Format for day view header (e.g., yyyy'年'M'月'd'日')": "Format for day view header (e.g., yyyy'年'M'月'd'日')", + "Format for month view header (e.g., yyyy M)": "Format for month view header (e.g., yyyy M)", + "Friday": "Friday", + "Frontmatter field": "Frontmatter field", + "Frontmatter title": "Frontmatter title", + "Full project workflow": "Full project workflow", + "Full year": "Full year", + "Glob pattern (e.g., Projects/**/*.md)": "Glob pattern (e.g., Projects/**/*.md)", + "Hidden Days": "Hidden Days", + "Hidden Modules Configuration": "Hidden Modules Configuration", + "Hide Weekends": "Hide Weekends", + "Hide from sidebar": "Hide from sidebar", + "How paths should be matched": "How paths should be matched", + "How tags should be matched against file tags": "How tags should be matched against file tags", + "If enabled, #tags in the editor content are written into YAML frontmatter tags (merged and deduplicated)": "If enabled, #tags in the editor content are written into YAML frontmatter tags (merged and deduplicated)", + "Ignore system and temporary files": "Ignore system and temporary files", + "Import task timer data": "Import task timer data", + "Import timer data from JSON file": "Import timer data from JSON file", + "Incomplete Tasks": "Incomplete Tasks", + "Index & Sources": "Index & Sources", + "Index only specific project folders": "Index only specific project folders", + "Inline": "Inline", + "Input: ": "Input: ", + "Interface": "Interface", + "Interface Mode": "Interface Mode", + "Interface Style": "Interface Style", + "Keep open after capture": "Keep open after capture", + "Keep the familiar interface and interaction style you know": "Keep the familiar interface and interaction style you know", + "Keep the modal open after capturing content": "Keep the modal open after capturing content", + "Last hour to display (0-23)": "Last hour to display (0-23)", + "Last month": "Last month", + "Last updated: {{date}}": "Last updated: {{date}}", + "Last week": "Last week", + "Last year": "Last year", + "Legacy": "Legacy", + "Link Filter": "Link Filter", + "Linked Note": "Linked Note", + "MCP Server Logs": "MCP Server Logs", + "MCP server is not running": "MCP server is not running", + "Manage Workspaces...": "Manage Workspaces...", + "Manage workspaces to organize different contexts with their own settings and filters.": "Manage workspaces to organize different contexts with their own settings and filters.", + "Manual Configuration": "Manual Configuration", + "Map between human-readable metadata values (e.g., 'completed') and task symbols (e.g., 'x').": "Map between human-readable metadata values (e.g., 'completed') and task symbols (e.g., 'x').", + "Mark": "Mark", + "Max Events Per Row": "Max Events Per Row", + "Max other views before overflow": "Max other views before overflow", + "Maximum events to show per day cell before showing '+N more'": "Maximum events to show per day cell before showing '+N more'", + "Meeting": "Meeting", + "Metadata": "Metadata", + "Metadata Detection": "Metadata Detection", + "Metadata Property": "Metadata Property", + "Metadata Value": "Metadata Value", + "Metadata-based Project Detection": "Metadata-based Project Detection", + "Metadata-based Recognition": "Metadata-based Recognition", + "Method": "Method", + "Method A (Custom Header):": "Method A (Custom Header):", + "Method B (Combined Bearer):": "Method B (Combined Bearer):", + "Migrated from legacy settings": "Migrated from legacy settings", + "Missed": "Missed", + "Modern": "Modern", + "Modern & Sleek": "Modern & Sleek", + "Mon first": "Mon first", + "Monday": "Monday", + "Month Header Format": "Month Header Format", + "Month View": "Month View", + "My Custom View": "My Custom View", + "Name of the metadata field to use as task content": "Name of the metadata field to use as task content", + "New Calendar View": "New Calendar View", + "New Name": "New Name", + "New visual design with elegant animations and modern interactions": "New visual design with elegant animations and modern interactions", + "No custom calendar views yet": "No custom calendar views yet", + "No filter rules configured yet": "No filter rules configured yet", + "No logs match your search.": "No logs match your search.", + "No logs yet. Tool calls will appear here.": "No logs yet. Tool calls will appear here.", + "No markdown notes were found in the selected folder.": "No markdown notes were found in the selected folder.", + "No weekends": "No weekends", + "Note:": "Note:", + "Notes": "Notes", + "Notify shortly before each task's due time": "Notify shortly before each task's due time", + "Number of 'Other Views' to show before grouping the rest into an overflow menu (ellipsis)": "Number of 'Other Views' to show before grouping the rest into an overflow menu (ellipsis)", + "Number of days to display in the agenda": "Number of days to display in the agenda", + "Numeric progress tracking": "Numeric progress tracking", + "Only show certain hours of the day": "Only show certain hours of the day", + "Open in external browser": "Open in external browser", + "Optimize Performance": "Optimize Performance", + "Optional: Only match links containing this text": "Optional: Only match links containing this text", + "Other Views": "Other Views", + "Path Matching Mode": "Path Matching Mode", + "Path-based Recognition": "Path-based Recognition", + "Paths": "Paths", + "Pattern: ": "Pattern: ", + "Per-task reminders": "Per-task reminders", + "Performance": "Performance", + "Please enter a name": "Please enter a name", + "Please enter a workspace name": "Please enter a workspace name", + "Populate FileSource status mapping from your checkbox status configuration": "Populate FileSource status mapping from your checkbox status configuration", + "Prefer Frontmatter Title": "Prefer Frontmatter Title", + "Prefix (e.g., Projects/ matches Projects/App.md)": "Prefix (e.g., Projects/ matches Projects/App.md)", + "Prefix for generated block reference IDs (e.g., 'timer' creates ^timer-123456-7890)": "Prefix for generated block reference IDs (e.g., 'timer' creates ^timer-123456-7890)", + "Prefix match": "Prefix match", + "Progress Tracker": "Progress Tracker", + "Projects List": "Projects List", + "Quick Add Rules": "Quick Add Rules", + "Quick Install": "Quick Install", + "Quick TODO/DONE cycle": "Quick TODO/DONE cycle", + "Quick Templates": "Quick Templates", + "Quickly add common workflow patterns": "Quickly add common workflow patterns", + "Recognition Strategies": "Recognition Strategies", + "Recognize files as tasks based on their file path": "Recognize files as tasks based on their file path", + "Recognize files as tasks if they have specific frontmatter fields": "Recognize files as tasks if they have specific frontmatter fields", + "Recognize files as tasks if they have specific tags": "Recognize files as tasks if they have specific tags", + "Recommended Configurations": "Recommended Configurations", + "Record Details for {{value0}}": "Record Details for {{value0}}", + "Regular expression (advanced)": "Regular expression (advanced)", + "Remember last mode": "Remember last mode", + "Remember the last used quick capture mode": "Remember the last used quick capture mode", + "Remove the .md extension from filename when using as task content": "Remove the .md extension from filename when using as task content", + "Remove this status": "Remove this status", + "Rename": "Rename", + "Rename Workspace": "Rename Workspace", + "Require All Fields": "Require All Fields", + "Require all specified fields to be present (otherwise any field is sufficient)": "Require all specified fields to be present (otherwise any field is sufficient)", + "Reset All Settings": "Reset All Settings", + "Reset Settings": "Reset Settings", + "Reset all settings to their default values": "Reset all settings to their default values", + "Result:": "Result:", + "Review Your Configuration": "Review Your Configuration", + "Rule {{value0}}": "Rule {{value0}}", + "Sat first": "Sat first", + "Saturday": "Saturday", + "Saved. Reopen the view to apply.": "Saved. Reopen the view to apply.", + "Scan now": "Scan now", + "Scope:": "Scope:", + "Search logs...": "Search logs...", + "Select a template folder above to enable the dropdown.": "Select a template folder above to enable the dropdown.", + "Select between the modern Fluent interface or the classic Legacy interface.": "Select between the modern Fluent interface or the classic Legacy interface.", + "Select the interface style to use.": "Select the interface style to use.", + "Select which days to hide from the calendar": "Select which days to hide from the calendar", + "Selected folder was not found in the vault.": "Selected folder was not found in the vault.", + "Send now": "Send now", + "Send one notification for today's due tasks at a specific time (HH:mm)": "Send one notification for today's due tasks at a specific time (HH:mm)", + "Set value": "Set value", + "Show All Days": "Show All Days", + "Show Empty Days": "Show Empty Days", + "Show Event Counts": "Show Event Counts", + "Show Week Numbers": "Show Week Numbers", + "Show a bell with count in system tray, status bar, or both": "Show a bell with count in system tray, status bar, or both", + "Show changelog after plugin updates": "Show changelog after plugin updates", + "Show indicator with checkbox": "Show indicator with checkbox", + "Show project progress in Projects header": "Show project progress in Projects header", + "Show task timer statistics": "Show task timer statistics", + "Show the status indicator directly next to the checkbox. When enabled, a indicator will be shown next to the checkbox.": "Show the status indicator directly next to the checkbox. When enabled, a indicator will be shown next to the checkbox.", + "Sidebar Components": "Sidebar Components", + "Sidebar Position": "Sidebar Position", + "Simple": "Simple", + "Skip archived content": "Skip archived content", + "Standard task lifecycle with all states": "Standard task lifecycle with all states", + "Start Hour": "Start Hour", + "Statistics": "Statistics", + "Status Cycles Management": "Status Cycles Management", + "Status bar": "Status bar", + "Status mappings work with your Task Status Settings. ": "Status mappings work with your Task Status Settings. ", + "Status sequence": "Status sequence", + "Strip File Extension": "Strip File Extension", + "Submit": "Submit", + "Sunday": "Sunday", + "Switch": "Switch", + "Switch Workspace": "Switch Workspace", + "Sync from Task Status Settings": "Sync from Task Status Settings", + "System Default": "System Default", + "System tray": "System tray", + "TODO → PLAN → IN PROGRESS → DONE": "TODO → PLAN → IN PROGRESS → DONE", + "TODO ↔ DONE": "TODO ↔ DONE", + "TODO.md in any direct subfolder of Work": "TODO.md in any direct subfolder of Work", + "Tag Matching Mode": "Tag Matching Mode", + "Tag-based Recognition": "Tag-based Recognition", + "Task Fields": "Task Fields", + "Task Paths": "Task Paths", + "Task Properties for Files": "Task Properties for Files", + "Task Symbol": "Task Symbol", + "Task Tags": "Task Tags", + "Task Timer": "Task Timer", + "Task Title Source": "Task Title Source", + "Task fields updated. Rebuild the task index to apply to existing files.": "Task fields updated. Rebuild the task index to apply to existing files.", + "Task paths updated. Rebuild the task index to apply to existing files.": "Task paths updated. Rebuild the task index to apply to existing files.", + "Task tags updated. Rebuild the task index to apply to existing files.": "Task tags updated. Rebuild the task index to apply to existing files.", + "Template folder": "Template folder", + "Template folder is invalid; update the folder to continue.": "Template folder is invalid; update the folder to continue.", + "Template for displaying completed task time. Use {h} for hours, {m} for minutes, {s} for seconds": "Template for displaying completed task time. Use {h} for hours, {m} for minutes, {s} for seconds", + "Template note": "Template note", + "Templates": "Templates", + "Templates/Quick Capture": "Templates/Quick Capture", + "The calendar layout this view is based on": "The calendar layout this view is based on", + "The symbols defined here should match those in your checkbox status configuration.": "The symbols defined here should match those in your checkbox status configuration.", + "This will add a new status cycle based on the {{value0}} theme.": "This will add a new status cycle based on the {{value0}} theme.", + "This will override your current checkbox status settings with the {{value0}} theme. Do you want to continue?": "This will override your current checkbox status settings with the {{value0}} theme. Do you want to continue?", + "Thursday": "Thursday", + "Time Filter": "Time Filter", + "Time Format": "Time Format", + "Time Range Preset": "Time Range Preset", + "Time filter is only available for Week and Day views": "Time filter is only available for Week and Day views", + "Time filter is only available for Week and Day views.": "Time filter is only available for Week and Day views.", + "Time format template": "Time format template", + "Time-to-live for cached results in milliseconds (default: 300000 = 5 minutes)": "Time-to-live for cached results in milliseconds (default: 300000 = 5 minutes)", + "Top Section": "Top Section", + "Total: {{value0}} | Success: {{value1}} | Errors: {{value2}}": "Total: {{value0}} | Success: {{value1}} | Errors: {{value2}}", + "Tray indicator": "Tray indicator", + "Tuesday": "Tuesday", + "URL: ": "URL: ", + "Untitled View": "Untitled View", + "Update now": "Update now", + "Use left/right workspace side leaves for Sidebar and Details. When enabled, the main fluent view won't render in-view sidebar or details.": "Use left/right workspace side leaves for Sidebar and Details. When enabled, the main fluent view won't render in-view sidebar or details.", + "Use system notifications when possible": "Use system notifications when possible", + "Use template for new files": "Use template for new files", + "Use the command palette to access timer data management:": "Use the command palette to access timer data management:", + "Use these templates as a starting point to create your own custom calendar views.": "Use these templates as a starting point to create your own custom calendar views.", + "Use workspace side leaves": "Use workspace side leaves", + "Used by File mode (requires FileSource). Leave empty for vault root.": "Used by File mode (requires FileSource). Leave empty for vault root.", + "Used by File mode to prefill the file name input (supports date templates like {{DATE:YYYY-MM-DD}})": "Used by File mode to prefill the file name input (supports date templates like {{DATE:YYYY-MM-DD}})", + "User Interface": "User Interface", + "Value cannot be empty": "Value cannot be empty", + "Version marker": "Version marker", + "View Icon": "View Icon", + "View Logs": "View Logs", + "View Server Logs": "View Server Logs", + "View all MCP server tool calls and their results": "View all MCP server tool calls and their results", + "View deleted: ": "View deleted: ", + "View duplicated: ": "View duplicated: ", + "Views": "Views", + "Views are disabled": "Views are disabled", + "Wednesday": "Wednesday", + "Week View": "Week View", + "Weekends Only": "Weekends Only", + "Weekends only": "Weekends only", + "What should be used as the task title when a file becomes a task": "What should be used as the task title when a file becomes a task", + "When File mode is used, create the new note from a template and then insert the captured content.": "When File mode is used, create the new note from a template and then insert the captured content.", + "When updating task content, prefer updating frontmatter title over renaming the file. This protects the original filename.": "When updating task content, prefer updating frontmatter title over renaming the file. This protects the original filename.", + "Which day should the week start on": "Which day should the week start on", + "Whitelist": "Whitelist", + "Whitelist: Include only specified paths | Blacklist: Exclude specified paths": "Whitelist: Include only specified paths | Blacklist: Exclude specified paths", + "Whitelist: include only specified paths. Blacklist: exclude specified paths.": "Whitelist: include only specified paths. Blacklist: exclude specified paths.", + "Why File Filtering?": "Why File Filtering?", + "Working Hours (9:00-18:00)": "Working Hours (9:00-18:00)", + "Workspace \"{{name}}\" created": "Workspace \"{{name}}\" created", + "Workspace \"{{name}}\" deleted": "Workspace \"{{name}}\" deleted", + "Workspace Color": "Workspace Color", + "Workspace Icon": "Workspace Icon", + "Workspace Management": "Workspace Management", + "Workspace Name": "Workspace Name", + "Workspace manager is not available.": "Workspace manager is not available.", + "Workspace updated": "Workspace updated", + "Workspaces": "Workspaces", + "Write content tags to frontmatter": "Write content tags to frontmatter", + "Year View": "Year View", + "Year view displays 12 mini-month calendars. Use the Date Filter tab to hide weekends if needed.": "Year view displays 12 mini-month calendars. Use the Date Filter tab to hide weekends if needed.", + "You can customize any of these settings later in the plugin settings": "You can customize any of these settings later in the plugin settings", + "Your custom calendar views. Drag to reorder, toggle visibility, or edit settings.": "Your custom calendar views. Drag to reorder, toggle visibility, or edit settings.", + "all .md files in Projects and subfolders": "all .md files in Projects and subfolders", + "all .md files in Projects folder": "all .md files in Projects folder", + "archived on {{date}}": "archived on {{date}}", + "files ending with .task.md in Tasks folder": "files ending with .task.md in Tasks folder", + "files starting with date in Tasks": "files starting with date in Tasks", + "matches all files under Projects folder": "matches all files under Projects folder", + "matches all files under Tasks/2024 folder": "matches all files under Tasks/2024 folder", + "moved on {{date}}": "moved on {{date}}", + "version 1.0": "version 1.0", + "{title} ({count} days)": "{title} ({count} days)", + "{{count}} field(s) configured": "{{count}} field(s) configured", + "{{count}} path(s) configured": "{{count}} path(s) configured", + "{{count}} symbol(s) configured": "{{count}} symbol(s) configured", + "{{count}} tag(s) configured": "{{count}} tag(s) configured", + "{{hidden}}/{{total}} hidden": "{{hidden}}/{{total}} hidden", + "{{status}} Task Symbols": "{{status}} Task Symbols", + "{{value0}} theme workflow": "{{value0}} theme workflow", + "{{value0}} · Heatmap": "{{value0}} · Heatmap", + "{{value0}}: Error": "{{value0}}: Error", + "{{value0}}ms": "{{value0}}ms", + "Index & Task Source Configuration": "Index & Task Source Configuration", + "Configure how Task Genius discovers and indexes tasks from various sources including inline tasks, file metadata, and projects.": "Configure how Task Genius discovers and indexes tasks from various sources including inline tasks, file metadata, and projects.", + "Enable Indexer": "Enable Indexer", + "Please restart Obsidian for the Indexer change to take effect.": "Please restart Obsidian for the Indexer change to take effect.", + "Checkbox Tasks": "Checkbox Tasks", + "File Tasks": "File Tasks", + "Enable checkbox tasks": "Enable checkbox tasks", + "Index markdown checkbox tasks. Disable this if you only want to use file-based or external task sources.": "Index markdown checkbox tasks. Disable this if you only want to use file-based or external task sources.", + "Checkbox task indexing disabled. The index will prune inline tasks shortly.": "Checkbox task indexing disabled. The index will prune inline tasks shortly.", + "Inline task parsing": "Inline task parsing", + "Configure how tasks are parsed from markdown content.": "Configure how tasks are parsed from markdown content.", + "Enable custom date formats": "Enable custom date formats", + "Enable custom date format patterns for parsing dates. When enabled, the parser will try your custom formats before falling back to default formats.": "Enable custom date format patterns for parsing dates. When enabled, the parser will try your custom formats before falling back to default formats.", + "Custom date formats": "Custom date formats", + "Configure custom date format patterns.": "Configure custom date format patterns.", + "Configure Date Formats": "Configure Date Formats", + "{{count}} format(s) configured": "{{count}} format(s) configured", + "Configure Custom Date Formats": "Configure Custom Date Formats", + "Add custom date format patterns. Date patterns: yyyy (4-digit year), yy (2-digit year), MM (2-digit month), M (1-2 digit month), dd (2-digit day), d (1-2 digit day), MMM (short month name), MMMM (full month name). Time patterns: HH (2-digit hour), mm (2-digit minute), ss (2-digit second). Use single quotes for literals (e.g., 'T' for ISO format).": "Add custom date format patterns. Date patterns: yyyy (4-digit year), yy (2-digit year), MM (2-digit month), M (1-2 digit month), dd (2-digit day), d (1-2 digit day), MMM (short month name), MMMM (full month name). Time patterns: HH (2-digit hour), mm (2-digit minute), ss (2-digit second). Use single quotes for literals (e.g., 'T' for ISO format).", + "Enter date format (e.g., yyyy-MM-dd or yyyyMMdd_HHmmss)": "Enter date format (e.g., yyyy-MM-dd or yyyyMMdd_HHmmss)", + "Date formats updated. The parser will now recognize these custom formats.": "Date formats updated. The parser will now recognize these custom formats.", + "Format Pattern": "Format Pattern", + "Example": "Example", + "Configure headings to ignore. Tasks under these headings will be excluded from indexing.": "Configure headings to ignore. Tasks under these headings will be excluded from indexing.", + "Heading filters updated. Rebuild the task index to apply to existing tasks.": "Heading filters updated. Rebuild the task index to apply to existing tasks.", + "Configure headings to focus on. Only tasks under these headings will be included in indexing.": "Configure headings to focus on. Only tasks under these headings will be included in indexing.", + "This change affects how tasks inherit metadata from files. Rebuild the index now so changes take effect immediately?": "This change affects how tasks inherit metadata from files. Rebuild the index now so changes take effect immediately?", + "Failed to reindex tasks": "Failed to reindex tasks", + "Enable file tasks": "Enable file tasks", + "Allow Task Genius to recognize files as tasks using metadata, tags, or templates.": "Allow Task Genius to recognize files as tasks using metadata, tags, or templates.", + "File task recognition disabled. Existing file tasks will be pruned shortly.": "File task recognition disabled. Existing file tasks will be pruned shortly.", + "File tasks are disabled. Enable them to configure recognition strategies.": "File tasks are disabled. Enable them to configure recognition strategies.", + "Performance Configuration": "Performance Configuration", + "Configure performance-related indexing settings": "Configure performance-related indexing settings", + "Index Maintenance": "Index Maintenance", + "Tools for managing and rebuilding the task index": "Tools for managing and rebuilding the task index", + "Force a complete rebuild of the task index. Use this if you notice missing or incorrect tasks.": "Force a complete rebuild of the task index. Use this if you notice missing or incorrect tasks.", + "How to use": "How to use", + + + + "Fluent": "Fluent", }; export default translations; diff --git a/src/translations/locale/zh-cn.ts b/src/translations/locale/zh-cn.ts index 4957132c3..e4829e035 100644 --- a/src/translations/locale/zh-cn.ts +++ b/src/translations/locale/zh-cn.ts @@ -255,9 +255,9 @@ const translations = { "No priority": "无优先级", "Low priority": "低优先级", "Lowest priority": "最低优先级", - "Priority A": "优先级A", - "Priority B": "优先级B", - "Priority C": "优先级C", + "Priority A": "优先级 A", + "Priority B": "优先级 B", + "Priority C": "优先级 C", "Task Priority": "任务优先级", "Remove Priority": "移除优先级", "Cycle task status forward": "向前循环任务状态", @@ -584,7 +584,7 @@ const translations = { "Task Title": "任务标题", Tags: "标签", "e.g. every day, every 2 weeks": "例如:每天,每两周", - Forecast: "预测", + Forecast: "展望", "0 actions, 0 projects": "0 个行动,0 个项目", "Toggle list/tree view": "切换列表/树形视图", "Focusing on Work": "专注工作", @@ -841,13 +841,13 @@ const translations = { "Move to": "移动到", Settings: "设置", "Just started": "刚刚开始", - "Making progress": "正在进行中", - "Half way": "完成一半", - "Good progress": "进展良好", + "Making progress": "正在推进", + "Half way": "已完成一半", + "Good progress": "进展顺利", "Almost there": "即将完成", "archived on": "归档于", moved: "已移动", - "Capture your thoughts...": "记录你的想法...", + "Capture your thoughts...": "记录你的想法……", "Project Workflow": "项目工作流", "Standard project management workflow": "标准项目管理工作流", Planning: "规划中", @@ -856,12 +856,12 @@ const translations = { Cancelled: "已取消", Habit: "习惯", "Drink a cup of good tea": "喝一杯好茶", - "Watch an episode of a favorite series": "观看一集喜欢的剧集", - "Play a game": "玩一局游戏", + "Watch an episode of a favorite series": "看一集喜欢的剧集", + "Play a game": "玩一会游戏", "Eat a piece of chocolate": "吃一块巧克力", common: "普通", rare: "稀有", - legendary: "传奇", + legendary: "传说", "No Habits Yet": "暂无习惯", "Click the open habit button to create a new habit.": "点击打开习惯按钮创建新习惯。", @@ -1784,14 +1784,14 @@ const translations = { "消除或最小化。这些任务可能是时间浪费。", "Review and categorize these tasks appropriately.": "适当地审查和分类这些任务。", - "Urgent & Important": "紧急 & 重要", - "Do First - Crisis & emergencies": "优先处理 - 危机与紧急情况", - "Not Urgent & Important": "不紧急 & 重要", - "Schedule - Planning & development": "安排 - 规划与发展", - "Urgent & Not Important": "紧急 & 不重要", - "Delegate - Interruptions & distractions": "委托 - 干扰与分心", - "Not Urgent & Not Important": "不紧急 & 不重要", - "Eliminate - Time wasters": "消除 - 时间浪费", + "Urgent & Important": "紧急且重要", + "Do First - Crisis & emergencies": "优先处理:危机和紧急事务", + "Not Urgent & Important": "重要但不紧急", + "Schedule - Planning & development": "安排计划:规划与发展", + "Urgent & Not Important": "紧急但不重要", + "Delegate - Interruptions & distractions": "委派处理:干扰与打断", + "Not Urgent & Not Important": "不紧急也不重要", + "Eliminate - Time wasters": "减少投入:消耗时间的事务", "Task Priority Matrix": "任务优先级矩阵", "Created Date (Newest First)": "创建日期(最新优先)", "Created Date (Oldest First)": "创建日期(最早优先)", @@ -2420,6 +2420,580 @@ const translations = { "Automatically start the timer when creating a new task via quick capture (checkbox mode only)": "通过快速捕获创建新任务时自动启动计时器(仅限复选框模式)", "Timer started for new task": "已为新任务启动计时器", + + " (truncated)": "(截断)", + "(Copy)": "(复制)", + "(space)": "(空格)", + "+ Add Custom Cycle": "+ 添加自定义循环", + "+ Add Status": "+ 添加状态", + ", Replacement: ": ",替换为:", + "0.0.0.0 (All interfaces - for external access)": "0.0.0.0(监听所有网络接口,允许外部访问)", + "1 → 2 → 3 → 4 → 5": "1 → 2 → 3 → 4 → 5", + "1) Initialize": "1)初始化", + "12-hour format (1:30 PM)": "12 小时格式 (1:30 PM)", + "127.0.0.1 (Local only)": "127.0.0.1(仅限本地)", + "2) Call tool with session id": "2)使用会话 ID 调用工具", + "24-hour format (13:30)": "24 小时格式 (13:30)", + "A descriptive name for the workspace": "工作区的描述性名称", + "AM (Morning)": "AM(上午)", + "Active strategies: ": "已启用的识别规则:", + "Add Custom Mapping": "添加自定义映射", + "Add Cycle": "添加循环", + "Add Detailed Cycle": "添加详细状态循环", + "Add Detection Method": "添加检测方法", + "Add File": "添加文件", + "Add Folder": "添加文件夹", + "Add Item": "添加条目", + "Add Number Cycle": "添加数字循环", + "Add Pattern": "添加匹配规则", + "Add Simple Cycle": "添加简单循环", + "Add custom status mappings for your workflow.": "为您的工作流添加自定义状态映射。", + "Add metadata fields that indicate a file should be treated as a task (e.g., dueDate, status, priority)": "添加用于将文件识别为任务的元数据字段,例如 dueDate、status、priority。", + "Add paths that contain task files (e.g., Projects/, Tasks/2024/, Work/TODO/)": "添加包含任务文件的路径(例如,Projects/、Tasks/2024/、Work/TODO/)", + "Add progress bar to Projects view": "将进度条添加到项目视图", + "Add tags that indicate a file should be treated as a task (e.g., #task, #todo, #actionable)": "添加指示文件应被视为任务的标签(例如,#task、#todo、#actionable)", + "Add {{value0}} Theme as New Cycle?": "将 {{value0}} 主题添加为新的状态循环?", + "Agenda View": "日程视图", + "All Workspaces": "所有工作区", + "All history": "所有历史", + "All settings have been reset to their default values": "所有设置已重置为默认值", + "Allow files to be recognized and treated as tasks based on their metadata, tags, or file paths. This provides advanced recognition strategies beyond simple metadata parsing.": "允许根据文件的元数据、标签或文件路径来识别文件并将其视为任务。这提供了超越简单元数据解析的高级识别策略。", + "Applied recommended configuration: ": "应用推荐配置:", + "Apply {{value0}} Theme?": "应用 {{value0}} 主题?", + "Are you sure you want to delete \"{{name}}\"? This action cannot be undone.": "您确定要删除“{{name}}”吗?此操作无法撤消。", + "Are you sure you want to delete the '{{value0}}' workflow?": "确定删除工作流“{{value0}}”吗?", + "Are you sure you want to delete the habit ": "您确定要删除该习惯吗", + "Are you sure you want to reset all settings to their default values?\n\nThis action cannot be undone.": "您确定要将所有设置重置为默认值吗?\n\n此操作无法撤消。", + "Arguments:": "参数:", + "Auto-detect Status Mappings": "自动检测状态映射", + "Automatically convert between metadata status values and task symbols": "自动在元数据状态值和任务符号之间转换", + "Automatically parse natural language time expressions and specific times (12:00, 1:30 PM, 12:00-13:00)": "自动解析自然语言时间表达式和具体时间(12:00、1:30 PM、12:00-13:00)", + "Automatically sync with task status configuration": "自动与任务状态配置同步", + "Base View Type": "基础视图类型", + "Based on: ": "基于:", + "Bases Support": "Bases 支持", + "Basic": "基础", + "Blacklist": "黑名单", + "Block References": "块引用", + "Block reference prefix": "块引用前缀", + "Both": "两处同时显示", + "Bottom Section": "底部", + "Built-in View Templates": "内置视图模板", + "Cache TTL": "缓存生存时间", + "Calendar View Configuration": "日历视图配置", + "Calendar Views": "日历视图", + "Calendar view created: ": "已创建日历视图:", + "Calendar view updated: ": "已更新日历视图:", + "Cannot enable views without indexer. Please enable the indexer first in Index & Sources settings.": "无法启用没有索引器的视图。请首先在“索引和来源”设置中启用索引器。", + "Capture as:": "捕获方式:", + "Capture to:": "保存位置:", + "Case Sensitive Matching": "区分大小写的匹配", + "Changelog": "变更日志", + "Characters used to separate time ranges (comma-separated)": "用于分隔时间范围的字符(逗号分隔)", + "Choose a color for this workspace": "为此工作区选择颜色", + "Choose a preset or customize the time range": "选择预设或自定义时间范围", + "Choose an icon for this view": "为此视图选择一个图标", + "Choose an icon for this workspace": "为此工作区选择一个图标", + "Choose the note that should be copied; {{CONTENT}} placeholders are replaced, otherwise the captured text is appended.": "选择要复制的笔记; {{CONTENT}} 占位符将被替换,否则将附加捕获的文本。", + "Choose where this view appears in the sidebar. Views in the bottom section are visually separated from top section views.": "选择此视图在侧栏中的显示位置。底部视图在视觉上与顶部视图分开。", + "Choose your preferred interface style and configure how Task Genius displays in your workspace.": "选择您喜欢的界面风格并配置 Task Genius 在工作区中的显示方式。", + "Classic": "经典", + "Classic & Familiar": "经典又熟悉", + "Clear Logs": "清除日志", + "Click the button below to automatically add this MCP server to Cursor:": "单击下面的按钮自动将此 MCP 服务器添加到 Cursor:", + "Collapse/Expand": "折叠/展开", + "Comma-separated list of folder paths where task timer should be enabled": "在哪些文件夹中启用任务计时器;多个路径用英文逗号分隔。", + "Comma-separated list of tags that enable task timer": "哪些标签可以启用任务计时器;多个标签用英文逗号分隔。", + "Common Mappings": "常用映射", + "Completed Tasks": "已完成的任务", + "Config File-based Project Detection": "基于配置文件的项目检测", + "Configure Symbols": "配置符号", + "Configure Task Fields": "配置任务字段", + "Configure Task Paths": "配置任务路径", + "Configure Task Tags": "配置任务标签", + "Configure additional methods to detect project files": "配置其他方法来检测项目文件", + "Configure file filtering to improve indexing performance and focus on relevant content": "配置文件过滤以提高索引性能并专注于相关内容", + "Configure hidden modules": "配置隐藏模块", + "Configure how dates and times are displayed in views.": "配置日期和时间在视图中的显示方式。", + "Configure how files are recognized as tasks. At least one strategy must be enabled.": "配置如何将文件识别为任务。必须至少启用一项策略。", + "Configure inline editing and metadata positioning.": "配置内联编辑和元数据定位。", + "Configure keywords for date parsing": "配置日期解析的关键字", + "Configure metadata fields that indicate a file should be treated as a task (e.g., dueDate, status, priority)": "配置用于将文件识别为任务的元数据字段,例如 dueDate、status、priority。", + "Configure multiple status cycles with different workflows. You can apply preset themes or create custom cycles.": "为不同工作流配置多个状态循环。可以使用预设主题,也可以创建自定义循环。", + "Configure options specific to the Fluent interface.": "配置特定于 Fluent 界面的选项。", + "Configure paths that contain task files (e.g., Projects/, Tasks/2024/, Work/TODO/)": "配置包含任务文件的路径(例如,Projects/、Tasks/2024/、Work/TODO/)", + "Configure project detection from project configuration files": "从项目配置文件配置项目检测", + "Configure project display, organization and metadata mappings": "配置项目显示、组织和元数据映射", + "Configure symbols that represent abandoned tasks in square brackets": "配置方括号中表示已放弃任务的符号。", + "Configure symbols that represent completed tasks in square brackets": "配置方括号中表示已完成任务的符号。", + "Configure symbols that represent not started tasks in square brackets. Default is space \" \"": "配置方括号中表示未开始任务的符号,默认为空格“ ”。", + "Configure symbols that represent planned tasks in square brackets": "配置方括号中表示计划任务的符号。", + "Configure symbols that represent tasks in progress in square brackets": "配置方括号中表示进行中任务的符号。", + "Configure system tray, notifications, and desktop features": "配置系统托盘、通知和桌面功能", + "Configure tags that indicate a file should be treated as a task (e.g., #task, #todo, #actionable)": "配置指示文件应被视为任务的标签(例如,#task、#todo、#actionable)", + "Configure the format of time expressions": "配置时间表达式的格式", + "Configure which files, folders, or patterns are included during task indexing.": "配置任务索引期间包含哪些文件、文件夹或模式。", + "Configure which modules should be hidden in this workspace. Hidden views will not appear in the sidebar.": "配置应在此工作区中隐藏哪些模块。隐藏视图不会出现在侧边栏中。", + "Contains match": "包含匹配项", + "Control which days are displayed in the calendar": "控制日历中显示的日期", + "Copy Install Link": "复制安装链接", + "Copy Settings From": "从工作区复制设置", + "Copy settings from an existing workspace": "从现有工作区复制设置", + "Copy this cycle": "复制这个循环", + "Create": "创建", + "Create Calendar View": "创建日历视图", + "Create New Calendar View": "创建新的日历视图", + "Create New Workspace": "创建新工作区", + "Create a backup of active timers": "创建活动计时器的备份", + "Create a custom view from the templates above to get started.": "从上面的模板创建自定义视图以开始使用。", + "Create a new workspace with custom settings": "使用自定义设置创建新工作区", + "Create custom calendar views based on Month, Week, or Day views. Each custom view can have its own display settings.": "基于月、周或日视图创建自定义日历视图。每个自定义视图都可以有自己的显示设置。", + "Create task timer backup": "创建任务计时器备份", + "Current Workspace": "当前工作区", + "Custom Calendar Views": "自定义日历视图", + "Custom Content Field": "自定义任务内容字段", + "Custom Cycle": "自定义循环", + "Custom Date Formats": "自定义日期格式", + "Custom Mappings": "自定义映射", + "Custom Project Detection Methods": "自定义项目识别方式", + "Custom Range": "自定义范围", + "Custom Selection": "自定义选择", + "Custom days": "自定义日期", + "Custom marker": "自定义标记", + "Custom metadata field": "自定义元数据字段", + "Customize how dates are displayed in headers": "自定义日期在标题中的显示方式", + "Daily summary": "每日总结", + "Data Management": "数据管理", + "Date Filter": "日期过滤器", + "Date and Time Display": "日期和时间显示", + "Date marker": "日期标记", + "Day Filter": "显示日期筛选", + "Day Header Format": "日期标题格式", + "Day View": "日视图", + "Days to Show": "显示天数", + "Default": "默认", + "Default AM/PM Period": "默认上午/下午时段", + "Default Cycle": "默认循环", + "Default Task Status": "默认任务状态", + "Default file name template": "默认文件名模板", + "Default folder for new files": "新文件的默认文件夹", + "Default format preference for ambiguous time expressions": "不明确的时间表达式的默认格式首选项", + "Default period when AM/PM is ambiguous in 12-hour format": "当 AM/PM 不明确时的默认时间段(12 小时格式)", + "Default settings": "默认设置", + "Default status for newly created file tasks": "新建文件任务的默认状态", + "Default workspace": "默认工作区", + "Default workspace cannot be deleted": "默认工作区无法删除", + "Define the statuses in cycling order": "按循环顺序定义状态", + "Delete Workspace": "删除工作区", + "Delete item": "删除条目", + "Delete this cycle": "删除这个循环", + "Delete this item": "删除此项", + "Desktop Integration": "桌面集成", + "Desktop integration features are only available in the desktop app": "桌面集成功能仅在桌面应用程序中可用", + "Desktop only": "仅限桌面版", + "Detailed": "详细", + "Display": "显示", + "Display a full year with 12 mini-month calendars": "用 12 个月的小日历展示全年任务。", + "Display days with no events": "显示没有事件的日期", + "Display event count badges on date cells": "在日期单元格上显示事件计数徽章", + "Display name for this calendar view": "此日历视图的显示名称", + "Display tasks for a single day with detailed time slots": "在包含详细时段的日视图中显示当天任务。", + "Display tasks in a monthly calendar grid": "在月历网格中显示任务。", + "Display tasks in a weekly time grid with hourly slots": "在按小时划分的周视图中显示任务。", + "Display timer usage statistics": "显示计时器使用统计信息", + "Display upcoming tasks in a list format grouped by day": "按日期分组,用列表显示即将到来的任务。", + "Display week numbers in the month view": "在月视图中显示周序号", + "Drag to reorder": "拖动以重新排序", + "Drag views between sections or within sections to reorder them. Toggle visibility with the eye icon.": "在部分之间或部分内拖动视图以重新排序。使用眼睛图标切换可见性。", + "Edit Calendar View": "编辑日历视图", + "Edit File Filter Rules": "编辑文件过滤规则", + "Editor Configuration": "编辑器配置", + "Enable Base View functionality. This feature provides enhanced view management capabilities but may be affected by future Obsidian API changes.": "启用基本视图功能。此功能提供增强的视图管理功能,但可能会受到未来 Obsidian API 更改的影响。", + "Enable Base View functionality. This feature provides enhanced view management capabilities but may be affected by future Obsidian API changes. You may need to restart Obsidian to see the changes.": "启用基本视图功能。此功能提供增强的视图管理功能,但可能会受到未来 Obsidian API 更改的影响。您可能需要重新启动 Obsidian 才能看到更改。", + "Enable File Task": "启用文件任务", + "Enable Task Genius Views": "启用 Task Genius 视图", + "Enable Task Genius Views above to configure view settings.": "启用上面的 Task Genius 视图来配置视图设置。", + "Enable Task Genius sidebar views to display and manage tasks. Requires the indexer to be enabled.": "启用 Task Genius 侧边栏视图来显示和管理任务。需要启用索引器。", + "Enable Task Timer": "启用任务计时器", + "Enable Time Filter": "启用时间过滤器", + "Enable case-sensitive matching for status values": "为状态值启用区分大小写的匹配", + "Enable notifications": "启用通知", + "Enable project features": "启用项目功能", + "Enable task timer functionality for tracking time spent on tasks": "启用任务计时器功能以跟踪任务所花费的时间", + "Enable/disable this cycle": "启用/停用此循环", + "End Hour": "结束小时", + "Enhanced": "增强型", + "Enter details for {{value0}}...": "输入“{{value0}}”的详细信息……", + "Enter metadata field name": "输入元数据字段名称", + "Enter metadata value and symbol (e.g., 'done:x')": "输入元数据值和符号(例如“done:x”)", + "Enter new name": "输入新名称", + "Enter path (e.g., Projects/, Tasks/**/*.md)": "输入路径(例如,Projects/、Tasks/**/*.md)", + "Enter tag (e.g., #task)": "输入标签(例如,#task)", + "Enter value": "输入值", + "Enter workspace name": "输入工作区名称", + "Error rendering format": "渲染格式错误", + "Error:": "错误:", + "Exact match": "精确匹配", + "Examples of time expressions": "时间表达示例", + "Examples:": "示例:", + "Exclude Archive Folder": "排除存档文件夹", + "Exclude Temporary Files": "排除临时文件", + "Export all timer data to JSON": "将所有计时器数据导出到JSON", + "Export task timer data": "导出任务计时器数据", + "Export task timer data (YAML)": "导出任务计时器数据(YAML)", + "Export to YAML format": "导出为 YAML 格式", + "Failed to sync mapping": "同步映射失败", + "Features to be enabled": "要启用的功能", + "Field name in frontmatter to check for enabling task timer (e.g., 'task-timer: true')": "文件属性区 中用于检查是否启用任务计时器的字段名称(例如“task-timer:true”)", + "File Content": "文件内容", + "File Creation Mode": "文件创建模式", + "File Task is disabled": "文件任务已禁用", + "File Task is enabled and monitoring files": "文件任务已启用并监视文件", + "File filtering helps you focus on relevant content while improving performance, especially in large vaults.": "文件过滤可帮助您专注于相关内容,同时提高性能,尤其是在大型仓库中。", + "FileSource status mapping synced": "文件任务的状态映射已同步", + "Filename": "文件名", + "Filter files during task indexing to improve performance": "在任务索引期间过滤文件以提高性能", + "First H1 heading": "第一个 H1 标题", + "First hour to display (0-23)": "显示的第一个小时 (0-23)", + "Fluent Interface Settings": "Fluent 界面设置", + "Focus on Projects": "聚焦项目", + "Folder paths": "文件夹路径", + "Folder that contains Quick Capture templates for File mode.": "包含文件模式的快速捕获模板的文件夹。", + "Format for day headers (e.g., dddd, MMMM D)": "日期标题的格式(例如 dddd、MMMM D)", + "Format for day view header (e.g., yyyy'年'M'月'd'日')": "日视图标题的格式(例如,yyyy'年'M'月'd'日')", + "Format for month view header (e.g., yyyy M)": "月视图标题的格式(例如,yyyy M)", + "Friday": "周五", + "Frontmatter field": "文件属性字段", + "Frontmatter title": "文件属性中的标题", + "Full project workflow": "完整的项目工作流", + "Full year": "全年", + "Glob pattern (e.g., Projects/**/*.md)": "Glob 通配符规则,例如 Projects/**/*.md", + "Hidden Days": "隐藏的日期", + "Hidden Modules Configuration": "隐藏模块配置", + "Hide Weekends": "隐藏周末", + "Hide from sidebar": "从侧边栏隐藏", + "How paths should be matched": "路径应该如何匹配", + "How tags should be matched against file tags": "标签应如何与文件标签匹配", + "How to handle time ranges that cross midnight (e.g., 23:00-01:00)": "如何处理跨越午夜的时间范围(例如 23:00-01:00)", + "If enabled, #tags in the editor content are written into YAML frontmatter tags (merged and deduplicated)": "如果启用,编辑器内容中的#tags将写入YAML 文件属性区标签(合并和去重)", + "Ignore system and temporary files": "忽略系统和临时文件", + "Import task timer data": "导入任务计时器数据", + "Import timer data from JSON file": "从 JSON 文件导入计时器数据", + "Incomplete Tasks": "未完成的任务", + "Index & Sources": "索引与来源", + "Index only specific project folders": "仅索引特定项目文件夹", + "Inline": "内联", + "Input: ": "输入:", + "Interface": "界面", + "Interface Mode": "界面模式", + "Interface Style": "界面风格", + "Keep open after capture": "捕获后保持打开状态", + "Keep the familiar interface and interaction style you know": "保持您熟悉的界面和交互风格", + "Keep the modal open after capturing content": "捕获内容后保持弹窗打开。", + "Last hour to display (0-23)": "最后一小时显示 (0-23)", + "Last month": "上个月", + "Last updated: {{date}}": "最后更新:{{date}}", + "Last week": "上周", + "Last year": "去年", + "Legacy": "经典界面", + "Link Filter": "链接过滤器", + "Linked Note": "关联笔记", + "MCP Server Logs": "MCP 服务器日志", + "MCP server is not running": "MCP 服务器未运行", + "Manage Workspaces...": "管理工作区...", + "Manage workspaces to organize different contexts with their own settings and filters.": "管理工作区以使用自己的设置和过滤器组织不同的上下文。", + "Manual Configuration": "手动配置", + "Map between human-readable metadata values (e.g., 'completed') and task symbols (e.g., 'x').": "人类可读的元数据值(例如“已完成”)和任务符号(例如“x”)之间的映射。", + "Mark": "符号", + "Max Events Per Row": "每行最大事件数", + "Max other views before overflow": "“其他视图”直接显示的数量上限", + "Maximum events to show per day cell before showing '+N more'": "在显示“+N 更多”之前每天单元格显示的最大事件数", + "Meeting": "会议", + "Metadata": "元数据", + "Metadata Detection": "元数据识别", + "Metadata Property": "元数据属性", + "Metadata Value": "元数据值", + "Metadata-based Project Detection": "基于元数据的项目检测", + "Metadata-based Recognition": "通过元数据识别", + "Method": "方法", + "Method A (Custom Header):": "方式 A(自定义请求头):", + "Method B (Combined Bearer):": "方式 B(组合 Bearer 凭据):", + "Midnight Crossing Behavior": "跨午夜处理方式", + "Migrated from legacy settings": "从旧设置迁移", + "Missed": "未完成", + "Modern": "现代", + "Modern & Sleek": "现代时尚", + "Mon first": "周一为一周起点", + "Monday": "星期一", + "Month Header Format": "月份标题格式", + "Month View": "月视图", + "My Custom View": "我的自定义视图", + "Name of the metadata field to use as task content": "用作任务内容的元数据字段的名称", + "New Calendar View": "新日历视图", + "New Name": "新名称", + "New visual design with elegant animations and modern interactions": "新的视觉设计,优雅的动画和现代互动", + "Next day (23:00 today - 01:00 tomorrow)": "第二天(今天 23:00 - 明天 01:00)", + "No custom calendar views yet": "尚无自定义日历视图", + "No filter rules configured yet": "尚未配置过滤规则", + "No items configured. Click 'Add Item' to get started.": "没有配置任何项目。单击“添加项目”即可开始。", + "No logs match your search.": "没有与搜索内容匹配的日志。", + "No logs yet. Tool calls will appear here.": "暂无日志,工具调用记录会显示在这里。", + "No markdown notes were found in the selected folder.": "在所选文件夹中未找到 Markdown 笔记。", + "No weekends": "排除周末", + "Note:": "注意:", + "Notes": "笔记", + "Notify shortly before each task's due time": "在每项任务到期时间之前不久通知", + "Number of 'Other Views' to show before grouping the rest into an overflow menu (ellipsis)": "在将其余视图分组到溢出菜单之前显示的“其他视图”数量(省略号)", + "Number of days to display in the agenda": "日程视图显示的天数", + "Numeric progress tracking": "数字进度跟踪", + "Only show certain hours of the day": "只显示一天中的某些时段", + "Open in external browser": "在外部浏览器中打开", + "Optimize Performance": "优化性能", + "Optional: Only match links containing this text": "可选:仅匹配包含此文本的链接", + "Other Views": "其他视图", + "PM (Afternoon/Evening)": "PM(下午/晚上)", + "Path Matching Mode": "路径匹配模式", + "Path-based Recognition": "通过路径识别", + "Paths": "路径", + "Pattern: ": "匹配规则:", + "Per-task reminders": "每个任务提醒", + "Performance": "性能", + "Please enter a name": "请输入名称", + "Please enter a workspace name": "请输入工作区名称", + "Populate FileSource status mapping from your checkbox status configuration": "从复选框状态配置填充 FileSource 状态映射", + "Prefer Frontmatter Title": "优先使用文件属性中的标题", + "Preferred Time Format": "首选时间格式", + "Prefix (e.g., Projects/ matches Projects/App.md)": "前缀(例如,Projects/ 匹配 Projects/App.md)", + "Prefix for generated block reference IDs (e.g., 'timer' creates ^timer-123456-7890)": "生成的块引用 ID 的前缀(例如,“timer”创建 ^timer-123456-7890)", + "Prefix match": "前缀匹配", + "Progress Tracker": "进度追踪器", + "Projects List": "项目清单", + "Quick Add Rules": "快速添加规则", + "Quick Install": "快速安装", + "Quick TODO/DONE cycle": "未开始/已完成简易循环", + "Quick Templates": "快速模板", + "Quickly add common workflow patterns": "快速添加常用工作流模式", + "Recognition Strategies": "识别规则", + "Recognize files as tasks based on their file path": "根据文件路径将文件识别为任务", + "Recognize files as tasks if they have specific frontmatter fields": "如果文件具有特定的 文件属性区 字段,则将文件识别为任务", + "Recognize files as tasks if they have specific tags": "如果文件具有特定标签,则将其识别为任务", + "Recommended Configurations": "推荐配置", + "Record Details for {{value0}}": "记录“{{value0}}”的详细信息", + "Regular expression (advanced)": "正则表达式(高级)", + "Remember last mode": "记住最后的模式", + "Remember the last used quick capture mode": "记住上次使用的快速捕获模式。", + "Remove the .md extension from filename when using as task content": "用作任务内容时从文件名中删除 .md 扩展名", + "Remove this status": "删除此状态", + "Rename": "重命名", + "Rename Workspace": "重命名工作区", + "Require All Fields": "必须包含所有字段", + "Require all specified fields to be present (otherwise any field is sufficient)": "要求所有指定字段都存在(否则任何字段就足够了)", + "Reset All Settings": "重置所有设置", + "Reset Settings": "重置设置", + "Reset all settings to their default values": "将所有设置重置为默认值", + "Result:": "结果:", + "Review Your Configuration": "检查您的配置", + "Rule {{value0}}": "规则 {{value0}}", + "Same day (treat as error)": "同一天(视为错误)", + "Sat first": "周六为一周起点", + "Saturday": "星期六", + "Saved. Reopen the view to apply.": "已保存。重新打开视图以应用。", + "Scan now": "立即扫描", + "Scope:": "范围:", + "Search logs...": "搜索日志...", + "Select a template folder above to enable the dropdown.": "选择上面的模板文件夹以启用下拉列表。", + "Select between the modern Fluent interface or the classic Legacy interface.": "在现代 Fluent 界面或经典 Legacy 界面之间进行选择。", + "Select the interface style to use.": "选择要使用的界面风格。", + "Select which days to hide from the calendar": "选择要从日历中隐藏的日期", + "Selected folder was not found in the vault.": "在当前仓库中找不到所选文件夹。", + "Send now": "立即发送", + "Send one notification for today's due tasks at a specific time (HH:mm)": "在特定时间发送一份有关今天到期任务的通知 (HH:mm)", + "Set value": "设定值", + "Show All Days": "显示所有日期", + "Show Empty Days": "显示没有事件的日期", + "Show Event Counts": "显示事件计数", + "Show Week Numbers": "显示周序号", + "Show a bell with count in system tray, status bar, or both": "在系统托盘、状态栏或两处同时显示带任务数量的铃铛图标。", + "Show changelog after plugin updates": "插件更新后显示更改日志", + "Show error": "显示错误", + "Show indicator with checkbox": "显示带有复选框的指示器", + "Show project progress in Projects header": "在“项目”标题中显示项目进度", + "Show task timer statistics": "显示任务计时器统计信息", + "Show the status indicator directly next to the checkbox. When enabled, a indicator will be shown next to the checkbox.": "在复选框旁边显示状态指示器。启用后,复选框旁边将显示一个指示器。", + "Sidebar Components": "侧边栏组件", + "Sidebar Position": "侧边栏位置", + "Simple": "简单", + "Skip archived content": "跳过存档内容", + "Standard task lifecycle with all states": "包含全部状态的标准任务流程", + "Start Hour": "起始小时", + "Statistics": "统计数据", + "Status Cycles Management": "状态循环管理", + "Status bar": "状态栏", + "Status mappings work with your Task Status Settings. ": "状态映射与您的任务状态设置一起使用。", + "Status sequence": "状态序列", + "Strip File Extension": "移除文件扩展名", + "Submit": "提交", + "Sunday": "周日", + "Switch": "切换", + "Switch Workspace": "切换工作区", + "Sync from Task Status Settings": "从任务状态设置同步", + "System Default": "系统默认值", + "System tray": "系统托盘", + "TODO → PLAN → IN PROGRESS → DONE": "未开始 → 计划 → 进行中 → 已完成", + "TODO ↔ DONE": "未开始 ↔ 已完成", + "TODO.md in any direct subfolder of Work": "Work 的任意直接子文件夹中的 TODO.md", + "Tag Matching Mode": "标签匹配模式", + "Tag-based Recognition": "通过标签识别", + "Task Fields": "任务字段", + "Task Paths": "任务路径", + "Task Properties for Files": "文件的任务属性", + "Task Symbol": "任务符号", + "Task Tags": "任务标签", + "Task Timer": "任务计时器", + "Task Title Source": "任务标题来源", + "Task fields updated. Rebuild the task index to apply to existing files.": "任务字段已更新。重建任务索引以应用于现有文件。", + "Task paths updated. Rebuild the task index to apply to existing files.": "任务路径已更新。重建任务索引以应用于现有文件。", + "Task tags updated. Rebuild the task index to apply to existing files.": "任务标签已更新。重建任务索引以应用于现有文件。", + "Template folder": "模板文件夹", + "Template folder is invalid; update the folder to continue.": "模板文件夹无效;更新文件夹以继续。", + "Template for displaying completed task time. Use {h} for hours, {m} for minutes, {s} for seconds": "用于显示已完成任务时间的模板。使用 {h} 表示小时,{m} 表示分钟,{s} 表示秒", + "Template note": "模板笔记", + "Templates": "模板", + "Templates/Quick Capture": "Templates/Quick Capture", + "The calendar layout this view is based on": "此视图所基于的日历布局", + "The symbols defined here should match those in your checkbox status configuration.": "此处定义的符号应与复选框状态配置中的符号相匹配。", + "This will add a new status cycle based on the {{value0}} theme.": "将根据 {{value0}} 主题新增一个状态循环。", + "This will override your current checkbox status settings with the {{value0}} theme. Do you want to continue?": "这会用 {{value0}} 主题覆盖当前的复选框状态设置。是否继续?", + "Thursday": "星期四", + "Time Filter": "时间过滤器", + "Time Format": "时间格式", + "Time Format Configuration": "时间格式配置", + "Time Range Preset": "时间范围预设", + "Time Range Separators": "时间范围分隔符", + "Time filter is only available for Week and Day views": "时间过滤器仅适用于周和日视图", + "Time filter is only available for Week and Day views.": "时间过滤器仅适用于周和日视图。", + "Time format template": "时间格式模板", + "Time-to-live for cached results in milliseconds (default: 300000 = 5 minutes)": "缓存结果的生存时间(以毫秒为单位)(默认值:300000 = 5 分钟)", + "Top Section": "顶部", + "Total: {{value0}} | Success: {{value1}} | Errors: {{value2}}": "总计:{{value0}} | 成功:{{value1}} | 错误:{{value2}}", + "Tray indicator": "托盘指示灯", + "Tuesday": "星期二", + "URL: ": "网址:", + "Untitled View": "无标题视图", + "Update now": "立即更新", + "Use left/right workspace side leaves for Sidebar and Details. When enabled, the main fluent view won't render in-view sidebar or details.": "将侧栏和任务详情放到工作区左右侧边面板。启用后,Fluent 主视图内部不再显示侧栏和详情面板。", + "Use system notifications when possible": "尽可能使用系统通知", + "Use template for new files": "使用模板创建新文件", + "Use the command palette to access timer data management:": "使用命令选项板访问计时器数据管理:", + "Use these templates as a starting point to create your own custom calendar views.": "使用这些模板作为创建您自己的自定义日历视图的起点。", + "Use workspace side leaves": "使用工作区侧边面板", + "Used by File mode (requires FileSource). Leave empty for vault root.": "用于文件捕获模式(需要启用文件任务来源)。留空表示仓库根目录。", + "Used by File mode to prefill the file name input (supports date templates like {{DATE:YYYY-MM-DD}})": "由文件模式用于预填充文件名输入(支持 {{DATE:YYYY-MM-DD}} 等日期模板)", + "User Interface": "用户界面", + "Value cannot be empty": "值不能为空", + "Version marker": "版本标记", + "View Icon": "视图图标", + "View Logs": "查看日志", + "View Server Logs": "查看服务器日志", + "View all MCP server tool calls and their results": "查看所有 MCP 服务器工具调用及其结果", + "View deleted: ": "已删除视图:", + "View duplicated: ": "已复制视图:", + "Views": "视图", + "Views are disabled": "视图已禁用", + "Wednesday": "星期三", + "Week View": "周视图", + "Weekends Only": "仅限周末", + "Weekends only": "仅限周末", + "What should be used as the task title when a file becomes a task": "当文件成为任务时应该使用什么作为任务标题", + "When File mode is used, create the new note from a template and then insert the captured content.": "使用文件模式时,从模板创建新笔记,然后插入捕获的内容。", + "When updating task content, prefer updating frontmatter title over renaming the file. This protects the original filename.": "更新任务内容时,优先更新 文件属性区 标题而不是重命名文件。这可以保护原始文件名。", + "Which day should the week start on": "一周应该从哪一天开始", + "Whitelist": "白名单", + "Whitelist: Include only specified paths | Blacklist: Exclude specified paths": "白名单:仅包含指定路径 |黑名单:排除指定路径", + "Whitelist: include only specified paths. Blacklist: exclude specified paths.": "白名单:仅包含指定路径。黑名单:排除指定路径。", + "Why File Filtering?": "为什么要进行文件过滤?", + "Working Hours (9:00-18:00)": "工作时间(9:00-18:00)", + "Workspace \"{{name}}\" created": "工作区“{{name}}”已创建", + "Workspace \"{{name}}\" deleted": "工作区“{{name}}”已删除", + "Workspace Color": "工作区颜色", + "Workspace Icon": "工作区图标", + "Workspace Management": "工作区管理", + "Workspace Name": "工作区名称", + "Workspace manager is not available.": "工作区管理器不可用。", + "Workspace updated": "工作区已更新", + "Workspaces": "工作区", + "Write content tags to frontmatter": "将内容标签写入文件属性区", + "Year View": "年视图", + "Year view displays 12 mini-month calendars. Use the Date Filter tab to hide weekends if needed.": "年视图显示 12 个迷你月历。如果需要,可以使用“日期过滤器”选项卡隐藏周末。", + "You can customize any of these settings later in the plugin settings": "您可以稍后在插件设置中自定义任何这些设置", + "Your custom calendar views. Drag to reorder, toggle visibility, or edit settings.": "您的自定义日历视图。拖动即可重新排序、切换可见性或编辑设置。", + "all .md files in Projects and subfolders": "Projects 及其子文件夹中的所有 .md 文件", + "all .md files in Projects folder": "Projects 文件夹中的所有 .md 文件", + "archived on {{date}}": "存档于 {{date}}", + "files ending with .task.md in Tasks folder": "Tasks 文件夹中以 .task.md 结尾的文件", + "files starting with date in Tasks": "Tasks 文件夹中以日期开头的文件", + "matches all files under Projects folder": "匹配 Projects 文件夹下的所有文件", + "matches all files under Tasks/2024 folder": "匹配Tasks/2024文件夹下的所有文件", + "moved on {{date}}": "移至{{date}}", + "version 1.0": "1.0版", + "{title} ({count} days)": "{title}({count}天)", + "{{count}} field(s) configured": "已配置 {{count}} 个字段", + "{{count}} path(s) configured": "已配置 {{count}} 条路径", + "{{count}} symbol(s) configured": "已配置 {{count}} 个符号", + "{{count}} tag(s) configured": "已配置 {{count}} 个标签", + "{{hidden}}/{{total}} hidden": "已隐藏 {{hidden}}/{{total}} 项", + "{{status}} Task Symbols": "{{status}} 任务符号", + "{{value0}} theme workflow": "{{value0}} 主题工作流", + "{{value0}} · Heatmap": "{{value0}} · 热力图", + "{{value0}}: Error": "{{value0}}:出错了", + "{{value0}}ms": "{{value0}} 毫秒", + "Index & Task Source Configuration": "索引与任务来源配置", + "Configure how Task Genius discovers and indexes tasks from various sources including inline tasks, file metadata, and projects.": "配置 Task Genius 如何从行内任务、文件元数据和项目等来源发现任务并建立索引。", + "Enable Indexer": "启用索引器", + "Please restart Obsidian for the Indexer change to take effect.": "请重启 Obsidian,使索引器设置生效。", + "Checkbox Tasks": "复选框任务", + "File Tasks": "文件任务", + "Enable checkbox tasks": "启用复选框任务", + "Index markdown checkbox tasks. Disable this if you only want to use file-based or external task sources.": "为 Markdown 中的复选框任务建立索引。如果只使用文件任务或外部任务来源,可以关闭此项。", + "Checkbox task indexing disabled. The index will prune inline tasks shortly.": "已关闭复选框任务索引,现有行内任务将从索引中移除。", + "Inline task parsing": "行内任务解析", + "Configure how tasks are parsed from markdown content.": "配置如何从 Markdown 内容中解析任务。", + "Enable custom date formats": "启用自定义日期格式", + "Enable custom date format patterns for parsing dates. When enabled, the parser will try your custom formats before falling back to default formats.": "启用自定义日期解析格式。启用后,解析器会优先尝试自定义格式,再尝试默认格式。", + "Custom date formats": "自定义日期格式", + "Configure custom date format patterns.": "配置自定义日期格式。", + "Configure Date Formats": "配置日期格式", + "{{count}} format(s) configured": "已配置 {{count}} 种格式", + "Configure Custom Date Formats": "配置自定义日期格式", + "Add custom date format patterns. Date patterns: yyyy (4-digit year), yy (2-digit year), MM (2-digit month), M (1-2 digit month), dd (2-digit day), d (1-2 digit day), MMM (short month name), MMMM (full month name). Time patterns: HH (2-digit hour), mm (2-digit minute), ss (2-digit second). Use single quotes for literals (e.g., 'T' for ISO format).": "添加自定义日期格式。日期标记:yyyy(四位年份)、yy(两位年份)、MM(两位月份)、M(一至两位月份)、dd(两位日期)、d(一至两位日期)、MMM(月份简称)、MMMM(月份全称)。时间标记:HH(两位小时)、mm(两位分钟)、ss(两位秒数)。固定文字请用单引号包围,例如 ISO 格式中的 'T'。", + "Enter date format (e.g., yyyy-MM-dd or yyyyMMdd_HHmmss)": "输入日期格式,例如 yyyy-MM-dd 或 yyyyMMdd_HHmmss", + "Date formats updated. The parser will now recognize these custom formats.": "日期格式已更新,解析器现在可以识别这些自定义格式。", + "Format Pattern": "格式", + "Example": "示例", + "Configure headings to ignore. Tasks under these headings will be excluded from indexing.": "配置需要忽略的标题,这些标题下的任务不会进入索引。", + "Configure Ignore Headings": "配置忽略的标题", + "{{count}} heading(s) configured": "已配置 {{count}} 个标题", + "Add headings to ignore. Tasks under these headings will be excluded from indexing. Examples: '## Project', '## Inbox', '# Archive'": "添加需要忽略的标题,其下的任务不会进入索引。例如:'## Project'、'## Inbox'、'# Archive'。", + "Enter heading (e.g., ## Inbox)": "输入标题,例如 ## Inbox", + "Heading filters updated. Rebuild the task index to apply to existing tasks.": "标题过滤设置已更新。重建任务索引后即可应用到现有任务。", + "Configure headings to focus on. Only tasks under these headings will be included in indexing.": "配置要关注的标题,仅将这些标题下的任务纳入索引。", + "Configure Focus Headings": "配置关注的标题", + "Add headings to focus on. Only tasks under these headings will be included in indexing. Examples: '## Project', '## Inbox', '# Tasks'": "添加要关注的标题,仅将其下的任务纳入索引。例如:'## Project'、'## Inbox'、'# Tasks'。", + "Enter heading (e.g., ## Tasks)": "输入标题,例如 ## Tasks", + "This change affects how tasks inherit metadata from files. Rebuild the index now so changes take effect immediately?": "此更改会影响任务从文件继承元数据的方式。是否立即重建索引,使更改生效?", + "Failed to reindex tasks": "任务索引重建失败", + "Enable file tasks": "启用文件任务", + "Allow Task Genius to recognize files as tasks using metadata, tags, or templates.": "允许 Task Genius 根据元数据、标签或模板将整个文件识别为任务。", + "File task recognition disabled. Existing file tasks will be pruned shortly.": "已关闭文件任务识别,现有文件任务将从索引中移除。", + "File tasks are disabled. Enable them to configure recognition strategies.": "文件任务已关闭,启用后可以配置识别规则。", + "Performance Configuration": "性能配置", + "Configure performance-related indexing settings": "配置与索引性能有关的设置。", + "Index Maintenance": "索引维护", + "Tools for managing and rebuilding the task index": "用于管理和重建任务索引的工具。", + "Force a complete rebuild of the task index. Use this if you notice missing or incorrect tasks.": "强制完整重建任务索引。当任务缺失或索引信息不正确时,可以使用此功能。", + "How to use": "使用说明", + + "Fluent": "Fluent", }; export default translations; diff --git a/src/utils/task/removeBlankTasks.ts b/src/utils/task/removeBlankTasks.ts new file mode 100644 index 000000000..1cb7900d5 --- /dev/null +++ b/src/utils/task/removeBlankTasks.ts @@ -0,0 +1,23 @@ +import type { Task } from "@/types/task"; + +/** Empty Markdown placeholders must not become indexed tasks or orphan children. */ +export function removeBlankTasks(tasks: Task[]): Task[] { + const removed = new Map(tasks.filter(task => !String(task.content ?? "").replace(/\u200b/g, "").trim()).map(task => [task.id, task])); + if (!removed.size) return tasks; + const kept = tasks.filter(task => !removed.has(task.id)).map(task => { + let parent = task.metadata.parent; + const visited = new Set(); + while (parent && removed.has(parent)) { + if (visited.has(parent)) { parent = undefined; break; } + visited.add(parent); + parent = removed.get(parent)!.metadata.parent; + } + return { ...task, metadata: { ...task.metadata, parent, children: (task.metadata.children || []).filter(id => !removed.has(id)) } }; + }); + const byId = new Map(kept.map(task => [task.id, task])); + for (const task of kept) { + const parent = task.metadata.parent && byId.get(task.metadata.parent); + if (parent && !parent.metadata.children.includes(task.id)) parent.metadata.children.push(task.id); + } + return kept; +} diff --git a/versions.json b/versions.json index c885ce360..123e13712 100644 --- a/versions.json +++ b/versions.json @@ -179,5 +179,6 @@ "9.12.5": "0.15.2", "9.12.6": "0.15.2", "9.13.0": "0.15.2", - "9.13.1": "0.15.2" -} \ No newline at end of file + "9.13.1": "0.15.2", + "9.13.2": "0.15.2" +} From 2c67117a88e2047762c4d74a18ae68e4241fcaa9 Mon Sep 17 00:00:00 2001 From: platinum1154 Date: Sun, 8 Nov 2026 13:10:10 +0800 Subject: [PATCH 02/18] feat(habits): integrate Habits into legacy Task Genius --- .github/workflows/ci.yml | 3 + .gitignore | 4 + docs/habits-integration.md | 37 + ...77\347\224\250\346\214\207\345\215\227.md" | 54 + esbuild.config.mjs | 2 +- package.json | 15 +- pnpm-lock.yaml | 794 ++-- pnpm-workspace.yaml | 4 + scripts/check-habits-i18n.cjs | 40 + scripts/scope-habits-css.mjs | 23 + src/common/setting-definition.ts | 1 + src/components/features/habit/habit.ts | 49 + .../settings/tabs/HabitSettingsTab.ts | 21 +- src/index.ts | 23 +- src/integrations/habits/LICENSE | 21 + src/integrations/habits/UPSTREAM.md | 9 + src/integrations/habits/ai-summary.ts | 275 ++ src/integrations/habits/comment-log.ts | 157 + src/integrations/habits/comment-text.ts | 204 ++ src/integrations/habits/compat.d.ts | 4 + src/integrations/habits/habit-store.ts | 1433 ++++++++ src/integrations/habits/i18n/de.ts | 657 ++++ src/integrations/habits/i18n/es.ts | 652 ++++ src/integrations/habits/i18n/fr.ts | 656 ++++ src/integrations/habits/i18n/index.ts | 61 + src/integrations/habits/i18n/ja.ts | 643 ++++ src/integrations/habits/i18n/ko.ts | 644 ++++ src/integrations/habits/i18n/zh.ts | 658 ++++ src/integrations/habits/legacy-import.ts | 96 + src/integrations/habits/main.ts | 458 +++ src/integrations/habits/note-habit.ts | 375 ++ src/integrations/habits/reminders.ts | 475 +++ src/integrations/habits/scoped.css | 3226 +++++++++++++++++ src/integrations/habits/settings.ts | 1282 +++++++ src/integrations/habits/stats.ts | 866 +++++ src/integrations/habits/task-genius-host.ts | 102 + src/integrations/habits/task-genius.css | 17 + src/integrations/habits/types.ts | 345 ++ src/integrations/habits/ui/chart-setup.ts | 32 + src/integrations/habits/ui/color-utils.ts | 60 + src/integrations/habits/ui/comment-suggest.ts | 346 ++ src/integrations/habits/ui/confirm-modal.ts | 65 + src/integrations/habits/ui/dashboard.ts | 2006 ++++++++++ src/integrations/habits/ui/day-status.ts | 368 ++ .../habits/ui/emoji-suggest-modal.ts | 143 + src/integrations/habits/ui/export-modal.ts | 1433 ++++++++ src/integrations/habits/ui/groups-modal.ts | 500 +++ src/integrations/habits/ui/habit-metrics.ts | 1763 +++++++++ src/integrations/habits/ui/habit-modal.ts | 1403 +++++++ src/integrations/habits/ui/habits-block.ts | 41 + src/integrations/habits/ui/habits-compact.ts | 289 ++ src/integrations/habits/ui/habits-heatmap.ts | 449 +++ src/integrations/habits/ui/habits-table.ts | 561 +++ src/integrations/habits/ui/heatmap.ts | 264 ++ .../habits/ui/icon-suggest-modal.ts | 70 + src/integrations/habits/ui/metrics-suggest.ts | 112 + .../habits/ui/missed-habits-modal.ts | 194 + src/integrations/habits/ui/panel-view.ts | 952 +++++ src/integrations/habits/ui/stats-view.ts | 512 +++ src/integrations/habits/ui/vault-suggest.ts | 61 + src/integrations/habits/upstream.css | 3225 ++++++++++++++++ src/integrations/habits/utils.ts | 613 ++++ tests/habits/compact.test.mjs | 353 ++ tests/habits/dom-fixture.mjs | 25 + tests/habits/integration.test.mjs | 253 ++ tests/habits/limit-frequency.test.mjs | 70 + tests/habits/obsidian-fixture.mjs | 119 + tests/habits/styles.test.mjs | 29 + 68 files changed, 30420 insertions(+), 277 deletions(-) create mode 100644 docs/habits-integration.md create mode 100644 "docs/\344\271\240\346\203\257\345\212\237\350\203\275\344\275\277\347\224\250\346\214\207\345\215\227.md" create mode 100644 scripts/check-habits-i18n.cjs create mode 100644 scripts/scope-habits-css.mjs create mode 100644 src/integrations/habits/LICENSE create mode 100644 src/integrations/habits/UPSTREAM.md create mode 100644 src/integrations/habits/ai-summary.ts create mode 100644 src/integrations/habits/comment-log.ts create mode 100644 src/integrations/habits/comment-text.ts create mode 100644 src/integrations/habits/compat.d.ts create mode 100644 src/integrations/habits/habit-store.ts create mode 100644 src/integrations/habits/i18n/de.ts create mode 100644 src/integrations/habits/i18n/es.ts create mode 100644 src/integrations/habits/i18n/fr.ts create mode 100644 src/integrations/habits/i18n/index.ts create mode 100644 src/integrations/habits/i18n/ja.ts create mode 100644 src/integrations/habits/i18n/ko.ts create mode 100644 src/integrations/habits/i18n/zh.ts create mode 100644 src/integrations/habits/legacy-import.ts create mode 100644 src/integrations/habits/main.ts create mode 100644 src/integrations/habits/note-habit.ts create mode 100644 src/integrations/habits/reminders.ts create mode 100644 src/integrations/habits/scoped.css create mode 100644 src/integrations/habits/settings.ts create mode 100644 src/integrations/habits/stats.ts create mode 100644 src/integrations/habits/task-genius-host.ts create mode 100644 src/integrations/habits/task-genius.css create mode 100644 src/integrations/habits/types.ts create mode 100644 src/integrations/habits/ui/chart-setup.ts create mode 100644 src/integrations/habits/ui/color-utils.ts create mode 100644 src/integrations/habits/ui/comment-suggest.ts create mode 100644 src/integrations/habits/ui/confirm-modal.ts create mode 100644 src/integrations/habits/ui/dashboard.ts create mode 100644 src/integrations/habits/ui/day-status.ts create mode 100644 src/integrations/habits/ui/emoji-suggest-modal.ts create mode 100644 src/integrations/habits/ui/export-modal.ts create mode 100644 src/integrations/habits/ui/groups-modal.ts create mode 100644 src/integrations/habits/ui/habit-metrics.ts create mode 100644 src/integrations/habits/ui/habit-modal.ts create mode 100644 src/integrations/habits/ui/habits-block.ts create mode 100644 src/integrations/habits/ui/habits-compact.ts create mode 100644 src/integrations/habits/ui/habits-heatmap.ts create mode 100644 src/integrations/habits/ui/habits-table.ts create mode 100644 src/integrations/habits/ui/heatmap.ts create mode 100644 src/integrations/habits/ui/icon-suggest-modal.ts create mode 100644 src/integrations/habits/ui/metrics-suggest.ts create mode 100644 src/integrations/habits/ui/missed-habits-modal.ts create mode 100644 src/integrations/habits/ui/panel-view.ts create mode 100644 src/integrations/habits/ui/stats-view.ts create mode 100644 src/integrations/habits/ui/vault-suggest.ts create mode 100644 src/integrations/habits/upstream.css create mode 100644 src/integrations/habits/utils.ts create mode 100644 tests/habits/compact.test.mjs create mode 100644 tests/habits/dom-fixture.mjs create mode 100644 tests/habits/integration.test.mjs create mode 100644 tests/habits/limit-frequency.test.mjs create mode 100644 tests/habits/obsidian-fixture.mjs create mode 100644 tests/habits/styles.test.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ec7fc71c..572c0ff16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,5 +45,8 @@ jobs: - name: Build run: pnpm build:release + - name: Run habits tests + run: pnpm test:habits + - name: Run tests run: pnpm exec jest --runInBand --passWithNoTests diff --git a/.gitignore b/.gitignore index 603faad9a..757af2e0d 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,7 @@ packages/*/node_modules # Documentation site (separate repository) docs-site + +# Local habit integration verification artifacts +habits-*.log +habits-*-jest.json diff --git a/docs/habits-integration.md b/docs/habits-integration.md new file mode 100644 index 000000000..6f98cf7d1 --- /dev/null +++ b/docs/habits-integration.md @@ -0,0 +1,37 @@ +# Habits in Task Genius + +This integrates the complete Habits 1.12.1 implementation (MIT, James Clifford Spratt, commit `38c44bc`) into Task Genius's existing Habit view and legacy settings navigation. Vendored code and license are in `src/integrations/habits/`; no zm4341 fork code is used. + +## Supported features + +- Binary, repetition (including decimals), timed and note-backed habits; minimum targets and maximum limits. +- Daily, selected weekdays, monthly dates, fixed intervals, flexible weekly/monthly quotas, planned times, weekly/monthly goals. +- An additional completion-based interval mode: overdue habits remain actionable; completing one restarts the interval from that date. Maximum limits retain fixed scheduling. +- Carousel/grid/vertical/compact dashboards, sidebar panel, grouping, manual sorting, comments with tags/links, animations and mobile layouts. +- Individual metrics and comparisons, monthly/history views, vault heatmaps, weekly/monthly/custom statistics and trends. +- Pause/resume, fail/skip/undo, snooze, stop/resume tracking, missed-instance review and rescheduling. +- PDF export, opt-in AI summaries, Reminder bidirectional checkboxes, note-habit completion and Templater integration. The original experimental switches remain available. +- All original configurable frontmatter keys, plus `intervalMode`; Chinese and English string/placeholder coverage checks. + +## Data and compatibility + +Every habit is a Markdown note in the configurable **Habits folder**. Existing Habits notes are read directly. Changing the folder changes the data source; it does not move or delete files. First initialization reads the standalone plugin's compatible settings; API credentials and automatic Reminder writes are not imported. + +Task Genius's original daily-note-based cards and settings remain under **Existing Task Genius habits**. **Import existing records** previews the note count and destination, then creates notes through Obsidian's vault API. Every note includes a full `taskGeniusLegacy.source` snapshot; originals are untouched. Repeating an import skips matching identities, including renamed imports. Conflicting files are never overwritten. A scheduled habit becomes one binary note per event; mapping habits retain numeric values and their complete original mapping in the snapshot. Import is a snapshot, not continuous synchronization with old daily-note properties: continue recording in one system after importing. + +The new settings live under `habitsIntegration` in Task Genius's existing settings file. The embedded module never writes an independent plugin settings file. + +## Coexistence + +Task Genius always registers `tg-habits`, `tg-habit-metrics`, `tg-habits-table`, and `tg-habits-heatmap`. Its commands insert these prefixed blocks. Existing unprefixed languages are also registered if standalone Habits is disabled when Task Genius initializes. If disabling standalone Habits after Task Genius has loaded, reload Task Genius once to claim its old code blocks. Obsidian itself need not restart. + +While standalone Habits is enabled, Task Genius does not perform automatic note-habit or Reminder synchronization. This prevents duplicate background writes; the dashboard still shares and edits the same Markdown notes. To use Task Genius as the sole replacement, disable standalone Habits and enable the desired integrations in Task Genius. AI requests require a deliberate action and configured endpoint; no real user data was sent during development. + +## Validation + +- `pnpm test:habits`: upstream compact/dashboard interaction and frequency tests, plus integration tests for rolling intervals, folder changes, legacy import, coexistence, disposal, reminders, note completion, comments, mocked AI requests, actual PDF creation and settings rendering in both languages. +- `pnpm check:i18n`: original settings coverage and all statically translated habit strings, including matching placeholders. +- `pnpm build:release`: workspace packages, TypeScript and production JavaScript/CSS. +- Full original Jest suite has existing failures. Compare failures against the unchanged legacy release under the same dependencies; do not suppress or mark those tests skipped. + +Tests use isolated fixtures and a simulated browser document. Final interaction checks in a running Obsidian vault, canvas chart appearance, device-specific mobile rendering and real third-party plugin/network behavior remain manual acceptance checks. Development does not replace the installed plugin or alter live records. diff --git "a/docs/\344\271\240\346\203\257\345\212\237\350\203\275\344\275\277\347\224\250\346\214\207\345\215\227.md" "b/docs/\344\271\240\346\203\257\345\212\237\350\203\275\344\275\277\347\224\250\346\214\207\345\215\227.md" new file mode 100644 index 000000000..104952737 --- /dev/null +++ "b/docs/\344\271\240\346\203\257\345\212\237\350\203\275\344\275\277\347\224\250\346\214\207\345\215\227.md" @@ -0,0 +1,54 @@ +# Task Genius 习惯功能使用指南 + +## 开始使用 + +1. 打开 Task Genius 设置 → **习惯**,开启习惯功能。主设置的导航和旧布局保持不变。 +2. 在习惯设置的**常规**中指定**习惯文件夹**。每个习惯保存为一个 Markdown 文件。已有 Habits 文件可直接读取。 +3. 打开 Task Genius 的习惯页,点击**创建习惯**。也可以用命令面板中的 Task Genius: Habits 命令创建习惯、打开侧栏,或插入看板、统计、表格、热力图。 + +修改文件夹只切换读取位置,不会自动搬动旧文件。要搬家,请在 Obsidian 文件列表中移动习惯文件,再修改设置中的目录。 + +## 选择习惯类型和排期 + +| 需求 | 选择方式 | +| --- | --- | +| 每天阅读,做了就打卡 | 二元习惯 + 每天 | +| 每天喝水 2 升,每次增加 0.25 升 | 计数习惯,目标 2,步长 0.25,单位 L | +| 学习或运动累计多少分钟 | 计时习惯,目标使用分钟 | +| 每周任意三天健身 | 每周灵活目标,目标 3 次 | +| 每月累计一定数量 | 每月灵活目标 | +| 周一、周三、周五固定执行 | 每周,选择多个星期 | +| 隔一天健身,补做后继续隔一天 | 每隔 N 天,N=2,排期选择**从实际完成日期计算** | +| 戒除某事、控制摄入上限 | 上限目标;二元上限表示当天一次也不做 | +| 通过写笔记或完成笔记内清单打卡 | 在实验功能开启笔记习惯,再创建笔记类型 | + +固定间隔沿用开始日期。按实际完成日期间隔时,漏做会一直保留待办;例如 1 日完成、3 日漏做、4 日补做,下一次是 6 日。上限目标使用固定排期。 + +## 日常操作 + +切换日期可以补记历史数据。勾选或增加次数后,数值会写进对应习惯文件的记录属性;撤销打卡也会更新文件。计数支持小数。 + +右键或长按习惯可以编辑、打开原文件、暂停、跳过、标为失败、稍后提醒,或停止追踪。**停止追踪**保留历史;恢复后继续记录。删除操作有确认框。 + +评论可写标签和笔记链接,保存在习惯 Markdown 正文的日志区中。请保留日志区域的开始、结束标记。 + +布局可选轮播、网格、纵向或紧凑列表,并可设置分组、颜色、图标及排序。侧栏适合快速打卡;详情和统计页适合查看历史、趋势、连续记录和不同习惯的对比。统计页也可导出 PDF。 + +## 旧记录与原有 Habits 插件 + +已有 Habits 的习惯文件不需要转换。首次接入会读取它的目录、字段名称等兼容设置,不会复制 API 密钥,也不会自动开启对外写入。 + +原 Task Genius 的日记属性记录仍在**原有 Task Genius 习惯**中可用。点击**导入原有记录**,确认数量和目录后可转成独立习惯文件。原始数据不修改,完整来源快照也会写入新笔记;重复导入会跳过已导入项目。计划型旧习惯按事件拆分,映射型按数值导入,原选项定义保存在来源快照中。 + +导入是一次快照,之后请选择新习惯或旧日记属性中的一种方式继续记录,避免两套记录分叉。 + +独立 Habits 仍开启时,自动提醒和笔记同步由它负责。准备完全改用 Task Genius 时,关闭独立 Habits,再重新加载 Task Genius 一次,使旧笔记中的代码块也交给 Task Genius;无需重启 Obsidian。新插入的代码块使用 `tg-` 前缀,可在两者并存时使用。 + +## 可选集成 + +- **Reminder**:在常规设置启用,选择每日笔记或固定提醒文件,并给习惯设置时间。提醒清单的勾选和习惯记录双向同步。需要自行安装并启用 Reminder 才能获得其通知功能。 +- **笔记习惯 / Templater**:在实验功能开启。可按字数、清单全部完成、清单完成指定数量,或组合条件判定。模板使用 Templater 语法时需启用 Templater。 +- **漏做改期**:在实验功能开启,再通过漏做列表选择新的执行日期。 +- **AI 总结**:在实验功能开启,填写自己的兼容接口、模型和密钥。只有点击生成总结时才向所配置服务发送统计内容;这不是打卡必需功能。 + +文件变化应直接反映到习惯页。手动编辑时请保持 YAML 格式正确,并确保文件位于当前配置的目录;更改字段名称请使用高级设置中的“应用属性名修改”,让已有记录一起更新。 diff --git a/esbuild.config.mjs b/esbuild.config.mjs index 2a524ba61..844dc1954 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -89,7 +89,7 @@ const copyManifestPlugin = { const buildOptions = { banner: { - js: banner, + js: banner + "\n/*! Habits integration: " + fs.readFileSync("src/integrations/habits/LICENSE", "utf8") + " */\n", }, minify: prod ? true : false, entryPoints: ["src/index.ts"], diff --git a/package.json b/package.json index 6721acb02..3e89665db 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,11 @@ "release:beta:minor": "node scripts/smart-beta-release.mjs minor", "release:beta:major": "node scripts/smart-beta-release.mjs major", "release:beta:dry": "node scripts/smart-beta-release.mjs --dry-run", - "check:i18n": "node scripts/check-settings-i18n.cjs", + "check:i18n": "node scripts/check-settings-i18n.cjs && node scripts/check-habits-i18n.cjs", "check:release": "node scripts/check-release-version.cjs", - "build:release": "pnpm --filter esbuild-plugin-inline-worker build && pnpm --filter @taskgenius/calendar build && pnpm build" + "build:release": "pnpm --filter esbuild-plugin-inline-worker build && pnpm --filter @taskgenius/calendar build && pnpm build", + "test:habits": "node --test tests/habits/*.test.mjs", + "check:habits-css": "node scripts/scope-habits-css.mjs" }, "keywords": [ "obsidian", @@ -69,7 +71,9 @@ "semver": "^7.7.2", "ts-jest": "^29.1.0", "tslib": "2.4.0", - "typescript": "4.7.3" + "typescript": "4.7.3", + "postcss": "^8.5.6", + "postcss-selector-parser": "^7.1.0" }, "dependencies": { "@popperjs/core": "^2.11.8", @@ -82,7 +86,10 @@ "obsidian-daily-notes-interface": "^0.9.4", "regexp-match-indices": "^1.0.2", "rrule": "^2.8.1", - "sortablejs": "^1.15.6" + "sortablejs": "^1.15.6", + "chart.js": "^4.4.0", + "chartjs-chart-matrix": "^3.0.5", + "jspdf": "^4.2.1" }, "packageManager": "pnpm@10.26.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d12f410de..733f2b19b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,10 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +overrides: + obsidian-daily-notes-interface>obsidian: 1.10.3 + dompurify: ^3.4.16 + importers: .: @@ -17,12 +21,21 @@ importers: '@types/sortablejs': specifier: ^1.15.8 version: 1.15.9 + chart.js: + specifier: ^4.4.0 + version: 4.6.1 + chartjs-chart-matrix: + specifier: ^3.0.5 + version: 3.1.0(chart.js@4.6.1) chrono-node: specifier: ^2.7.6 version: 2.9.0 date-fns: specifier: ^4.1.0 version: 4.1.0 + jspdf: + specifier: ^4.2.1 + version: 4.2.1 localforage: specifier: ^1.10.0 version: 1.10.0 @@ -59,10 +72,10 @@ importers: version: 4.3.0 '@release-it/bumper': specifier: ^7.0.5 - version: 7.0.5(release-it@19.0.6(@types/node@16.18.126)(magicast@0.3.5)) + version: 7.0.5(release-it@19.0.6(@types/node@16.18.126)(magicast@0.3.5)(supports-color@10.2.2)) '@release-it/conventional-changelog': specifier: ^10.0.1 - version: 10.0.2(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.1)(release-it@19.0.6(@types/node@16.18.126)(magicast@0.3.5)) + version: 10.0.2(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.1)(release-it@19.0.6(@types/node@16.18.126)(magicast@0.3.5)(supports-color@10.2.2)) '@types/jest': specifier: ^29.5.0 version: 29.5.14 @@ -71,10 +84,10 @@ importers: version: 16.18.126 '@typescript-eslint/eslint-plugin': specifier: ^5.2.0 - version: 5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@4.7.3))(eslint@8.57.1)(typescript@4.7.3) + version: 5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3))(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3) '@typescript-eslint/parser': specifier: ^5.2.0 - version: 5.62.0(eslint@8.57.1)(typescript@4.7.3) + version: 5.62.0(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3) builtin-modules: specifier: ^3.2.0 version: 3.3.0 @@ -104,25 +117,31 @@ importers: version: 9.1.7 jest: specifier: ^29.5.0 - version: 29.7.0(@types/node@16.18.126) + version: 29.7.0(@types/node@16.18.126)(supports-color@10.2.2) jest-environment-jsdom: specifier: ^29.5.0 - version: 29.7.0 + version: 29.7.0(supports-color@10.2.2) jszip: specifier: ^3.10.1 version: 3.10.1 monkey-around: specifier: ^3.0.0 version: 3.0.0 + postcss: + specifier: ^8.5.6 + version: 8.5.6 + postcss-selector-parser: + specifier: ^7.1.0 + version: 7.1.7 release-it: specifier: ^19.0.4 - version: 19.0.6(@types/node@16.18.126)(magicast@0.3.5) + version: 19.0.6(@types/node@16.18.126)(magicast@0.3.5)(supports-color@10.2.2) semver: specifier: ^7.7.2 version: 7.7.3 ts-jest: specifier: ^29.1.0 - version: 29.4.5(@babel/core@7.28.5)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.28.5))(esbuild@0.25.9)(jest-util@29.7.0)(jest@29.7.0(@types/node@16.18.126))(typescript@4.7.3) + version: 29.4.5(@babel/core@7.28.5(supports-color@10.2.2))(@jest/transform@29.7.0(supports-color@10.2.2))(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.28.5(supports-color@10.2.2))(supports-color@10.2.2))(esbuild@0.25.9)(jest-util@29.7.0)(jest@29.7.0(@types/node@16.18.126)(supports-color@10.2.2))(typescript@4.7.3) tslib: specifier: 2.4.0 version: 2.4.0 @@ -141,7 +160,7 @@ importers: version: 20.19.25 '@vitest/coverage-v8': specifier: ^1.0.0 - version: 1.6.1(vitest@1.6.1) + version: 1.6.1(supports-color@10.2.2)(vitest@1.6.1) '@vitest/ui': specifier: ^1.0.0 version: 1.6.1(vitest@1.6.1) @@ -150,10 +169,10 @@ importers: version: 1.11.19 jsdom: specifier: ^23.0.0 - version: 23.2.0 + version: 23.2.0(supports-color@10.2.2) release-it: specifier: ^19.0.6 - version: 19.0.6(@types/node@20.19.25)(magicast@0.3.5) + version: 19.0.6(@types/node@20.19.25)(magicast@0.3.5)(supports-color@10.2.2) terser: specifier: ^5.26.0 version: 5.44.1 @@ -171,10 +190,10 @@ importers: version: 5.4.21(@types/node@20.19.25)(terser@5.44.1) vite-plugin-dts: specifier: ^3.6.0 - version: 3.9.1(@types/node@20.19.25)(rollup@4.53.3)(typescript@5.9.3)(vite@5.4.21(@types/node@20.19.25)(terser@5.44.1)) + version: 3.9.1(@types/node@20.19.25)(rollup@4.53.3)(supports-color@10.2.2)(typescript@5.9.3)(vite@5.4.21(@types/node@20.19.25)(terser@5.44.1)) vitest: specifier: ^1.0.0 - version: 1.6.1(@types/node@20.19.25)(@vitest/ui@1.6.1)(jsdom@23.2.0)(terser@5.44.1) + version: 1.6.1(@types/node@20.19.25)(@vitest/ui@1.6.1)(jsdom@23.2.0(supports-color@10.2.2))(supports-color@10.2.2)(terser@5.44.1) wrangler: specifier: ^4.51.0 version: 4.51.0 @@ -357,6 +376,10 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 + '@babel/runtime@7.29.13': + resolution: {integrity: sha512-v+oN26xP4YIlQsbQ/CbTH1WG5m/l/DjKKZNy/Kp3f/AFvbgt7Em/D0FeMM3O2hX0YzeN2M16W8lOpyhIkfCBcQ==} + engines: {node: '>=6.9.0'} + '@babel/template@7.27.2': resolution: {integrity: sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==} engines: {node: '>=6.9.0'} @@ -425,7 +448,7 @@ packages: resolution: {integrity: sha512-p44TsNArL4IVXDTbapUmEkAlvWs2CFQbcfc0ymDsis1kH2wh0gcY96AS29c/vp2d0y2Tquk1EDSaawpzilUiAw==} '@codemirror/language@https://codeload.github.com/lishid/cm-language/tar.gz/a9c3c7efe17dd1d24395ee2a179fe12dd6ed1e76': - resolution: {tarball: https://codeload.github.com/lishid/cm-language/tar.gz/a9c3c7efe17dd1d24395ee2a179fe12dd6ed1e76} + resolution: {gitHosted: true, tarball: https://codeload.github.com/lishid/cm-language/tar.gz/a9c3c7efe17dd1d24395ee2a179fe12dd6ed1e76} version: 6.11.2 '@codemirror/lint@6.9.2': @@ -1010,67 +1033,79 @@ packages: resolution: {integrity: sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==} cpu: [arm64] os: [linux] + libc: [glibc] '@img/sharp-libvips-linux-arm@1.0.5': resolution: {integrity: sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==} cpu: [arm] os: [linux] + libc: [glibc] '@img/sharp-libvips-linux-s390x@1.0.4': resolution: {integrity: sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==} cpu: [s390x] os: [linux] + libc: [glibc] '@img/sharp-libvips-linux-x64@1.0.4': resolution: {integrity: sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==} cpu: [x64] os: [linux] + libc: [glibc] '@img/sharp-libvips-linuxmusl-arm64@1.0.4': resolution: {integrity: sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==} cpu: [arm64] os: [linux] + libc: [musl] '@img/sharp-libvips-linuxmusl-x64@1.0.4': resolution: {integrity: sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==} cpu: [x64] os: [linux] + libc: [musl] '@img/sharp-linux-arm64@0.33.5': resolution: {integrity: sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [arm64] os: [linux] + libc: [glibc] '@img/sharp-linux-arm@0.33.5': resolution: {integrity: sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [arm] os: [linux] + libc: [glibc] '@img/sharp-linux-s390x@0.33.5': resolution: {integrity: sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [s390x] os: [linux] + libc: [glibc] '@img/sharp-linux-x64@0.33.5': resolution: {integrity: sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [x64] os: [linux] + libc: [glibc] '@img/sharp-linuxmusl-arm64@0.33.5': resolution: {integrity: sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [arm64] os: [linux] + libc: [musl] '@img/sharp-linuxmusl-x64@0.33.5': resolution: {integrity: sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} cpu: [x64] os: [linux] + libc: [musl] '@img/sharp-wasm32@0.33.5': resolution: {integrity: sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==} @@ -1319,6 +1354,9 @@ packages: '@jridgewell/trace-mapping@0.3.9': resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + '@kurkle/color@0.3.4': + resolution: {integrity: sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==} + '@lezer/common@1.3.0': resolution: {integrity: sha512-L9X8uHCYU310o99L3/MpJKYxPzXPOS7S0NmBaM7UO/x2Kb2WbmMLSkfvdr1KxRIFYOpbY0Jhn7CfLSUDzL8arQ==} @@ -1491,56 +1529,67 @@ packages: resolution: {integrity: sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.53.3': resolution: {integrity: sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.53.3': resolution: {integrity: sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.53.3': resolution: {integrity: sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.53.3': resolution: {integrity: sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g==} cpu: [loong64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-ppc64-gnu@4.53.3': resolution: {integrity: sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.53.3': resolution: {integrity: sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.53.3': resolution: {integrity: sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A==} cpu: [riscv64] os: [linux] + libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.53.3': resolution: {integrity: sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.53.3': resolution: {integrity: sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.53.3': resolution: {integrity: sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-openharmony-arm64@4.53.3': resolution: {integrity: sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw==} @@ -1681,10 +1730,16 @@ packages: '@types/normalize-package-data@2.4.4': resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} + '@types/pako@2.0.4': + resolution: {integrity: sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==} + '@types/parse-path@7.1.0': resolution: {integrity: sha512-EULJ8LApcVEPbrfND0cRQqutIOdiIgJ1Mgrhpy755r14xMohPTEpkV/k28SJvuOs9bHRFW8x+KeDAEPiGQPB9Q==} deprecated: This is a stub types definition. parse-path provides its own type definitions, so you do not need this installed. + '@types/raf@3.4.3': + resolution: {integrity: sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==} + '@types/semver@7.7.1': resolution: {integrity: sha512-FmgJfu+MOcQ370SD0ev7EI8TlCAfKYU+B4m5T3yXc1CiRN94g/SZPtsCkk506aUDtlMnFZvasDwHHUcZUEaYuA==} @@ -1700,6 +1755,9 @@ packages: '@types/tough-cookie@4.0.5': resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} + '@types/trusted-types@2.0.7': + resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} + '@types/yargs-parser@21.0.3': resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} @@ -1766,6 +1824,7 @@ packages: '@ungap/structured-clone@1.3.0': resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==} + deprecated: Potential CWE-502 - Update to 1.3.1 or higher '@vitest/coverage-v8@1.6.1': resolution: {integrity: sha512-6YeRZwuO4oTGKxD3bijok756oktHSIm3eczVVzNe3scqzuhLwltIF3S9ZL/vwOVIpURmU6SnZhziXXAfw8/Qlw==} @@ -1800,6 +1859,11 @@ packages: '@volar/typescript@1.11.1': resolution: {integrity: sha512-iU+t2mas/4lYierSnoFOeRFQUhAEMgsFuQxoxvwn5EdQopw43j+J27a4lt9LMInx1gLJBC6qL14WYGlgymaSMQ==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true '@vue/compiler-core@3.5.25': resolution: {integrity: sha512-vay5/oQJdsNHmliWoZfHPoVZZRmnSWhug0BYT34njkYTPqClh3DNWLkZNJBVSjsNMrg0CCrBfoKkjZQPM/QVUw==} @@ -1943,6 +2007,10 @@ packages: balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + base64-arraybuffer@1.0.2: + resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==} + engines: {node: '>= 0.6.0'} + baseline-browser-mapping@2.8.31: resolution: {integrity: sha512-a28v2eWrrRWPpJSzxc+mKwm0ZtVx/G8SepdQZDArnXYU/XS+IF6mp8aB/4E+hH1tyGCoDo3KlUCdlSxGDsRkAw==} hasBin: true @@ -1950,6 +2018,7 @@ packages: basic-ftp@5.0.5: resolution: {integrity: sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==} engines: {node: '>=10.0.0'} + deprecated: Security vulnerability fixed in 5.2.1, please upgrade before-after-hook@4.0.0: resolution: {integrity: sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==} @@ -2027,6 +2096,10 @@ packages: caniuse-lite@1.0.30001757: resolution: {integrity: sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ==} + canvg@3.0.11: + resolution: {integrity: sha512-5ON+q7jCTgMp9cjpu4Jo6XbvfYwSB2Ow3kzHKfIyJfaCAOHLbdKPQqGKgfED/R5B+3TFFfe8pegYA+b423SRyA==} + engines: {node: '>=10.0.0'} + chai@4.5.0: resolution: {integrity: sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==} engines: {node: '>=4'} @@ -2046,6 +2119,15 @@ packages: chardet@2.1.1: resolution: {integrity: sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==} + chart.js@4.6.1: + resolution: {integrity: sha512-hJyniucsFmq//EvXYvJ6c6mahPoI3kaxdjVH8awTaJ/fDNWeSqqqArixMJWkWNN6fcYvPU3HneSANFNYtRi61g==} + engines: {pnpm: '>=8'} + + chartjs-chart-matrix@3.1.0: + resolution: {integrity: sha512-pdo8DnhFXOisjbLDgfkzZH1w0xmjGqiaAMgkQSHCEMzxQENsXTgkXImIyweDiO7SqlE5PuzjhklyBCiorQhRmw==} + peerDependencies: + chart.js: '>=3.0.0' + check-error@1.0.3: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} @@ -2162,15 +2244,18 @@ packages: conventional-changelog-atom@5.0.0: resolution: {integrity: sha512-WfzCaAvSCFPkznnLgLnfacRAzjgqjLUjvf3MftfsJzQdDICqkOOpcMtdJF3wTerxSpv2IAAjX8doM3Vozqle3g==} engines: {node: '>=18'} + deprecated: This preset is deprecated. Please use conventional-changelog-conventionalcommits or conventional-changelog-angular instead. conventional-changelog-cli@5.0.0: resolution: {integrity: sha512-9Y8fucJe18/6ef6ZlyIlT2YQUbczvoQZZuYmDLaGvcSBP+M6h+LAvf7ON7waRxKJemcCII8Yqu5/8HEfskTxJQ==} engines: {node: '>=18'} + deprecated: This package is no longer maintained. Please use the conventional-changelog package instead. hasBin: true conventional-changelog-codemirror@5.0.0: resolution: {integrity: sha512-8gsBDI5Y3vrKUCxN6Ue8xr6occZ5nsDEc4C7jO/EovFGozx8uttCAyfhRrvoUAWi2WMm3OmYs+0mPJU7kQdYWQ==} engines: {node: '>=18'} + deprecated: This preset is deprecated. Please use conventional-changelog-conventionalcommits or conventional-changelog-angular instead. conventional-changelog-conventionalcommits@8.0.0: resolution: {integrity: sha512-eOvlTO6OcySPyyyk8pKz2dP4jjElYunj9hn9/s0OB+gapTO8zwS9UQWrZ1pmF2hFs3vw1xhonOLGcGjy/zgsuA==} @@ -2183,26 +2268,32 @@ packages: conventional-changelog-core@8.0.0: resolution: {integrity: sha512-EATUx5y9xewpEe10UEGNpbSHRC6cVZgO+hXQjofMqpy+gFIrcGvH3Fl6yk2VFKh7m+ffenup2N7SZJYpyD9evw==} engines: {node: '>=18'} + deprecated: Deprecated and no longer maintained. Please use conventional-changelog instead. conventional-changelog-ember@5.0.0: resolution: {integrity: sha512-RPflVfm5s4cSO33GH/Ey26oxhiC67akcxSKL8CLRT3kQX2W3dbE19sSOM56iFqUJYEwv9mD9r6k79weWe1urfg==} engines: {node: '>=18'} + deprecated: This preset is deprecated. Please use conventional-changelog-conventionalcommits or conventional-changelog-angular instead. conventional-changelog-eslint@6.0.0: resolution: {integrity: sha512-eiUyULWjzq+ybPjXwU6NNRflApDWlPEQEHvI8UAItYW/h22RKkMnOAtfCZxMmrcMO1OKUWtcf2MxKYMWe9zJuw==} engines: {node: '>=18'} + deprecated: This preset is deprecated. Please use conventional-changelog-conventionalcommits or conventional-changelog-angular instead. conventional-changelog-express@5.0.0: resolution: {integrity: sha512-D8Q6WctPkQpvr2HNCCmwU5GkX22BVHM0r4EW8vN0230TSyS/d6VQJDAxGb84lbg0dFjpO22MwmsikKL++Oo/oQ==} engines: {node: '>=18'} + deprecated: This preset is deprecated. Please use conventional-changelog-conventionalcommits or conventional-changelog-angular instead. conventional-changelog-jquery@6.0.0: resolution: {integrity: sha512-2kxmVakyehgyrho2ZHBi90v4AHswkGzHuTaoH40bmeNqUt20yEkDOSpw8HlPBfvEQBwGtbE+5HpRwzj6ac2UfA==} engines: {node: '>=18'} + deprecated: This preset is deprecated. Please use conventional-changelog-conventionalcommits or conventional-changelog-angular instead. conventional-changelog-jshint@5.0.0: resolution: {integrity: sha512-gGNphSb/opc76n2eWaO6ma4/Wqu3tpa2w7i9WYqI6Cs2fncDSI2/ihOfMvXveeTTeld0oFvwMVNV+IYQIk3F3g==} engines: {node: '>=18'} + deprecated: This preset is deprecated. Please use conventional-changelog-conventionalcommits or conventional-changelog-angular instead. conventional-changelog-preset-loader@5.0.0: resolution: {integrity: sha512-SetDSntXLk8Jh1NOAl1Gu5uLiCNSYenB5tm0YVeZKePRIgDW9lQImromTwLa3c/Gae298tsgOM+/CYT9XAl0NA==} @@ -2243,6 +2334,9 @@ packages: resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==} engines: {node: '>=18'} + core-js@3.51.0: + resolution: {integrity: sha512-7bDKx/5jm5MxzsXxc93g6Z2+4ZsuT/MddrfRmTDJNAkWsYWHU8EVNEsBiIEWnMAMCHMmRfUEjkuo3jeNBOIHRw==} + core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} @@ -2263,6 +2357,9 @@ packages: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} + css-line-break@2.1.0: + resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==} + css-select@5.2.2: resolution: {integrity: sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==} @@ -2274,6 +2371,11 @@ packages: resolution: {integrity: sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==} engines: {node: '>= 6'} + cssesc@3.0.0: + resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} + engines: {node: '>=4'} + hasBin: true + cssom@0.3.8: resolution: {integrity: sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==} @@ -2405,6 +2507,9 @@ packages: resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} engines: {node: '>= 4'} + dompurify@3.4.17: + resolution: {integrity: sha512-B/pSlYVHQ58kqISD/yDjuJ1yfzI34m1gF4lAod2bwSRhiN4K5Cl3H8Af7hqB2PmTL911tdEudnnXn5FnhRoz0w==} + domutils@3.2.2: resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==} @@ -2591,6 +2696,9 @@ packages: fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + fast-png@6.4.0: + resolution: {integrity: sha512-kAqZq1TlgBjZcLr5mcN6NP5Rv4V2f22z00c3g8vRrwkcqjerx7BEhPbOnWCPqaHUl2XWQBJQvOT/FQhdMT7X/Q==} + fastq@1.19.1: resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} @@ -2708,11 +2816,13 @@ packages: git-raw-commits@5.0.0: resolution: {integrity: sha512-I2ZXrXeOc0KrCvC7swqtIFXFN+rbjnC7b2T943tvemIOVNl+XP8YnA9UVwqFhzzLClnSA60KR/qEjLpXzs73Qg==} engines: {node: '>=18'} + deprecated: Deprecated and no longer maintained. Use @conventional-changelog/git-client instead. hasBin: true git-semver-tags@8.0.0: resolution: {integrity: sha512-N7YRIklvPH3wYWAR2vysaqGLPRcpwQ0GKdlqTiVN5w1UmCdaeY3K8s6DMKRCh54DDdzyt/OAB6C8jgVtb7Y2Fg==} engines: {node: '>=18'} + deprecated: Deprecated and no longer maintained. Use @conventional-changelog/git-client instead. hasBin: true git-up@8.1.1: @@ -2734,7 +2844,7 @@ packages: glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me globals@13.24.0: resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} @@ -2802,6 +2912,10 @@ packages: html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} + html2canvas@1.4.1: + resolution: {integrity: sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==} + engines: {node: '>=8.0.0'} + htmlparser2@10.0.0: resolution: {integrity: sha512-TwAZM+zE5Tq3lrEHvOlvwgj1XLWQCtaaibSN11Q+gGBAS7Y1uZSWwXXRe4iF6OXnaq1riyQAPFOBtYc77Mxq0g==} @@ -2894,6 +3008,9 @@ packages: '@types/node': optional: true + iobuffer@5.4.0: + resolution: {integrity: sha512-DRebOWuqDvxunfkNJAlc3IzWIPD5xVxwUNbHr7xKB8E6aLJxIPfNX3CoMJghcFjpv6RWQsrcJbghtEwSPoJqMA==} + ip-address@10.1.0: resolution: {integrity: sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==} engines: {node: '>= 12'} @@ -3215,6 +3332,9 @@ packages: jsonfile@4.0.0: resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} + jspdf@4.2.1: + resolution: {integrity: sha512-YyAXyvnmjTbR4bHQRLzex3CuINCDlQnBqoSYyjJwTP2x9jDLuKDzy7aKUl0hgx3uhcl7xzg32agn5vlie6HIlQ==} + jszip@3.10.1: resolution: {integrity: sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==} @@ -3520,13 +3640,6 @@ packages: '@codemirror/state': 6.5.0 '@codemirror/view': 6.38.6 - obsidian@https://codeload.github.com/obsidianmd/obsidian-api/tar.gz/53cf3bd402cec654bcf1d963b43cb01d05a6efdf: - resolution: {tarball: https://codeload.github.com/obsidianmd/obsidian-api/tar.gz/53cf3bd402cec654bcf1d963b43cb01d05a6efdf} - version: 1.10.3 - peerDependencies: - '@codemirror/state': 6.5.0 - '@codemirror/view': 6.38.6 - ohash@2.0.11: resolution: {integrity: sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==} @@ -3596,6 +3709,9 @@ packages: pako@1.0.11: resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==} + pako@2.2.0: + resolution: {integrity: sha512-zJq6RP/5q+TO2OpFV3FHzlPnFjmkb7Nc99a5SNjJE+uu/PkpChs+NIZSSzbBoD+6kjiISXjfYdwj1ZRQ81dz/w==} + parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -3669,6 +3785,9 @@ packages: perfect-debounce@2.0.0: resolution: {integrity: sha512-fkEH/OBiKrqqI/yIgjR92lMfs2K8105zt/VT6+7eTjNwisrsh47CeIED9z58zI7DfKdH3uHAn25ziRZn3kgAow==} + performance-now@2.1.0: + resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} + picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -3694,6 +3813,10 @@ packages: pkg-types@2.3.0: resolution: {integrity: sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig==} + postcss-selector-parser@7.1.7: + resolution: {integrity: sha512-wWBro/7hJ40ye6TPiXkUQoXKCw23xSsjriUvqd7Uls9Sso3oLiON1flc18cCdnjgCRXw4fBVqUJJeOdDTh3P3g==} + engines: {node: '>=4'} + postcss@8.5.6: resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} engines: {node: ^10 || ^12 || >=14} @@ -3739,6 +3862,9 @@ packages: queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + raf@3.4.1: + resolution: {integrity: sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==} + rc9@2.1.2: resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==} @@ -3764,6 +3890,9 @@ packages: resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} engines: {node: '>= 14.18.0'} + regenerator-runtime@0.13.11: + resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==} + regexp-match-indices@1.0.2: resolution: {integrity: sha512-DwZuAkt8NF5mKwGGER1EGh2PRqyvhRhhLviH+R8y8dIuaQROlUfXjt4s9ZTXstIsSkptf06BSvwcEmmfheJJWQ==} @@ -3823,6 +3952,10 @@ packages: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + rgbcolor@1.0.1: + resolution: {integrity: sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==} + engines: {node: '>= 0.8.15'} + rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} deprecated: Rimraf versions prior to v4 are no longer supported @@ -3985,6 +4118,10 @@ packages: stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + stackblur-canvas@2.7.0: + resolution: {integrity: sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==} + engines: {node: '>=0.1.14'} + std-env@3.10.0: resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} @@ -4064,6 +4201,10 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + svg-pathdata@6.0.3: + resolution: {integrity: sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==} + engines: {node: '>=12.0.0'} + symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} @@ -4084,6 +4225,9 @@ packages: resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} engines: {node: '>=8'} + text-segmentation@1.0.3: + resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==} + text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} @@ -4296,6 +4440,9 @@ packages: util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + utrie@1.0.2: + resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==} + v8-to-istanbul@9.3.0: resolution: {integrity: sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==} engines: {node: '>=10.12.0'} @@ -4418,10 +4565,12 @@ packages: whatwg-encoding@2.0.0: resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} engines: {node: '>=12'} + deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation whatwg-encoding@3.1.1: resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} engines: {node: '>=18'} + deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation whatwg-mimetype@3.0.0: resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} @@ -4609,20 +4758,20 @@ snapshots: '@babel/compat-data@7.28.5': {} - '@babel/core@7.28.5': + '@babel/core@7.28.5(supports-color@10.2.2)': dependencies: '@babel/code-frame': 7.27.1 '@babel/generator': 7.28.5 '@babel/helper-compilation-targets': 7.27.2 - '@babel/helper-module-transforms': 7.28.3(@babel/core@7.28.5) + '@babel/helper-module-transforms': 7.28.3(@babel/core@7.28.5(supports-color@10.2.2))(supports-color@10.2.2) '@babel/helpers': 7.28.4 '@babel/parser': 7.28.5 '@babel/template': 7.27.2 - '@babel/traverse': 7.28.5 + '@babel/traverse': 7.28.5(supports-color@10.2.2) '@babel/types': 7.28.5 '@jridgewell/remapping': 2.3.5 convert-source-map: 2.0.0 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -4647,19 +4796,19 @@ snapshots: '@babel/helper-globals@7.28.0': {} - '@babel/helper-module-imports@7.27.1': + '@babel/helper-module-imports@7.27.1(supports-color@10.2.2)': dependencies: - '@babel/traverse': 7.28.5 + '@babel/traverse': 7.28.5(supports-color@10.2.2) '@babel/types': 7.28.5 transitivePeerDependencies: - supports-color - '@babel/helper-module-transforms@7.28.3(@babel/core@7.28.5)': + '@babel/helper-module-transforms@7.28.3(@babel/core@7.28.5(supports-color@10.2.2))(supports-color@10.2.2)': dependencies: - '@babel/core': 7.28.5 - '@babel/helper-module-imports': 7.27.1 + '@babel/core': 7.28.5(supports-color@10.2.2) + '@babel/helper-module-imports': 7.27.1(supports-color@10.2.2) '@babel/helper-validator-identifier': 7.28.5 - '@babel/traverse': 7.28.5 + '@babel/traverse': 7.28.5(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -4680,98 +4829,100 @@ snapshots: dependencies: '@babel/types': 7.28.5 - '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.28.5)': + '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.28.5)': + '@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.28.5)': + '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.28.5)': + '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-import-attributes@7.27.1(@babel/core@7.28.5)': + '@babel/plugin-syntax-import-attributes@7.27.1(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.28.5)': + '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.28.5)': + '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-jsx@7.27.1(@babel/core@7.28.5)': + '@babel/plugin-syntax-jsx@7.27.1(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.28.5)': + '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.28.5)': + '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.28.5)': + '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.28.5)': + '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.28.5)': + '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.28.5)': + '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.28.5)': + '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.28.5)': + '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 - '@babel/plugin-syntax-typescript@7.27.1(@babel/core@7.28.5)': + '@babel/plugin-syntax-typescript@7.27.1(@babel/core@7.28.5(supports-color@10.2.2))': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/helper-plugin-utils': 7.27.1 + '@babel/runtime@7.29.13': {} + '@babel/template@7.27.2': dependencies: '@babel/code-frame': 7.27.1 '@babel/parser': 7.28.5 '@babel/types': 7.28.5 - '@babel/traverse@7.28.5': + '@babel/traverse@7.28.5(supports-color@10.2.2)': dependencies: '@babel/code-frame': 7.27.1 '@babel/generator': 7.28.5 @@ -4779,7 +4930,7 @@ snapshots: '@babel/parser': 7.28.5 '@babel/template': 7.27.2 '@babel/types': 7.28.5 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -5140,17 +5291,17 @@ snapshots: '@esbuild/win32-x64@0.25.9': optional: true - '@eslint-community/eslint-utils@4.9.0(eslint@8.57.1)': + '@eslint-community/eslint-utils@4.9.0(eslint@8.57.1(supports-color@10.2.2))': dependencies: - eslint: 8.57.1 + eslint: 8.57.1(supports-color@10.2.2) eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.12.2': {} - '@eslint/eslintrc@2.1.4': + '@eslint/eslintrc@2.1.4(supports-color@10.2.2)': dependencies: ajv: 6.12.6 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) espree: 9.6.1 globals: 13.24.0 ignore: 5.3.2 @@ -5163,10 +5314,10 @@ snapshots: '@eslint/js@8.57.1': {} - '@humanwhocodes/config-array@0.13.0': + '@humanwhocodes/config-array@0.13.0(supports-color@10.2.2)': dependencies: '@humanwhocodes/object-schema': 2.0.3 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -5519,12 +5670,12 @@ snapshots: jest-util: 29.7.0 slash: 3.0.0 - '@jest/core@29.7.0': + '@jest/core@29.7.0(supports-color@10.2.2)': dependencies: '@jest/console': 29.7.0 - '@jest/reporters': 29.7.0 + '@jest/reporters': 29.7.0(supports-color@10.2.2) '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 + '@jest/transform': 29.7.0(supports-color@10.2.2) '@jest/types': 29.6.3 '@types/node': 16.18.126 ansi-escapes: 4.3.2 @@ -5533,15 +5684,15 @@ snapshots: exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@16.18.126) + jest-config: 29.7.0(@types/node@16.18.126)(supports-color@10.2.2) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 jest-resolve: 29.7.0 - jest-resolve-dependencies: 29.7.0 - jest-runner: 29.7.0 - jest-runtime: 29.7.0 - jest-snapshot: 29.7.0 + jest-resolve-dependencies: 29.7.0(supports-color@10.2.2) + jest-runner: 29.7.0(supports-color@10.2.2) + jest-runtime: 29.7.0(supports-color@10.2.2) + jest-snapshot: 29.7.0(supports-color@10.2.2) jest-util: 29.7.0 jest-validate: 29.7.0 jest-watcher: 29.7.0 @@ -5565,10 +5716,10 @@ snapshots: dependencies: jest-get-type: 29.6.3 - '@jest/expect@29.7.0': + '@jest/expect@29.7.0(supports-color@10.2.2)': dependencies: expect: 29.7.0 - jest-snapshot: 29.7.0 + jest-snapshot: 29.7.0(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -5581,21 +5732,21 @@ snapshots: jest-mock: 29.7.0 jest-util: 29.7.0 - '@jest/globals@29.7.0': + '@jest/globals@29.7.0(supports-color@10.2.2)': dependencies: '@jest/environment': 29.7.0 - '@jest/expect': 29.7.0 + '@jest/expect': 29.7.0(supports-color@10.2.2) '@jest/types': 29.6.3 jest-mock: 29.7.0 transitivePeerDependencies: - supports-color - '@jest/reporters@29.7.0': + '@jest/reporters@29.7.0(supports-color@10.2.2)': dependencies: '@bcoe/v8-coverage': 0.2.3 '@jest/console': 29.7.0 '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 + '@jest/transform': 29.7.0(supports-color@10.2.2) '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.31 '@types/node': 16.18.126 @@ -5605,9 +5756,9 @@ snapshots: glob: 7.2.3 graceful-fs: 4.2.11 istanbul-lib-coverage: 3.2.2 - istanbul-lib-instrument: 6.0.3 + istanbul-lib-instrument: 6.0.3(supports-color@10.2.2) istanbul-lib-report: 3.0.1 - istanbul-lib-source-maps: 4.0.1 + istanbul-lib-source-maps: 4.0.1(supports-color@10.2.2) istanbul-reports: 3.2.0 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -5643,12 +5794,12 @@ snapshots: jest-haste-map: 29.7.0 slash: 3.0.0 - '@jest/transform@29.7.0': + '@jest/transform@29.7.0(supports-color@10.2.2)': dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.31 - babel-plugin-istanbul: 6.1.1 + babel-plugin-istanbul: 6.1.1(supports-color@10.2.2) chalk: 4.1.2 convert-source-map: 2.0.0 fast-json-stable-stringify: 2.1.0 @@ -5668,7 +5819,7 @@ snapshots: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 16.18.126 + '@types/node': 24.10.1 '@types/yargs': 17.0.35 chalk: 4.1.2 @@ -5701,6 +5852,8 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 + '@kurkle/color@0.3.4': {} + '@lezer/common@1.3.0': {} '@lezer/highlight@1.2.3': @@ -5850,7 +6003,7 @@ snapshots: '@poppinss/exception@1.2.2': {} - '@release-it/bumper@7.0.5(release-it@19.0.6(@types/node@16.18.126)(magicast@0.3.5))': + '@release-it/bumper@7.0.5(release-it@19.0.6(@types/node@16.18.126)(magicast@0.3.5)(supports-color@10.2.2))': dependencies: '@iarna/toml': 3.0.0 cheerio: 1.1.2 @@ -5859,10 +6012,10 @@ snapshots: ini: 5.0.0 js-yaml: 4.1.1 lodash-es: 4.17.21 - release-it: 19.0.6(@types/node@16.18.126)(magicast@0.3.5) + release-it: 19.0.6(@types/node@16.18.126)(magicast@0.3.5)(supports-color@10.2.2) semver: 7.7.3 - '@release-it/conventional-changelog@10.0.2(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.1)(release-it@19.0.6(@types/node@16.18.126)(magicast@0.3.5))': + '@release-it/conventional-changelog@10.0.2(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.1)(release-it@19.0.6(@types/node@16.18.126)(magicast@0.3.5)(supports-color@10.2.2))': dependencies: '@conventional-changelog/git-client': 2.5.1(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.1) concat-stream: 2.0.0 @@ -5870,7 +6023,7 @@ snapshots: conventional-changelog-angular: 8.1.0 conventional-changelog-conventionalcommits: 9.1.0 conventional-recommended-bump: 11.2.0 - release-it: 19.0.6(@types/node@16.18.126)(magicast@0.3.5) + release-it: 19.0.6(@types/node@16.18.126)(magicast@0.3.5)(supports-color@10.2.2) semver: 7.7.3 transitivePeerDependencies: - conventional-commits-filter @@ -6042,7 +6195,7 @@ snapshots: '@types/graceful-fs@4.1.9': dependencies: - '@types/node': 16.18.126 + '@types/node': 24.10.1 '@types/istanbul-lib-coverage@2.0.6': {} @@ -6083,10 +6236,15 @@ snapshots: '@types/normalize-package-data@2.4.4': {} + '@types/pako@2.0.4': {} + '@types/parse-path@7.1.0': dependencies: parse-path: 7.1.0 + '@types/raf@3.4.3': + optional: true + '@types/semver@7.7.1': {} '@types/sortablejs@1.15.9': {} @@ -6099,21 +6257,24 @@ snapshots: '@types/tough-cookie@4.0.5': {} + '@types/trusted-types@2.0.7': + optional: true + '@types/yargs-parser@21.0.3': {} '@types/yargs@17.0.35': dependencies: '@types/yargs-parser': 21.0.3 - '@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@4.7.3))(eslint@8.57.1)(typescript@4.7.3)': + '@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3))(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3)': dependencies: '@eslint-community/regexpp': 4.12.2 - '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@4.7.3) + '@typescript-eslint/parser': 5.62.0(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3) '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/type-utils': 5.62.0(eslint@8.57.1)(typescript@4.7.3) - '@typescript-eslint/utils': 5.62.0(eslint@8.57.1)(typescript@4.7.3) - debug: 4.4.3 - eslint: 8.57.1 + '@typescript-eslint/type-utils': 5.62.0(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3) + '@typescript-eslint/utils': 5.62.0(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3) + debug: 4.4.3(supports-color@10.2.2) + eslint: 8.57.1(supports-color@10.2.2) graphemer: 1.4.0 ignore: 5.3.2 natural-compare-lite: 1.4.0 @@ -6124,13 +6285,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@4.7.3)': + '@typescript-eslint/parser@5.62.0(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3)': dependencies: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@4.7.3) - debug: 4.4.3 - eslint: 8.57.1 + '@typescript-eslint/typescript-estree': 5.62.0(supports-color@10.2.2)(typescript@4.7.3) + debug: 4.4.3(supports-color@10.2.2) + eslint: 8.57.1(supports-color@10.2.2) optionalDependencies: typescript: 4.7.3 transitivePeerDependencies: @@ -6141,12 +6302,12 @@ snapshots: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/visitor-keys': 5.62.0 - '@typescript-eslint/type-utils@5.62.0(eslint@8.57.1)(typescript@4.7.3)': + '@typescript-eslint/type-utils@5.62.0(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3)': dependencies: - '@typescript-eslint/typescript-estree': 5.62.0(typescript@4.7.3) - '@typescript-eslint/utils': 5.62.0(eslint@8.57.1)(typescript@4.7.3) - debug: 4.4.3 - eslint: 8.57.1 + '@typescript-eslint/typescript-estree': 5.62.0(supports-color@10.2.2)(typescript@4.7.3) + '@typescript-eslint/utils': 5.62.0(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3) + debug: 4.4.3(supports-color@10.2.2) + eslint: 8.57.1(supports-color@10.2.2) tsutils: 3.21.0(typescript@4.7.3) optionalDependencies: typescript: 4.7.3 @@ -6155,11 +6316,11 @@ snapshots: '@typescript-eslint/types@5.62.0': {} - '@typescript-eslint/typescript-estree@5.62.0(typescript@4.7.3)': + '@typescript-eslint/typescript-estree@5.62.0(supports-color@10.2.2)(typescript@4.7.3)': dependencies: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/visitor-keys': 5.62.0 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) globby: 11.1.0 is-glob: 4.0.3 semver: 7.7.3 @@ -6169,15 +6330,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@5.62.0(eslint@8.57.1)(typescript@4.7.3)': + '@typescript-eslint/utils@5.62.0(eslint@8.57.1(supports-color@10.2.2))(supports-color@10.2.2)(typescript@4.7.3)': dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@8.57.1) + '@eslint-community/eslint-utils': 4.9.0(eslint@8.57.1(supports-color@10.2.2)) '@types/json-schema': 7.0.15 '@types/semver': 7.7.1 '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@4.7.3) - eslint: 8.57.1 + '@typescript-eslint/typescript-estree': 5.62.0(supports-color@10.2.2)(typescript@4.7.3) + eslint: 8.57.1(supports-color@10.2.2) eslint-scope: 5.1.1 semver: 7.7.3 transitivePeerDependencies: @@ -6191,14 +6352,14 @@ snapshots: '@ungap/structured-clone@1.3.0': {} - '@vitest/coverage-v8@1.6.1(vitest@1.6.1)': + '@vitest/coverage-v8@1.6.1(supports-color@10.2.2)(vitest@1.6.1)': dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 0.2.3 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) istanbul-lib-coverage: 3.2.2 istanbul-lib-report: 3.0.1 - istanbul-lib-source-maps: 5.0.6 + istanbul-lib-source-maps: 5.0.6(supports-color@10.2.2) istanbul-reports: 3.2.0 magic-string: 0.30.21 magicast: 0.3.5 @@ -6206,7 +6367,7 @@ snapshots: std-env: 3.10.0 strip-literal: 2.1.1 test-exclude: 6.0.0 - vitest: 1.6.1(@types/node@20.19.25)(@vitest/ui@1.6.1)(jsdom@23.2.0)(terser@5.44.1) + vitest: 1.6.1(@types/node@20.19.25)(@vitest/ui@1.6.1)(jsdom@23.2.0(supports-color@10.2.2))(supports-color@10.2.2)(terser@5.44.1) transitivePeerDependencies: - supports-color @@ -6241,7 +6402,7 @@ snapshots: pathe: 1.1.2 picocolors: 1.1.1 sirv: 2.0.4 - vitest: 1.6.1(@types/node@20.19.25)(@vitest/ui@1.6.1)(jsdom@23.2.0)(terser@5.44.1) + vitest: 1.6.1(@types/node@20.19.25)(@vitest/ui@1.6.1)(jsdom@23.2.0(supports-color@10.2.2))(supports-color@10.2.2)(terser@5.44.1) '@vitest/utils@1.6.1': dependencies: @@ -6258,10 +6419,12 @@ snapshots: dependencies: muggle-string: 0.3.1 - '@volar/typescript@1.11.1': + '@volar/typescript@1.11.1(typescript@5.9.3)': dependencies: '@volar/language-core': 1.11.1 path-browserify: 1.0.1 + optionalDependencies: + typescript: 5.9.3 '@vue/compiler-core@3.5.25': dependencies: @@ -6315,9 +6478,9 @@ snapshots: add-stream@1.0.0: {} - agent-base@6.0.2: + agent-base@6.0.2(supports-color@10.2.2): dependencies: - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -6373,25 +6536,25 @@ snapshots: asynckit@0.4.0: {} - babel-jest@29.7.0(@babel/core@7.28.5): + babel-jest@29.7.0(@babel/core@7.28.5(supports-color@10.2.2))(supports-color@10.2.2): dependencies: - '@babel/core': 7.28.5 - '@jest/transform': 29.7.0 + '@babel/core': 7.28.5(supports-color@10.2.2) + '@jest/transform': 29.7.0(supports-color@10.2.2) '@types/babel__core': 7.20.5 - babel-plugin-istanbul: 6.1.1 - babel-preset-jest: 29.6.3(@babel/core@7.28.5) + babel-plugin-istanbul: 6.1.1(supports-color@10.2.2) + babel-preset-jest: 29.6.3(@babel/core@7.28.5(supports-color@10.2.2)) chalk: 4.1.2 graceful-fs: 4.2.11 slash: 3.0.0 transitivePeerDependencies: - supports-color - babel-plugin-istanbul@6.1.1: + babel-plugin-istanbul@6.1.1(supports-color@10.2.2): dependencies: '@babel/helper-plugin-utils': 7.27.1 '@istanbuljs/load-nyc-config': 1.1.0 '@istanbuljs/schema': 0.1.3 - istanbul-lib-instrument: 5.2.1 + istanbul-lib-instrument: 5.2.1(supports-color@10.2.2) test-exclude: 6.0.0 transitivePeerDependencies: - supports-color @@ -6403,33 +6566,36 @@ snapshots: '@types/babel__core': 7.20.5 '@types/babel__traverse': 7.28.0 - babel-preset-current-node-syntax@1.2.0(@babel/core@7.28.5): - dependencies: - '@babel/core': 7.28.5 - '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.28.5) - '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.28.5) - '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.28.5) - '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.28.5) - '@babel/plugin-syntax-import-attributes': 7.27.1(@babel/core@7.28.5) - '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.28.5) - '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.28.5) - '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.28.5) - '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.28.5) - '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.28.5) - '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.28.5) - '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.28.5) - '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.28.5) - '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.28.5) - '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.28.5) - - babel-preset-jest@29.6.3(@babel/core@7.28.5): - dependencies: - '@babel/core': 7.28.5 + babel-preset-current-node-syntax@1.2.0(@babel/core@7.28.5(supports-color@10.2.2)): + dependencies: + '@babel/core': 7.28.5(supports-color@10.2.2) + '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-import-attributes': 7.27.1(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.28.5(supports-color@10.2.2)) + + babel-preset-jest@29.6.3(@babel/core@7.28.5(supports-color@10.2.2)): + dependencies: + '@babel/core': 7.28.5(supports-color@10.2.2) babel-plugin-jest-hoist: 29.6.3 - babel-preset-current-node-syntax: 1.2.0(@babel/core@7.28.5) + babel-preset-current-node-syntax: 1.2.0(@babel/core@7.28.5(supports-color@10.2.2)) balanced-match@1.0.2: {} + base64-arraybuffer@1.0.2: + optional: true + baseline-browser-mapping@2.8.31: {} basic-ftp@5.0.5: {} @@ -6513,6 +6679,18 @@ snapshots: caniuse-lite@1.0.30001757: {} + canvg@3.0.11: + dependencies: + '@babel/runtime': 7.29.13 + '@types/raf': 3.4.3 + core-js: 3.51.0 + raf: 3.4.1 + regenerator-runtime: 0.13.11 + rgbcolor: 1.0.1 + stackblur-canvas: 2.7.0 + svg-pathdata: 6.0.3 + optional: true + chai@4.5.0: dependencies: assertion-error: 1.1.0 @@ -6534,6 +6712,14 @@ snapshots: chardet@2.1.1: {} + chart.js@4.6.1: + dependencies: + '@kurkle/color': 0.3.4 + + chartjs-chart-matrix@3.1.0(chart.js@4.6.1): + dependencies: + chart.js: 4.6.1 + check-error@1.0.3: dependencies: get-func-name: 2.0.2 @@ -6762,15 +6948,18 @@ snapshots: cookie@1.1.1: {} + core-js@3.51.0: + optional: true + core-util-is@1.0.3: {} - create-jest@29.7.0(@types/node@16.18.126): + create-jest@29.7.0(@types/node@16.18.126)(supports-color@10.2.2): dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@16.18.126) + jest-config: 29.7.0(@types/node@16.18.126)(supports-color@10.2.2) jest-util: 29.7.0 prompts: 2.4.2 transitivePeerDependencies: @@ -6791,6 +6980,11 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 + css-line-break@2.1.0: + dependencies: + utrie: 1.0.2 + optional: true + css-select@5.2.2: dependencies: boolbase: 1.0.0 @@ -6806,6 +7000,8 @@ snapshots: css-what@6.2.2: {} + cssesc@3.0.0: {} + cssom@0.3.8: {} cssom@0.5.0: {} @@ -6838,9 +7034,11 @@ snapshots: de-indent@1.0.2: {} - debug@4.4.3: + debug@4.4.3(supports-color@10.2.2): dependencies: ms: 2.1.3 + optionalDependencies: + supports-color: 10.2.2 decimal.js@10.6.0: {} @@ -6907,6 +7105,11 @@ snapshots: dependencies: domelementtype: 2.3.0 + dompurify@3.4.17: + optionalDependencies: + '@types/trusted-types': 2.0.7 + optional: true + domutils@3.2.2: dependencies: dom-serializer: 2.0.0 @@ -7070,20 +7273,20 @@ snapshots: eslint-visitor-keys@3.4.3: {} - eslint@8.57.1: + eslint@8.57.1(supports-color@10.2.2): dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@8.57.1) + '@eslint-community/eslint-utils': 4.9.0(eslint@8.57.1(supports-color@10.2.2)) '@eslint-community/regexpp': 4.12.2 - '@eslint/eslintrc': 2.1.4 + '@eslint/eslintrc': 2.1.4(supports-color@10.2.2) '@eslint/js': 8.57.1 - '@humanwhocodes/config-array': 0.13.0 + '@humanwhocodes/config-array': 0.13.0(supports-color@10.2.2) '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 '@ungap/structured-clone': 1.3.0 ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.6 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -7197,6 +7400,12 @@ snapshots: fast-levenshtein@2.0.6: {} + fast-png@6.4.0: + dependencies: + '@types/pako': 2.0.4 + iobuffer: 5.4.0 + pako: 2.2.0 + fastq@1.19.1: dependencies: reusify: 1.1.0 @@ -7302,11 +7511,11 @@ snapshots: get-stream@8.0.1: {} - get-uri@6.0.5: + get-uri@6.0.5(supports-color@10.2.2): dependencies: basic-ftp: 5.0.5 data-uri-to-buffer: 6.0.2 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -7432,6 +7641,12 @@ snapshots: html-escaper@2.0.2: {} + html2canvas@1.4.1: + dependencies: + css-line-break: 2.1.0 + text-segmentation: 1.0.3 + optional: true + htmlparser2@10.0.0: dependencies: domelementtype: 2.3.0 @@ -7439,32 +7654,32 @@ snapshots: domutils: 3.2.2 entities: 6.0.1 - http-proxy-agent@5.0.0: + http-proxy-agent@5.0.0(supports-color@10.2.2): dependencies: '@tootallnate/once': 2.0.0 - agent-base: 6.0.2 - debug: 4.4.3 + agent-base: 6.0.2(supports-color@10.2.2) + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color - http-proxy-agent@7.0.2: + http-proxy-agent@7.0.2(supports-color@10.2.2): dependencies: agent-base: 7.1.4 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color - https-proxy-agent@5.0.1: + https-proxy-agent@5.0.1(supports-color@10.2.2): dependencies: - agent-base: 6.0.2 - debug: 4.4.3 + agent-base: 6.0.2(supports-color@10.2.2) + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color - https-proxy-agent@7.0.6: + https-proxy-agent@7.0.6(supports-color@10.2.2): dependencies: agent-base: 7.1.4 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -7537,6 +7752,8 @@ snapshots: optionalDependencies: '@types/node': 20.19.25 + iobuffer@5.4.0: {} + ip-address@10.1.0: {} is-arrayish@0.2.1: {} @@ -7601,9 +7818,9 @@ snapshots: istanbul-lib-coverage@3.2.2: {} - istanbul-lib-instrument@5.2.1: + istanbul-lib-instrument@5.2.1(supports-color@10.2.2): dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/parser': 7.28.5 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.2 @@ -7611,9 +7828,9 @@ snapshots: transitivePeerDependencies: - supports-color - istanbul-lib-instrument@6.0.3: + istanbul-lib-instrument@6.0.3(supports-color@10.2.2): dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/parser': 7.28.5 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.2 @@ -7627,18 +7844,18 @@ snapshots: make-dir: 4.0.0 supports-color: 7.2.0 - istanbul-lib-source-maps@4.0.1: + istanbul-lib-source-maps@4.0.1(supports-color@10.2.2): dependencies: - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: - supports-color - istanbul-lib-source-maps@5.0.6: + istanbul-lib-source-maps@5.0.6(supports-color@10.2.2): dependencies: '@jridgewell/trace-mapping': 0.3.31 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) istanbul-lib-coverage: 3.2.2 transitivePeerDependencies: - supports-color @@ -7654,10 +7871,10 @@ snapshots: jest-util: 29.7.0 p-limit: 3.1.0 - jest-circus@29.7.0: + jest-circus@29.7.0(supports-color@10.2.2): dependencies: '@jest/environment': 29.7.0 - '@jest/expect': 29.7.0 + '@jest/expect': 29.7.0(supports-color@10.2.2) '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 '@types/node': 16.18.126 @@ -7668,8 +7885,8 @@ snapshots: jest-each: 29.7.0 jest-matcher-utils: 29.7.0 jest-message-util: 29.7.0 - jest-runtime: 29.7.0 - jest-snapshot: 29.7.0 + jest-runtime: 29.7.0(supports-color@10.2.2) + jest-snapshot: 29.7.0(supports-color@10.2.2) jest-util: 29.7.0 p-limit: 3.1.0 pretty-format: 29.7.0 @@ -7680,16 +7897,16 @@ snapshots: - babel-plugin-macros - supports-color - jest-cli@29.7.0(@types/node@16.18.126): + jest-cli@29.7.0(@types/node@16.18.126)(supports-color@10.2.2): dependencies: - '@jest/core': 29.7.0 + '@jest/core': 29.7.0(supports-color@10.2.2) '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 chalk: 4.1.2 - create-jest: 29.7.0(@types/node@16.18.126) + create-jest: 29.7.0(@types/node@16.18.126)(supports-color@10.2.2) exit: 0.1.2 import-local: 3.2.0 - jest-config: 29.7.0(@types/node@16.18.126) + jest-config: 29.7.0(@types/node@16.18.126)(supports-color@10.2.2) jest-util: 29.7.0 jest-validate: 29.7.0 yargs: 17.7.2 @@ -7699,23 +7916,23 @@ snapshots: - supports-color - ts-node - jest-config@29.7.0(@types/node@16.18.126): + jest-config@29.7.0(@types/node@16.18.126)(supports-color@10.2.2): dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@jest/test-sequencer': 29.7.0 '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.28.5) + babel-jest: 29.7.0(@babel/core@7.28.5(supports-color@10.2.2))(supports-color@10.2.2) chalk: 4.1.2 ci-info: 3.9.0 deepmerge: 4.3.1 glob: 7.2.3 graceful-fs: 4.2.11 - jest-circus: 29.7.0 + jest-circus: 29.7.0(supports-color@10.2.2) jest-environment-node: 29.7.0 jest-get-type: 29.6.3 jest-regex-util: 29.6.3 jest-resolve: 29.7.0 - jest-runner: 29.7.0 + jest-runner: 29.7.0(supports-color@10.2.2) jest-util: 29.7.0 jest-validate: 29.7.0 micromatch: 4.0.8 @@ -7748,7 +7965,7 @@ snapshots: jest-util: 29.7.0 pretty-format: 29.7.0 - jest-environment-jsdom@29.7.0: + jest-environment-jsdom@29.7.0(supports-color@10.2.2): dependencies: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 @@ -7757,7 +7974,7 @@ snapshots: '@types/node': 16.18.126 jest-mock: 29.7.0 jest-util: 29.7.0 - jsdom: 20.0.3 + jsdom: 20.0.3(supports-color@10.2.2) transitivePeerDependencies: - bufferutil - supports-color @@ -7778,7 +7995,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.9 - '@types/node': 16.18.126 + '@types/node': 24.10.1 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -7826,10 +8043,10 @@ snapshots: jest-regex-util@29.6.3: {} - jest-resolve-dependencies@29.7.0: + jest-resolve-dependencies@29.7.0(supports-color@10.2.2): dependencies: jest-regex-util: 29.6.3 - jest-snapshot: 29.7.0 + jest-snapshot: 29.7.0(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -7845,12 +8062,12 @@ snapshots: resolve.exports: 2.0.3 slash: 3.0.0 - jest-runner@29.7.0: + jest-runner@29.7.0(supports-color@10.2.2): dependencies: '@jest/console': 29.7.0 '@jest/environment': 29.7.0 '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 + '@jest/transform': 29.7.0(supports-color@10.2.2) '@jest/types': 29.6.3 '@types/node': 16.18.126 chalk: 4.1.2 @@ -7862,7 +8079,7 @@ snapshots: jest-leak-detector: 29.7.0 jest-message-util: 29.7.0 jest-resolve: 29.7.0 - jest-runtime: 29.7.0 + jest-runtime: 29.7.0(supports-color@10.2.2) jest-util: 29.7.0 jest-watcher: 29.7.0 jest-worker: 29.7.0 @@ -7871,14 +8088,14 @@ snapshots: transitivePeerDependencies: - supports-color - jest-runtime@29.7.0: + jest-runtime@29.7.0(supports-color@10.2.2): dependencies: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 - '@jest/globals': 29.7.0 + '@jest/globals': 29.7.0(supports-color@10.2.2) '@jest/source-map': 29.6.3 '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 + '@jest/transform': 29.7.0(supports-color@10.2.2) '@jest/types': 29.6.3 '@types/node': 16.18.126 chalk: 4.1.2 @@ -7891,24 +8108,24 @@ snapshots: jest-mock: 29.7.0 jest-regex-util: 29.6.3 jest-resolve: 29.7.0 - jest-snapshot: 29.7.0 + jest-snapshot: 29.7.0(supports-color@10.2.2) jest-util: 29.7.0 slash: 3.0.0 strip-bom: 4.0.0 transitivePeerDependencies: - supports-color - jest-snapshot@29.7.0: + jest-snapshot@29.7.0(supports-color@10.2.2): dependencies: - '@babel/core': 7.28.5 + '@babel/core': 7.28.5(supports-color@10.2.2) '@babel/generator': 7.28.5 - '@babel/plugin-syntax-jsx': 7.27.1(@babel/core@7.28.5) - '@babel/plugin-syntax-typescript': 7.27.1(@babel/core@7.28.5) + '@babel/plugin-syntax-jsx': 7.27.1(@babel/core@7.28.5(supports-color@10.2.2)) + '@babel/plugin-syntax-typescript': 7.27.1(@babel/core@7.28.5(supports-color@10.2.2)) '@babel/types': 7.28.5 '@jest/expect-utils': 29.7.0 - '@jest/transform': 29.7.0 + '@jest/transform': 29.7.0(supports-color@10.2.2) '@jest/types': 29.6.3 - babel-preset-current-node-syntax: 1.2.0(@babel/core@7.28.5) + babel-preset-current-node-syntax: 1.2.0(@babel/core@7.28.5(supports-color@10.2.2)) chalk: 4.1.2 expect: 29.7.0 graceful-fs: 4.2.11 @@ -7926,7 +8143,7 @@ snapshots: jest-util@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 16.18.126 + '@types/node': 24.10.1 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -7954,17 +8171,17 @@ snapshots: jest-worker@29.7.0: dependencies: - '@types/node': 16.18.126 + '@types/node': 24.10.1 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - jest@29.7.0(@types/node@16.18.126): + jest@29.7.0(@types/node@16.18.126)(supports-color@10.2.2): dependencies: - '@jest/core': 29.7.0 + '@jest/core': 29.7.0(supports-color@10.2.2) '@jest/types': 29.6.3 import-local: 3.2.0 - jest-cli: 29.7.0(@types/node@16.18.126) + jest-cli: 29.7.0(@types/node@16.18.126)(supports-color@10.2.2) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -7988,7 +8205,7 @@ snapshots: dependencies: argparse: 2.0.1 - jsdom@20.0.3: + jsdom@20.0.3(supports-color@10.2.2): dependencies: abab: 2.0.6 acorn: 8.15.0 @@ -8001,8 +8218,8 @@ snapshots: escodegen: 2.1.0 form-data: 4.0.5 html-encoding-sniffer: 3.0.0 - http-proxy-agent: 5.0.0 - https-proxy-agent: 5.0.1 + http-proxy-agent: 5.0.0(supports-color@10.2.2) + https-proxy-agent: 5.0.1(supports-color@10.2.2) is-potential-custom-element-name: 1.0.1 nwsapi: 2.2.22 parse5: 7.3.0 @@ -8021,7 +8238,7 @@ snapshots: - supports-color - utf-8-validate - jsdom@23.2.0: + jsdom@23.2.0(supports-color@10.2.2): dependencies: '@asamuzakjp/dom-selector': 2.0.2 cssstyle: 4.6.0 @@ -8029,8 +8246,8 @@ snapshots: decimal.js: 10.6.0 form-data: 4.0.5 html-encoding-sniffer: 4.0.0 - http-proxy-agent: 7.0.2 - https-proxy-agent: 7.0.6 + http-proxy-agent: 7.0.2(supports-color@10.2.2) + https-proxy-agent: 7.0.6(supports-color@10.2.2) is-potential-custom-element-name: 1.0.1 parse5: 7.3.0 rrweb-cssom: 0.6.0 @@ -8067,6 +8284,17 @@ snapshots: optionalDependencies: graceful-fs: 4.2.11 + jspdf@4.2.1: + dependencies: + '@babel/runtime': 7.29.13 + fast-png: 6.4.0 + fflate: 0.8.2 + optionalDependencies: + canvg: 3.0.11 + core-js: 3.51.0 + dompurify: 3.4.17 + html2canvas: 1.4.1 + jszip@3.10.1: dependencies: lie: 3.3.0 @@ -8335,7 +8563,7 @@ snapshots: obsidian-daily-notes-interface@0.9.4(@codemirror/state@6.5.2)(@codemirror/view@6.38.8): dependencies: - obsidian: https://codeload.github.com/obsidianmd/obsidian-api/tar.gz/53cf3bd402cec654bcf1d963b43cb01d05a6efdf(@codemirror/state@6.5.2)(@codemirror/view@6.38.8) + obsidian: 1.10.3(@codemirror/state@6.5.2)(@codemirror/view@6.38.8) tslib: 2.1.0 transitivePeerDependencies: - '@codemirror/state' @@ -8348,13 +8576,6 @@ snapshots: '@types/codemirror': 5.60.8 moment: 2.29.4 - obsidian@https://codeload.github.com/obsidianmd/obsidian-api/tar.gz/53cf3bd402cec654bcf1d963b43cb01d05a6efdf(@codemirror/state@6.5.2)(@codemirror/view@6.38.8): - dependencies: - '@codemirror/state': 6.5.2 - '@codemirror/view': 6.38.8 - '@types/codemirror': 5.60.8 - moment: 2.29.4 - ohash@2.0.11: {} once@1.4.0: @@ -8428,16 +8649,16 @@ snapshots: p-try@2.2.0: {} - pac-proxy-agent@7.2.0: + pac-proxy-agent@7.2.0(supports-color@10.2.2): dependencies: '@tootallnate/quickjs-emscripten': 0.23.0 agent-base: 7.1.4 - debug: 4.4.3 - get-uri: 6.0.5 - http-proxy-agent: 7.0.2 - https-proxy-agent: 7.0.6 + debug: 4.4.3(supports-color@10.2.2) + get-uri: 6.0.5(supports-color@10.2.2) + http-proxy-agent: 7.0.2(supports-color@10.2.2) + https-proxy-agent: 7.0.6(supports-color@10.2.2) pac-resolver: 7.0.1 - socks-proxy-agent: 8.0.5 + socks-proxy-agent: 8.0.5(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -8448,6 +8669,8 @@ snapshots: pako@1.0.11: {} + pako@2.2.0: {} + parent-module@1.0.1: dependencies: callsites: 3.1.0 @@ -8513,6 +8736,9 @@ snapshots: perfect-debounce@2.0.0: {} + performance-now@2.1.0: + optional: true + picocolors@1.1.1: {} picomatch@2.3.1: {} @@ -8537,6 +8763,11 @@ snapshots: exsolve: 1.0.8 pathe: 2.0.3 + postcss-selector-parser@7.1.7: + dependencies: + cssesc: 3.0.0 + util-deprecate: 1.0.2 + postcss@8.5.6: dependencies: nanoid: 3.3.11 @@ -8560,16 +8791,16 @@ snapshots: protocols@2.0.2: {} - proxy-agent@6.5.0: + proxy-agent@6.5.0(supports-color@10.2.2): dependencies: agent-base: 7.1.4 - debug: 4.4.3 - http-proxy-agent: 7.0.2 - https-proxy-agent: 7.0.6 + debug: 4.4.3(supports-color@10.2.2) + http-proxy-agent: 7.0.2(supports-color@10.2.2) + https-proxy-agent: 7.0.6(supports-color@10.2.2) lru-cache: 7.18.3 - pac-proxy-agent: 7.2.0 + pac-proxy-agent: 7.2.0(supports-color@10.2.2) proxy-from-env: 1.1.0 - socks-proxy-agent: 8.0.5 + socks-proxy-agent: 8.0.5(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -8587,6 +8818,11 @@ snapshots: queue-microtask@1.2.3: {} + raf@3.4.1: + dependencies: + performance-now: 2.1.0 + optional: true + rc9@2.1.2: dependencies: defu: 6.1.4 @@ -8626,13 +8862,16 @@ snapshots: readdirp@4.1.2: {} + regenerator-runtime@0.13.11: + optional: true + regexp-match-indices@1.0.2: dependencies: regexp-tree: 0.1.27 regexp-tree@0.1.27: {} - release-it@19.0.6(@types/node@16.18.126)(magicast@0.3.5): + release-it@19.0.6(@types/node@16.18.126)(magicast@0.3.5)(supports-color@10.2.2): dependencies: '@nodeutils/defaults-deep': 1.1.0 '@octokit/rest': 22.0.0 @@ -8650,7 +8889,7 @@ snapshots: open: 10.2.0 ora: 9.0.0 os-name: 6.1.0 - proxy-agent: 6.5.0 + proxy-agent: 6.5.0(supports-color@10.2.2) semver: 7.7.2 tinyglobby: 0.2.15 undici: 6.21.3 @@ -8662,7 +8901,7 @@ snapshots: - magicast - supports-color - release-it@19.0.6(@types/node@20.19.25)(magicast@0.3.5): + release-it@19.0.6(@types/node@20.19.25)(magicast@0.3.5)(supports-color@10.2.2): dependencies: '@nodeutils/defaults-deep': 1.1.0 '@octokit/rest': 22.0.0 @@ -8680,7 +8919,7 @@ snapshots: open: 10.2.0 ora: 9.0.0 os-name: 6.1.0 - proxy-agent: 6.5.0 + proxy-agent: 6.5.0(supports-color@10.2.2) semver: 7.7.2 tinyglobby: 0.2.15 undici: 6.21.3 @@ -8728,6 +8967,9 @@ snapshots: reusify@1.1.0: {} + rgbcolor@1.0.1: + optional: true + rimraf@3.0.2: dependencies: glob: 7.2.3 @@ -8865,10 +9107,10 @@ snapshots: smart-buffer@4.2.0: {} - socks-proxy-agent@8.0.5: + socks-proxy-agent@8.0.5(supports-color@10.2.2): dependencies: agent-base: 7.1.4 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) socks: 2.8.7 transitivePeerDependencies: - supports-color @@ -8916,6 +9158,9 @@ snapshots: stackback@0.0.2: {} + stackblur-canvas@2.7.0: + optional: true + std-env@3.10.0: {} stdin-discarder@0.2.2: {} @@ -8982,6 +9227,9 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} + svg-pathdata@6.0.3: + optional: true + symbol-tree@3.2.4: {} temp-dir@3.0.0: {} @@ -9003,6 +9251,11 @@ snapshots: glob: 7.2.3 minimatch: 3.1.2 + text-segmentation@1.0.3: + dependencies: + utrie: 1.0.2 + optional: true + text-table@0.2.0: {} tinybench@2.9.0: {} @@ -9041,12 +9294,12 @@ snapshots: dependencies: punycode: 2.3.1 - ts-jest@29.4.5(@babel/core@7.28.5)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.28.5))(esbuild@0.25.9)(jest-util@29.7.0)(jest@29.7.0(@types/node@16.18.126))(typescript@4.7.3): + ts-jest@29.4.5(@babel/core@7.28.5(supports-color@10.2.2))(@jest/transform@29.7.0(supports-color@10.2.2))(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.28.5(supports-color@10.2.2))(supports-color@10.2.2))(esbuild@0.25.9)(jest-util@29.7.0)(jest@29.7.0(@types/node@16.18.126)(supports-color@10.2.2))(typescript@4.7.3): dependencies: bs-logger: 0.2.6 fast-json-stable-stringify: 2.1.0 handlebars: 4.7.8 - jest: 29.7.0(@types/node@16.18.126) + jest: 29.7.0(@types/node@16.18.126)(supports-color@10.2.2) json5: 2.2.3 lodash.memoize: 4.1.2 make-error: 1.3.6 @@ -9055,10 +9308,10 @@ snapshots: typescript: 4.7.3 yargs-parser: 21.1.1 optionalDependencies: - '@babel/core': 7.28.5 - '@jest/transform': 29.7.0 + '@babel/core': 7.28.5(supports-color@10.2.2) + '@jest/transform': 29.7.0(supports-color@10.2.2) '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.28.5) + babel-jest: 29.7.0(@babel/core@7.28.5(supports-color@10.2.2))(supports-color@10.2.2) esbuild: 0.25.9 jest-util: 29.7.0 @@ -9158,6 +9411,11 @@ snapshots: util-deprecate@1.0.2: {} + utrie@1.0.2: + dependencies: + base64-arraybuffer: 1.0.2 + optional: true + v8-to-istanbul@9.3.0: dependencies: '@jridgewell/trace-mapping': 0.3.31 @@ -9171,10 +9429,10 @@ snapshots: validator@13.15.23: {} - vite-node@1.6.1(@types/node@20.19.25)(terser@5.44.1): + vite-node@1.6.1(@types/node@20.19.25)(supports-color@10.2.2)(terser@5.44.1): dependencies: cac: 6.7.14 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) pathe: 1.1.2 picocolors: 1.1.1 vite: 5.4.21(@types/node@20.19.25)(terser@5.44.1) @@ -9189,12 +9447,12 @@ snapshots: - supports-color - terser - vite-plugin-dts@3.9.1(@types/node@20.19.25)(rollup@4.53.3)(typescript@5.9.3)(vite@5.4.21(@types/node@20.19.25)(terser@5.44.1)): + vite-plugin-dts@3.9.1(@types/node@20.19.25)(rollup@4.53.3)(supports-color@10.2.2)(typescript@5.9.3)(vite@5.4.21(@types/node@20.19.25)(terser@5.44.1)): dependencies: '@microsoft/api-extractor': 7.43.0(@types/node@20.19.25) '@rollup/pluginutils': 5.3.0(rollup@4.53.3) '@vue/language-core': 1.8.27(typescript@5.9.3) - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) kolorist: 1.8.0 magic-string: 0.30.21 typescript: 5.9.3 @@ -9216,7 +9474,7 @@ snapshots: fsevents: 2.3.3 terser: 5.44.1 - vitest@1.6.1(@types/node@20.19.25)(@vitest/ui@1.6.1)(jsdom@23.2.0)(terser@5.44.1): + vitest@1.6.1(@types/node@20.19.25)(@vitest/ui@1.6.1)(jsdom@23.2.0(supports-color@10.2.2))(supports-color@10.2.2)(terser@5.44.1): dependencies: '@vitest/expect': 1.6.1 '@vitest/runner': 1.6.1 @@ -9225,7 +9483,7 @@ snapshots: '@vitest/utils': 1.6.1 acorn-walk: 8.3.4 chai: 4.5.0 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) execa: 8.0.1 local-pkg: 0.5.1 magic-string: 0.30.21 @@ -9236,12 +9494,12 @@ snapshots: tinybench: 2.9.0 tinypool: 0.8.4 vite: 5.4.21(@types/node@20.19.25)(terser@5.44.1) - vite-node: 1.6.1(@types/node@20.19.25)(terser@5.44.1) + vite-node: 1.6.1(@types/node@20.19.25)(supports-color@10.2.2)(terser@5.44.1) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 20.19.25 '@vitest/ui': 1.6.1(vitest@1.6.1) - jsdom: 23.2.0 + jsdom: 23.2.0(supports-color@10.2.2) transitivePeerDependencies: - less - lightningcss @@ -9263,7 +9521,7 @@ snapshots: vue-tsc@1.8.27(typescript@5.9.3): dependencies: - '@volar/typescript': 1.11.1 + '@volar/typescript': 1.11.1(typescript@5.9.3) '@vue/language-core': 1.8.27(typescript@5.9.3) semver: 7.7.3 typescript: 5.9.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 082815b94..07337c94f 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -3,3 +3,7 @@ packages: onlyBuiltDependencies: - esbuild + +overrides: + 'obsidian-daily-notes-interface>obsidian': '1.10.3' + dompurify: '^3.4.16' diff --git a/scripts/check-habits-i18n.cjs b/scripts/check-habits-i18n.cjs new file mode 100644 index 000000000..2e2a91010 --- /dev/null +++ b/scripts/check-habits-i18n.cjs @@ -0,0 +1,40 @@ +const fs = require('node:fs'); +const path = require('node:path'); +const ts = require('typescript'); +const base = 'src/integrations/habits'; +const sources = []; +function discover(dir) { + for (const name of fs.readdirSync(dir)) { + const file = path.join(dir, name); + if (fs.statSync(file).isDirectory()) { if (name !== 'i18n') discover(file); } + else if (name.endsWith('.ts')) sources.push(file); + } +} +discover(base); +sources.push('src/components/features/habit/habit.ts', 'src/components/features/settings/tabs/HabitSettingsTab.ts'); +const keys = new Set(); +for (const file of sources) { + const tree = ts.createSourceFile(file, fs.readFileSync(file, 'utf8'), ts.ScriptTarget.Latest, true); + const visitCall = node => { + if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && (path.resolve(file).startsWith(path.resolve(base)) ? ['t', 'ht'] : ['ht']).includes(node.expression.text) + && node.arguments[0] && ts.isStringLiteralLike(node.arguments[0])) keys.add(node.arguments[0].text); + ts.forEachChild(node, visitCall); + }; + visitCall(tree); +} +const tree = ts.createSourceFile('zh.ts', fs.readFileSync(`${base}/i18n/zh.ts`, 'utf8'), ts.ScriptTarget.Latest, true); +const dictionary = new Map(); +const visitProperty = node => { + if (ts.isPropertyAssignment(node) && (ts.isStringLiteralLike(node.name) || ts.isIdentifier(node.name)) && ts.isStringLiteralLike(node.initializer)) { + dictionary.set(node.name.text, node.initializer.text); + } + ts.forEachChild(node, visitProperty); +}; +visitProperty(tree); +const missing = [...keys].filter(key => !dictionary.has(key)); +const placeholders = text => [...text.matchAll(/\{\w+\}/g)].map(match => match[0]).sort().join(','); +const invalid = [...keys].filter(key => dictionary.has(key) && placeholders(key) !== placeholders(dictionary.get(key))); +if (missing.length || invalid.length) { + console.error(JSON.stringify({missing, invalid}, null, 2)); + process.exitCode = 1; +} else console.log(`Habits: ${keys.size} English/Chinese strings and placeholders verified.`); diff --git a/scripts/scope-habits-css.mjs b/scripts/scope-habits-css.mjs new file mode 100644 index 000000000..11eed1128 --- /dev/null +++ b/scripts/scope-habits-css.mjs @@ -0,0 +1,23 @@ +import fs from 'node:fs'; +import postcss from 'postcss'; +import selectorParser from 'postcss-selector-parser'; + +const directory = 'src/integrations/habits/'; +const root = postcss.parse(fs.readFileSync(directory + 'upstream.css', 'utf8')); +root.walkRules(rule => { + let parent = rule.parent; + while (parent) { + if (parent.type === 'atrule' && /keyframes$/i.test(parent.name)) return; + parent = parent.parent; + } + rule.selector = selectorParser(selectors => { + selectors.each(selector => { + const scope = selectorParser().astSync(':where(.tg-habits-surface, .tg-habits-surface *)').first.first.clone(); + // Scope the subject of the selector, before pseudo-elements. + const pseudo = selector.nodes.find(node => node.type === 'pseudo' && node.value.startsWith('::')); + if (pseudo) selector.insertBefore(pseudo, scope); + else selector.append(scope); + }); + }).processSync(rule.selector); +}); +fs.writeFileSync(directory + 'scoped.css', '/* Generated by scripts/scope-habits-css.mjs; upstream MIT licensed. */\n' + root.toString()); diff --git a/src/common/setting-definition.ts b/src/common/setting-definition.ts index bfeb673bc..71ce584f6 100644 --- a/src/common/setting-definition.ts +++ b/src/common/setting-definition.ts @@ -931,6 +931,7 @@ export interface TaskProgressBarSettings { // Habit Settings habit: HabitSettings; + habitsIntegration?: Partial; // Filter Configuration Settings filterConfig: FilterConfigSettings; diff --git a/src/components/features/habit/habit.ts b/src/components/features/habit/habit.ts index f13cda011..c9ef892e1 100644 --- a/src/components/features/habit/habit.ts +++ b/src/components/features/habit/habit.ts @@ -1,3 +1,8 @@ +import { importLegacyHabits, planLegacyHabits } from "@/integrations/habits/legacy-import"; +import { ConfirmModal } from "@/integrations/habits/ui/confirm-modal"; +import { HabitsBlock } from "@/integrations/habits/ui/habits-block"; +import { HabitModal } from "@/integrations/habits/ui/habit-modal"; +import { t as ht } from "@/integrations/habits/i18n"; import { t as settingsText } from "@/translations/helper"; import { Component, @@ -27,6 +32,50 @@ import "@/styles/habit.css"; import { HabitEditDialog } from "@/components/features/habit/components/HabitEditDialog"; export class Habit extends Component { + containerEl: HTMLElement; + private disposed = false; + constructor(readonly plugin: TaskProgressBarPlugin, parentEl: HTMLElement) { + super(); + this.containerEl = parentEl.createDiv({cls: "tg-habit-component-container tg-habits-surface"}); + } + async onload(): Promise { + try { + const integration = await this.plugin.ensureHabitsIntegration(); + if (this.disposed) return; + const toolbar = this.containerEl.createDiv({cls: "tg-habits-toolbar"}); + toolbar.createEl("h2", {text: ht("Habits")}); + new ButtonComponent(toolbar).setButtonText(ht("Create habit")).setCta().onClick(() => { + new HabitModal(this.plugin.app, integration.store, () => {}, null, integration.settings.experimental.noteHabits).open(); + }); + integration.showCompatibilityNotice(this.containerEl); + const root = this.containerEl.createDiv(); + this.addChild(new HabitsBlock(this.plugin.app, integration.store, () => integration.settings, integration.events, "", root)); + if (this.plugin.settings.habit.habits?.length) { + const legacy = this.containerEl.createEl("details", {cls: "tg-habits-legacy"}); + legacy.createEl("summary", {text: ht("Existing Task Genius habits")}); + legacy.createEl("p", {text: ht("Original daily-note records remain available below. Import creates habit notes with a complete source snapshot and never changes the original records.")}); + new ButtonComponent(legacy).setButtonText(ht("Import existing records")).onClick(async () => { + const plans = planLegacyHabits(this.plugin.habitManager?.habits ?? []); + if (!plans.length) { new Notice(ht("No records available to import.")); return; } + const confirmed = await ConfirmModal.ask(this.plugin.app, ht("Import existing records"), ht("Create {n} habit notes in {folder}? Existing notes and daily records will be preserved.", {n: plans.length, folder: integration.settings.habitsFolder})); + if (!confirmed) return; + try { + const result = await importLegacyHabits(this.plugin.app, integration.settings, plans); + new Notice(ht("Imported {created} habits; skipped {skipped} existing imports.", result)); + integration.events.trigger("settings-changed"); + } catch (error) { console.error(error); new Notice(ht("Habit import failed. Existing files have been preserved.")); } + }); + this.addChild(new LegacyHabit(this.plugin, legacy)); + } + } catch (error) { + if (!this.disposed) this.containerEl.createEl("p", {text: ht("Unable to load habits. Check the console for details.")}); + console.error("Task Genius habits", error); + } + } + onunload(): void { this.disposed = true; this.containerEl.empty(); } +} + +class LegacyHabit extends Component { plugin: TaskProgressBarPlugin; containerEl: HTMLElement; // The element where the view will be rendered diff --git a/src/components/features/settings/tabs/HabitSettingsTab.ts b/src/components/features/settings/tabs/HabitSettingsTab.ts index 107997983..082dd15aa 100644 --- a/src/components/features/settings/tabs/HabitSettingsTab.ts +++ b/src/components/features/settings/tabs/HabitSettingsTab.ts @@ -1,3 +1,4 @@ +import { t as ht } from "@/integrations/habits/i18n"; import { Setting } from "obsidian"; import { TaskProgressBarSettingTab } from "@/setting"; import { t } from "@/translations/helper"; @@ -22,6 +23,10 @@ export function renderHabitSettingsTab( .onChange(async (value) => { settingTab.plugin.settings.habit.enableHabits = value; settingTab.applySettingsUpdate(); + if (value) { + const integration = await settingTab.plugin.ensureHabitsIntegration(); + integration.events.trigger("settings-changed"); + } }); }); @@ -29,8 +34,20 @@ export function renderHabitSettingsTab( cls: "habit-settings-container", }); - // Habit List - displayHabitList(settingTab, habitContainer); + // Keep the settings navigation and layout owned by Task Genius. + void settingTab.plugin.ensureHabitsIntegration().then(integration => { + if (!habitContainer.isConnected) return; + integration.showCompatibilityNotice(habitContainer); + integration.renderSettings(habitContainer.createDiv()); + if (settingTab.plugin.settings.habit.habits?.length) { + const legacy = habitContainer.createEl("details", {cls: "tg-habits-legacy"}); + legacy.createEl("summary", {text: ht("Existing Task Genius habits")}); + displayHabitList(settingTab, legacy); + } + }).catch(error => { + habitContainer.createEl("p", {text: ht("Unable to load habits. Check the console for details.")}); + console.error("Task Genius habit settings", error); + }); } function displayHabitList( diff --git a/src/index.ts b/src/index.ts index 5eeba7f04..0517e9a8d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ +import { TaskGeniusHabits } from "./integrations/habits/task-genius-host"; import { addIcon, Editor, @@ -156,6 +157,25 @@ export default class TaskProgressBarPlugin extends Plugin { rewardManager: RewardManager; habitManager: HabitManager; + habitsIntegration?: TaskGeniusHabits; + async ensureHabitsIntegration(): Promise { + if (this.settings.habit.enableHabits && !this.habitManager) { + this.habitManager = this.addChild(new HabitManager(this)); + } + if (!this.habitsIntegration) { + this.habitsIntegration = new TaskGeniusHabits(this); + this.addChild(this.habitsIntegration); + } + const integration = this.habitsIntegration; + try { await integration.ready; return integration; } + catch (error) { + if (this.habitsIntegration === integration) { + this.removeChild(integration); + this.habitsIntegration = undefined; + } + throw error; + } + } // Task timer manager and exporter taskTimerManager: TaskTimerManager; @@ -405,8 +425,7 @@ export default class TaskProgressBarPlugin extends Plugin { }); if (this.settings.habit.enableHabits) { - this.habitManager = new HabitManager(this); - this.addChild(this.habitManager); + await this.ensureHabitsIntegration(); } // Initialize ICS manager if sources are configured diff --git a/src/integrations/habits/LICENSE b/src/integrations/habits/LICENSE new file mode 100644 index 000000000..e3808aeab --- /dev/null +++ b/src/integrations/habits/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 James Clifford Spratt + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/integrations/habits/UPSTREAM.md b/src/integrations/habits/UPSTREAM.md new file mode 100644 index 000000000..23e4f00ac --- /dev/null +++ b/src/integrations/habits/UPSTREAM.md @@ -0,0 +1,9 @@ +# Habits integration + +Ported from [JamesCliffordSpratt/obsidian-habits](https://github.com/JamesCliffordSpratt/obsidian-habits), version 1.12.1, commit `38c44bc4d329455701045ca0858109b5a1708c56`. + +Copyright (c) 2025 James Clifford Spratt. The vendored implementation is MIT licensed; see LICENSE in this directory. Task Genius's existing license is unchanged. The MIT notice is also included in distributed JavaScript. + +Task Genius changes: host settings adapter, namespaced views/commands/code blocks, embedded dashboard/settings, scoped theme styling, legacy-record compatibility, configurable data location, optional completion-based intervals, and integration regression tests. No source from zm4341/taskgenius-plugin is used. + +`upstream.css` is preserved as input; regenerate `scoped.css` with `node scripts/scope-habits-css.mjs` when changing upstream styling. diff --git a/src/integrations/habits/ai-summary.ts b/src/integrations/habits/ai-summary.ts new file mode 100644 index 000000000..5f3041007 --- /dev/null +++ b/src/integrations/habits/ai-summary.ts @@ -0,0 +1,275 @@ +import { moment, requestUrl } from "obsidian"; +import type { AiSummarySettings } from "./settings"; +import type { HabitDefinition } from "./types"; +import { + getStatsRange, + habitStats, + perfectDays, + rangeLength, + trackingStartKey, + type DateRange, + type StatsPeriod, + type StatsRangeMode, +} from "./stats"; +import { formatValue, toDateKey } from "./utils"; + +/** + * Most habits ever included in a digest. Keeps the prompt (and its cost) + * bounded for users tracking an unusually large number of habits. + */ +const MAX_HABITS = 40; + +/** Most cached summaries kept in memory before the oldest are dropped. */ +const CACHE_LIMIT = 20; + +/** + * Completed summaries keyed by everything that influenced them (model, + * period, mode and the digest itself). Because the digest is built from the + * logged records, any change to the underlying data produces a new key — + * so a cached summary is never stale, and switching tabs back and forth + * never repeats an API call. + */ +const cache = new Map(); + +function cacheKey( + settings: AiSummarySettings, + period: StatsPeriod, + mode: StatsRangeMode, + digest: string, +): string { + return `${settings.model}|${period}|${mode}|${digest}`; +} + +/** A cached summary for this exact data, or null when none exists yet. */ +export function getCachedSummary( + settings: AiSummarySettings, + period: StatsPeriod, + mode: StatsRangeMode, + digest: string, +): string | null { + return cache.get(cacheKey(settings, period, mode, digest)) ?? null; +} + +/** + * Build a compact plain-text digest of the stats the user is looking at. + * This is the only data ever sent to the AI service — habit names and + * aggregate numbers, never per-day records or comments. + */ +export function buildStatsDigest( + habits: HabitDefinition[], + period: StatsPeriod, + mode: StatsRangeMode, + today: Date, + /** The user-picked range; only used when `period` is `custom`. */ + customRange?: DateRange, +): string { + const range = getStatsRange(today, period, mode, customRange); + const length = rangeLength(range); + const all = habits.map((habit) => habitStats(habit, range, today)); + + const totalDays = all.reduce((sum, s) => sum + s.days, 0); + const totalCompleted = all.reduce((sum, s) => sum + s.completed, 0); + const overallRate = + totalDays > 0 ? Math.round((totalCompleted / totalDays) * 100) : 0; + const perfect = perfectDays(habits, range, today); + + const periodLine = + period === "custom" + ? `Period: custom date range of ${length} days, ${toDateKey(range.start)} to ${toDateKey(range.end)}.` + : `Period: ${period === "weekly" ? "week" : "month"} (${ + mode === "rolling" + ? `rolling last ${length} days` + : "calendar" + }), ${toDateKey(range.start)} to ${toDateKey(range.end)}.`; + const lines: string[] = [ + periodLine, + `Overall completion: ${overallRate}%. Perfect days (every habit done): ${perfect}.`, + `Habits (${habits.length}):`, + ]; + + habits.slice(0, MAX_HABITS).forEach((habit, i) => { + const s = all[i]; + const parts: string[] = []; + if (habit.goalDirection === "max") { + parts.push( + habit.type === "binary" + ? "avoiding entirely" + : `limit of ${formatValue(habit.target)}${habit.unit ? ` ${habit.unit}` : ""} per day`, + ); + parts.push(`${s.completed}/${s.days} days within limit`); + if (habit.type !== "binary") { + parts.push( + `${formatValue(s.total)}${habit.unit ? ` ${habit.unit}` : ""} consumed in period`, + ); + } + } else { + const period = + habit.frequency === "flexibleWeekly" + ? "per week, any day" + : habit.frequency === "flexibleMonthly" + ? "per month, any day" + : "per day"; + if (habit.type === "repetition") { + parts.push( + `target ${formatValue(habit.target)}${habit.unit ? ` ${habit.unit}` : ""} ${period}`, + ); + } else if (habit.type === "timed") { + parts.push(`target ${habit.target} min ${period}`); + } else if (habit.frequency === "flexibleWeekly") { + parts.push(`target ${habit.target}x per week, any day`); + } else if (habit.frequency === "flexibleMonthly") { + parts.push(`target ${habit.target}x per month, any day`); + } + parts.push(`${s.completed}/${s.days} due days completed`); + if (habit.type !== "binary") { + parts.push( + `${formatValue(s.total)}${habit.unit ? ` ${habit.unit}` : habit.type === "timed" ? " min" : ""} total`, + ); + } + } + if (habit.frequency === "interval") { + parts.push(`due every ${habit.intervalDays} days`); + } else if ( + habit.frequency === "flexibleWeekly" || + habit.frequency === "flexibleMonthly" + ) { + // Already covered by the target line above. + } else if (habit.frequency !== "daily") { + parts.push(`due ${habit.frequency}`); + } + if (habit.times.length > 0) { + parts.push(`planned at ${habit.times.join(", ")}`); + } + parts.push(`${Math.round(s.rate * 100)}% rate`); + parts.push(`current streak ${s.current}, best ${s.best}`); + // Weekly/monthly goals don't apply to an arbitrary custom range. + if (period !== "custom") { + const goal = + period === "weekly" + ? habit.weeklyTarget + : habit.monthlyTarget; + const isPerfect = + period === "weekly" + ? habit.weeklyPerfect + : habit.monthlyPerfect; + if (isPerfect) { + parts.push(`aiming for a perfect ${period.replace("ly", "")}`); + } else if (goal > 0) { + parts.push(`${period} goal ${s.completed}/${goal} days`); + } + } + if (habit.paused) { + parts.push("currently paused"); + } + const startKey = trackingStartKey(habit, today); + if (startKey > toDateKey(range.start)) { + // Partially tracked period: stats above already exclude earlier + // days, but the model should know the window is shorter. + parts.push(`only tracked since ${startKey}`); + } + lines.push(`- ${habit.name}: ${parts.join(", ")}`); + }); + if (habits.length > MAX_HABITS) { + lines.push(`(and ${habits.length - MAX_HABITS} more habits omitted)`); + } + return lines.join("\n"); +} + +function systemPrompt(period: StatsPeriod): string { + const periodLabel = + period === "weekly" + ? "current week" + : period === "monthly" + ? "current month" + : "date range they selected"; + return [ + "You are a supportive, practical habit coach inside a habit-tracking app.", + `You are given a user's habit statistics for the ${periodLabel}.`, + "Write a short summary of 4 to 6 sentences in plain prose — no markdown, no headings, no bullet points.", + "Briefly acknowledge what is going well, point out the habit or two that most needs attention, and give one or two specific, actionable suggestions for improvement.", + "Habits marked as limits are ones the user wants to stay under, so low totals there are good.", + "Be encouraging but honest; never invent numbers that are not in the data.", + `Respond in the language with locale code "${moment.locale()}".`, + ].join(" "); +} + +/** + * Request a summary from the configured OpenAI-compatible endpoint. + * Results are cached (see {@link getCachedSummary}); the API key is sent + * only as an Authorization header and may be blank for local endpoints + * such as Ollama or LM Studio. + */ +export async function generateSummary( + settings: AiSummarySettings, + period: StatsPeriod, + mode: StatsRangeMode, + digest: string, + /** Skip the cache and request a fresh summary (the Regenerate button). */ + force = false, +): Promise { + const key = cacheKey(settings, period, mode, digest); + const cached = cache.get(key); + if (cached && !force) { + return cached; + } + + const base = settings.baseUrl.trim().replace(/\/+$/, ""); + const headers: Record = { + "Content-Type": "application/json", + }; + if (settings.apiKey.trim() !== "") { + headers.Authorization = `Bearer ${settings.apiKey.trim()}`; + } + const response = await requestUrl({ + url: `${base}/chat/completions`, + method: "POST", + headers, + body: JSON.stringify({ + model: settings.model, + messages: [ + { role: "system", content: systemPrompt(period) }, + { role: "user", content: digest }, + ], + // Generous cap: on reasoning models (e.g. Gemini 2.5) internal + // "thinking" tokens count against this limit, so a tight cap + // truncates the visible summary mid-sentence. The prompt already + // keeps the actual reply short. + max_tokens: 4000, + temperature: 0.7, + }), + throw: false, + }); + + if (response.status >= 400) { + let detail = `HTTP ${response.status}`; + try { + const err = ( + response.json as { error?: { message?: string } } | null + )?.error?.message; + if (err) { + detail = err; + } + } catch { + // Non-JSON error body; keep the status code. + } + throw new Error(detail); + } + + const text = ( + response.json as { + choices?: { message?: { content?: string } }[]; + } | null + )?.choices?.[0]?.message?.content?.trim(); + if (!text) { + throw new Error("The AI service returned an empty response."); + } + + if (cache.size >= CACHE_LIMIT) { + const oldest = cache.keys().next().value; + if (oldest !== undefined) { + cache.delete(oldest); + } + } + cache.set(key, text); + return text; +} diff --git a/src/integrations/habits/comment-log.ts b/src/integrations/habits/comment-log.ts new file mode 100644 index 000000000..9180ce9e1 --- /dev/null +++ b/src/integrations/habits/comment-log.ts @@ -0,0 +1,157 @@ +/** + * Day comments stored as a list in the note body. + * + * Frontmatter cannot carry tags or links that Obsidian will index — it + * only reads tags from the `tags` property and from the body — so the + * comments live in a marked-off section of the note instead: + * + * ```markdown + * %%habits-log%% + * - **2026-08-05** — Ran 5k #fitness with [[Marathon Plan]] + * - **2026-08-04** — Rest day #recovery + * %%/habits-log%% + * ``` + * + * The markers are Obsidian comments, so they vanish in reading view + * while the list itself renders, stays editable by hand, and is indexed + * like any other note content. + */ + +/** Opening marker for the managed section. */ +export const LOG_START = "%%habits-log%%"; +/** Closing marker for the managed section. */ +export const LOG_END = "%%/habits-log%%"; + +/** + * One log entry. + * + * Parsing is deliberately forgiving so an entry the user has reformatted + * by hand still round-trips: the bullet may be `-` or `*`, the date may + * be bold and/or a `[[wiki link]]`, and the separator may be any dash or + * a colon. Writing always uses the canonical form. + */ +const ENTRY_RE = + /^[ \t]*[-*][ \t]+(?:\*\*)?(?:\[\[)?(\d{4}-\d{2}-\d{2})(?:\]\])?(?:\*\*)?[ \t]*(?:[—–:-][ \t]*)?(.*)$/; + +/** Canonical rendering of a single entry, including any extra lines. */ +function formatEntry(dateKey: string, text: string): string { + const [first = "", ...rest] = text.split("\n"); + // Continuation lines are indented so Markdown keeps them in the item. + const tail = rest.map((line) => ` ${line}`); + return [`- **${dateKey}** — ${first}`, ...tail].join("\n"); +} + +/** Locate the managed section, if the note has one. */ +function findSection( + lines: string[], +): { start: number; end: number } | null { + const start = lines.findIndex((line) => line.trim() === LOG_START); + if (start === -1) { + return null; + } + const end = lines.findIndex( + (line, index) => index > start && line.trim() === LOG_END, + ); + return end === -1 ? null : { start, end }; +} + +/** Read the day comments out of a note's raw contents. */ +export function parseCommentLog(content: string): Record { + const lines = content.split("\n"); + const section = findSection(lines); + if (!section) { + return {}; + } + + const comments: Record = {}; + let current: string | null = null; + for (let i = section.start + 1; i < section.end; i++) { + const line = lines[i]; + const match = ENTRY_RE.exec(line); + if (match) { + current = match[1]; + comments[current] = match[2].trim(); + continue; + } + // An indented line continues the entry above it; anything else + // (including a blank line) ends it. + if (current && /^[ \t]+\S/.test(line)) { + comments[current] = `${comments[current]}\n${line.trim()}`.trim(); + continue; + } + current = null; + } + + // Entries left empty by a hand edit are treated as absent. + for (const [key, value] of Object.entries(comments)) { + if (value === "") { + delete comments[key]; + } + } + return comments; +} + +/** True when the note already carries a managed section. */ +export function hasCommentLog(content: string): boolean { + return findSection(content.split("\n")) !== null; +} + +/** + * Return `content` with its managed section replaced by `comments`, + * newest day first. An empty map removes the section entirely. + * + * If the note opens a frontmatter block that is never closed the content + * is returned untouched, rather than risk appending inside it. + */ +export function applyCommentLog( + content: string, + comments: Record, +): string { + const lines = content.split("\n"); + const section = findSection(lines); + + const entries = Object.keys(comments) + .filter((key) => comments[key].trim() !== "") + .sort((a, b) => b.localeCompare(a)) + .map((key) => formatEntry(key, comments[key].trim())); + + if (section) { + if (entries.length === 0) { + // Drop the section and the blank line that padded it. + const before = lines.slice(0, section.start); + const after = lines.slice(section.end + 1); + while (before.length > 0 && before[before.length - 1] === "") { + before.pop(); + } + while (after.length > 0 && after[0] === "") { + after.shift(); + } + const body = [...before, ...(after.length > 0 ? [""] : []), ...after]; + return `${body.join("\n").replace(/\n+$/, "")}\n`; + } + return [ + ...lines.slice(0, section.start + 1), + ...entries, + ...lines.slice(section.end), + ].join("\n"); + } + + if (entries.length === 0) { + return content; + } + if (!frontmatterIsClosed(lines)) { + return content; + } + + const body = content.replace(/\s+$/, ""); + const block = [LOG_START, ...entries, LOG_END].join("\n"); + return body === "" ? `${block}\n` : `${body}\n\n${block}\n`; +} + +/** False only when the note starts a `---` block it never closes. */ +function frontmatterIsClosed(lines: string[]): boolean { + if (lines[0]?.trim() !== "---") { + return true; + } + return lines.slice(1).some((line) => line.trim() === "---"); +} diff --git a/src/integrations/habits/comment-text.ts b/src/integrations/habits/comment-text.ts new file mode 100644 index 000000000..abc6bfd4d --- /dev/null +++ b/src/integrations/habits/comment-text.ts @@ -0,0 +1,204 @@ +import { App, Component } from "obsidian"; + +/** + * Parsing and rendering for the rich bits of a day comment: Obsidian + * tags (`#tag`) and internal links (`[[Note]]` / `[[Note|alias]]`). + * + * Comments live inside frontmatter, so they are stored as plain strings + * and only interpreted when we render them on a card. + */ + +/** One piece of a parsed comment. */ +export type CommentToken = + | { kind: "text"; text: string } + | { kind: "tag"; text: string; tag: string } + | { kind: "link"; text: string; target: string; alias: string }; + +/** + * Matches a tag or a wiki link. + * + * Tags follow Obsidian's rules: they start with `#`, must contain at + * least one non-numeric character, and may nest with `/`. A tag only + * counts when it is not glued to the end of a preceding word, which the + * caller checks via the character before the match. + */ +const TOKEN_RE = /\[\[([^\][|]+)(?:\|([^\][]*))?\]\]|#([\w/\-_À-￿]+)/gu; + +/** True when `raw` (without `#`) is a usable Obsidian tag. */ +function isTagBody(raw: string): boolean { + // Purely numeric tags are not valid in Obsidian, and a trailing or + // leading slash makes for an empty nesting level. + if (raw === "" || /^[\d/]+$/.test(raw)) { + return false; + } + return !raw.startsWith("/") && !raw.endsWith("/"); +} + +/** Split comment text into plain runs, tags and links. */ +export function parseComment(text: string): CommentToken[] { + const tokens: CommentToken[] = []; + let last = 0; + TOKEN_RE.lastIndex = 0; + + const pushText = (upto: number): void => { + if (upto > last) { + tokens.push({ kind: "text", text: text.slice(last, upto) }); + } + }; + + let match: RegExpExecArray | null; + while ((match = TOKEN_RE.exec(text)) !== null) { + const [whole, linkTarget, linkAlias, tagBody] = match; + if (tagBody !== undefined) { + const before = match.index > 0 ? text[match.index - 1] : " "; + if (!/\s|^$/.test(before) || !isTagBody(tagBody)) { + continue; + } + pushText(match.index); + tokens.push({ kind: "tag", text: whole, tag: tagBody }); + } else { + const target = linkTarget.trim(); + if (target === "") { + continue; + } + pushText(match.index); + tokens.push({ + kind: "link", + text: whole, + target, + alias: (linkAlias ?? "").trim() || target, + }); + } + last = match.index + whole.length; + } + pushText(text.length); + return tokens; +} + +/** Every distinct tag (without the leading `#`) used in a comment. */ +export function tagsInComment(text: string): string[] { + const seen = new Set(); + for (const token of parseComment(text)) { + if (token.kind === "tag") { + seen.add(token.tag); + } + } + return [...seen]; +} + +/** Every distinct tag used across a whole `comments` map. */ +export function tagsInComments(comments: Record): Set { + const all = new Set(); + for (const text of Object.values(comments)) { + for (const tag of tagsInComment(text)) { + all.add(tag); + } + } + return all; +} + +/** True when the comment holds at least one tag or link. */ +export function hasRichTokens(text: string): boolean { + return parseComment(text).some((token) => token.kind !== "text"); +} + +/** Options for {@link renderComment}. */ +export interface RenderCommentOptions { + /** Note path the links are resolved relative to. */ + sourcePath: string; + /** Component the hover-preview listeners are tied to. */ + component: Component; +} + +/** + * Render a comment into `el` with clickable tag chips and internal + * links. Links open the target note and support Obsidian's hover + * preview; tags open the search pane filtered to that tag. + */ +export function renderComment( + app: App, + el: HTMLElement, + text: string, + options: RenderCommentOptions, +): void { + el.empty(); + for (const token of parseComment(text)) { + if (token.kind === "text") { + el.appendText(token.text); + continue; + } + + if (token.kind === "tag") { + const chip = el.createEl("a", { + cls: "habits-comment-tag", + text: `#${token.tag}`, + href: `#${token.tag}`, + }); + chip.addEventListener("click", (event) => { + event.preventDefault(); + event.stopPropagation(); + openTagSearch(app, token.tag); + }); + continue; + } + + const link = el.createEl("a", { + cls: "habits-comment-link internal-link", + text: token.alias, + href: token.target, + }); + link.dataset.href = token.target; + const resolved = app.metadataCache.getFirstLinkpathDest( + token.target, + options.sourcePath, + ); + if (!resolved) { + link.addClass("is-unresolved"); + } + link.addEventListener("click", (event) => { + event.preventDefault(); + event.stopPropagation(); + void app.workspace.openLinkText( + token.target, + options.sourcePath, + event.ctrlKey || event.metaKey, + ); + }); + options.component.registerDomEvent(link, "mouseover", (event) => { + (app.workspace as unknown as {trigger(name: string, event: unknown): void}).trigger("hover-link", { + event, + source: "tg-habits", + hoverParent: options.component, + targetEl: link, + linktext: token.target, + sourcePath: options.sourcePath, + }); + }); + } +} + +/** Open the search pane filtered to a tag, mirroring the tag pane. */ +function openTagSearch(app: App, tag: string): void { + const search = app.workspace.getLeavesOfType("search")[0]; + const query = `tag:#${tag}`; + if (search) { + const view = search.view as unknown as { + setQuery?: (value: string) => void; + }; + if (typeof view.setQuery === "function") { + void app.workspace.revealLeaf(search); + view.setQuery(query); + return; + } + } + const globalSearch = ( + app as unknown as { + internalPlugins?: { + getPluginById?: (id: string) => { + instance?: { openGlobalSearch?: (q: string) => void }; + } | null; + }; + } + ).internalPlugins?.getPluginById?.("global-search"); + globalSearch?.instance?.openGlobalSearch?.(query); +} diff --git a/src/integrations/habits/compat.d.ts b/src/integrations/habits/compat.d.ts new file mode 100644 index 000000000..a69cf2c03 --- /dev/null +++ b/src/integrations/habits/compat.d.ts @@ -0,0 +1,4 @@ +/** Modern optional DOM API; callers keep their runtime feature checks. */ +interface HTMLInputElement { + showPicker?: () => void; +} diff --git a/src/integrations/habits/habit-store.ts b/src/integrations/habits/habit-store.ts new file mode 100644 index 000000000..700ee1cb1 --- /dev/null +++ b/src/integrations/habits/habit-store.ts @@ -0,0 +1,1433 @@ +import { App, normalizePath, Notice, TFile, TFolder } from "obsidian"; +import { + DEFAULT_FRONTMATTER_KEYS, + type FrontmatterKeys, + type HabitsPluginSettings, +} from "./settings"; +import type { + GroupStyle, + HabitDefinition, + HabitFrequency, + HabitPause, + HabitReschedule, + HabitType, + NewHabitOptions, + NoteChecklistRequirement, + NoteCompletionMode, +} from "./types"; +import { + addDays, + isFlexibleFrequency, + roundValue, + sanitizeFileName, + toDateKey, +} from "./utils"; +import { tagsInComments } from "./comment-text"; +import { applyCommentLog, parseCommentLog } from "./comment-log"; +import { t } from "./i18n"; +import { DEFAULT_NOTE_FILENAME_FORMAT } from "./note-habit"; + +const HABIT_TYPES: readonly HabitType[] = [ + "binary", + "repetition", + "timed", + "note", +]; +const HABIT_FREQUENCIES: readonly HabitFrequency[] = [ + "daily", + "weekly", + "monthly", + "interval", + "flexibleWeekly", + "flexibleMonthly", +]; +const NOTE_COMPLETION_MODES: readonly NoteCompletionMode[] = [ + "chars", + "checklist", + "both", +]; +const NOTE_CHECKLIST_REQUIREMENTS: readonly NoteChecklistRequirement[] = [ + "all", + "count", +]; + +function isHabitType(value: unknown): value is HabitType { + return ( + typeof value === "string" && + (HABIT_TYPES as readonly string[]).includes(value) + ); +} + +function isNoteCompletionMode(value: unknown): value is NoteCompletionMode { + return ( + typeof value === "string" && + (NOTE_COMPLETION_MODES as readonly string[]).includes(value) + ); +} + +function isNoteChecklistRequirement( + value: unknown, +): value is NoteChecklistRequirement { + return ( + typeof value === "string" && + (NOTE_CHECKLIST_REQUIREMENTS as readonly string[]).includes(value) + ); +} + +function isHabitFrequency(value: unknown): value is HabitFrequency { + return ( + typeof value === "string" && + (HABIT_FREQUENCIES as readonly string[]).includes(value) + ); +} + +/** Shallow equality for a day-keyed comment map. */ +function sameComments( + a: Record, + b: Record, +): boolean { + const keys = Object.keys(a); + return ( + keys.length === Object.keys(b).length && + keys.every((key) => a[key] === b[key]) + ); +} + +/** + * Reads and writes habit notes in the configured folder. + * + * Each habit is a single note whose frontmatter defines it and whose `records` + * map stores the value logged for each day. + */ +export class HabitStore { + /** + * Day comments read from each note's body, keyed by note path. + * + * The body can only be read asynchronously, but `getHabits` is + * synchronous and called on every render, so the text is cached here + * and refreshed whenever a habit note changes on disk. + */ + private commentCache = new Map>(); + + constructor( + private app: App, + private getSettings: () => HabitsPluginSettings, + private saveSettings: () => Promise, + ) {} + + /** True when the path lives inside the configured habits folder. */ + isHabitFile(path: string): boolean { + const folder = this.folderPath; + return path === folder || path.startsWith(`${folder}/`); + } + + /** + * Read every habit note's comment section into the cache. Returns true + * when anything changed, so the caller can refresh open views. + */ + async primeComments(): Promise { + let changed = false; + for (const file of this.habitFiles()) { + changed = (await this.refreshComments(file)) || changed; + } + return changed; + } + + /** Re-read one note's comment section. Returns true when it changed. */ + async refreshComments(file: TFile): Promise { + const content = await this.app.vault.cachedRead(file); + return this.putComments(file.path, parseCommentLog(content)); + } + + /** Drop a note from the cache, e.g. after a delete or rename. */ + forgetComments(path: string): void { + this.commentCache.delete(path); + } + + /** Store parsed comments, reporting whether they differ from the cache. */ + private putComments( + path: string, + comments: Record, + ): boolean { + const previous = this.commentCache.get(path); + if (previous && sameComments(previous, comments)) { + return false; + } + if (Object.keys(comments).length === 0) { + this.commentCache.delete(path); + return previous !== undefined; + } + this.commentCache.set(path, comments); + return true; + } + + private get folderPath(): string { + return normalizePath(this.getSettings().habitsFolder); + } + + /** The configured frontmatter property name for each stored field. */ + private keys(): FrontmatterKeys { + return this.getSettings().frontmatterKeys; + } + + /** Shared styling (colour, icon) for a group, if any is stored. */ + getGroupStyle(name: string): GroupStyle | undefined { + return this.getSettings().groups[name.trim()]; + } + + /** + * Store or clear a group's shared styling. Passing a style with no + * colour and no icon (or `null`) removes the entry. + */ + async setGroupStyle( + name: string, + style: GroupStyle | null, + ): Promise { + const key = name.trim(); + if (!key) { + return; + } + const groups = this.getSettings().groups; + const existing = groups[key]; + if (style && (style.color || style.icon)) { + if ( + existing && + existing.color === style.color && + existing.icon === style.icon + ) { + return; + } + groups[key] = { color: style.color, icon: style.icon }; + } else { + if (!existing) { + return; + } + delete groups[key]; + } + await this.saveSettings(); + } + + /** Create the habits folder if it does not already exist. */ + async ensureFolderExists(): Promise { + const existing = this.app.vault.getAbstractFileByPath(this.folderPath); + if (existing instanceof TFolder) { + return; + } + await this.app.vault.createFolder(this.folderPath); + } + + /** Return every habit defined in the folder, sorted by name. */ + getHabits(): HabitDefinition[] { + const habits: HabitDefinition[] = []; + for (const file of this.habitFiles()) { + const habit = this.parseFile(file); + if (habit) { + habits.push(habit); + } + } + + habits.sort((a, b) => a.name.localeCompare(b.name)); + return habits; + } + + private parseFile(file: TFile): HabitDefinition | null { + const cache = this.app.metadataCache.getFileCache(file); + const fm = cache?.frontmatter; + const k = this.keys(); + if (!fm || !isHabitType(fm[k.type])) { + return null; + } + + const pauses = this.readPauses(fm[k.pauses]); + return { + path: file.path, + name: file.basename, + type: fm[k.type] as HabitType, + goalDirection: fm[k.goalDirection] === "max" ? "max" : "min", + frequency: isHabitFrequency(fm[k.frequency]) + ? (fm[k.frequency] as HabitFrequency) + : "daily", + weekdays: this.readWeekdays(fm[`${k.weekday}s`], fm[k.weekday]), + monthDay: this.clampInt(this.readNumber(fm[k.monthDay], 1), 1, 31), + intervalDays: this.clampInt( + this.readNumber(fm[k.intervalDays], 2), + 2, + 365, + ), + intervalMode: fm[k.intervalMode] === "completion" ? "completion" : "fixed", + times: this.readTimes(fm[`${k.time}s`], fm[k.time]), + target: this.readNumber(fm[k.target], 1), + unit: typeof fm[k.unit] === "string" ? (fm[k.unit] as string) : "", + step: this.readStep(fm[k.step]), + weeklyTarget: this.readNumber(fm[k.weeklyTarget], 0), + monthlyTarget: this.readNumber(fm[k.monthlyTarget], 0), + weeklyPerfect: fm[k.weeklyPerfect] === true, + monthlyPerfect: fm[k.monthlyPerfect] === true, + icon: typeof fm[k.icon] === "string" ? (fm[k.icon] as string) : "", + color: + typeof fm[k.color] === "string" ? (fm[k.color] as string) : "", + group: + typeof fm[k.group] === "string" ? (fm[k.group] as string) : "", + useGroupColor: fm[k.useGroupColor] === true, + tags: this.readTagProperty(fm.tags), + startDate: this.readDateString(fm[k.startDate]), + paused: pauses.some((pause) => pause.end === ""), + pauses, + reschedules: this.readReschedules(fm[k.reschedules]), + failed: this.readDateList(fm[k.failed]), + skipped: this.readDateList(fm[k.skipped]), + stopped: fm[k.stopped] === true, + stopDate: this.readDateString(fm[k.stopDate]), + records: this.readRecords(fm[k.records]), + // Notes written before comments moved into the body still keep + // them in frontmatter; the body wins where both exist. + comments: { + ...this.readComments(fm[k.comments]), + ...(this.commentCache.get(file.path) ?? {}), + }, + noteFolder: + typeof fm[k.noteFolder] === "string" + ? (fm[k.noteFolder] as string) + : "", + noteFilenameFormat: + typeof fm[k.noteFilenameFormat] === "string" + ? (fm[k.noteFilenameFormat] as string) + : "", + templatePath: + typeof fm[k.templatePath] === "string" + ? (fm[k.templatePath] as string) + : "", + noteCompletionMode: isNoteCompletionMode(fm[k.noteCompletionMode]) + ? (fm[k.noteCompletionMode] as NoteCompletionMode) + : "chars", + noteChecklistRequirement: isNoteChecklistRequirement( + fm[k.noteChecklistRequirement], + ) + ? (fm[k.noteChecklistRequirement] as NoteChecklistRequirement) + : "all", + noteChecklistMin: this.clampInt( + this.readNumber(fm[k.noteChecklistMin], 1), + 1, + 999, + ), + noteFailKeyword: + typeof fm[k.noteFailKeyword] === "string" + ? (fm[k.noteFailKeyword] as string) + : "", + }; + } + + /** + * Read a `YYYY-MM-DD` scalar, tolerating a native `Date`. + * + * Obsidian's own frontmatter writer (used by `processFrontMatter`) + * re-serializes a note's *entire* frontmatter on every edit, and drops + * the quotes around a plain string that happens to look like a date. + * Once unquoted, that value reads back as a YAML timestamp rather than + * text, so Obsidian hands it to us as a `Date` object instead of a + * string on the next read — for any note that's ever been touched by + * `processFrontMatter`, not just ones written by this plugin. Recovered + * via UTC fields, since YAML resolves a bare date as UTC midnight + * regardless of the reader's own timezone. + */ + private readDateString(value: unknown): string { + if (typeof value === "string") { + return value.trim(); + } + if (value instanceof Date && !Number.isNaN(value.getTime())) { + const year = value.getUTCFullYear(); + const month = String(value.getUTCMonth() + 1).padStart(2, "0"); + const day = String(value.getUTCDate()).padStart(2, "0"); + return `${year}-${month}-${day}`; + } + return ""; + } + + /** + * Parse a frontmatter list of `YYYY-MM-DD` dates (the `failed` and + * `skipped` days), dropping anything that isn't a date. A single scalar + * date is accepted too, for hand-written notes. + */ + private readDateList(raw: unknown): string[] { + const values = Array.isArray(raw) ? raw : raw === undefined ? [] : [raw]; + const dates = new Set(); + for (const value of values) { + const key = this.readDateString(value); + if (/^\d{4}-\d{2}-\d{2}$/.test(key)) { + dates.add(key); + } + } + return [...dates].sort(); + } + + private readNumber(value: unknown, fallback: number): number { + if (typeof value === "number" && Number.isFinite(value)) { + return value; + } + if (typeof value === "string") { + const parsed = Number(value); + if (Number.isFinite(parsed)) { + return parsed; + } + } + return fallback; + } + + /** A counted habit's +/− step size; anything missing or not above 0 is 1. */ + private readStep(value: unknown): number { + const step = roundValue(this.readNumber(value, 1)); + return step > 0 ? step : 1; + } + + /** Round to a whole number and constrain it to an inclusive range. */ + private clampInt(value: number, min: number, max: number): number { + return Math.min(max, Math.max(min, Math.round(value))); + } + + /** + * Parse a weekly habit's due days: the `weekdays` list when present, + * otherwise the original scalar `weekday`. Values are clamped to `0`–`6`, + * deduplicated and sorted; with nothing usable the result falls back to + * `[1]` (Monday), matching the old scalar default. + */ + private readWeekdays(list: unknown, single: unknown): number[] { + const raw = Array.isArray(list) ? list : [single]; + const days = new Set(); + for (const value of raw) { + const parsed = this.readNumber(value, NaN); + if (Number.isFinite(parsed)) { + days.add(this.clampInt(parsed, 0, 6)); + } + } + if (days.size === 0) { + days.add(1); + } + return [...days].sort((a, b) => a - b); + } + + /** + * Parse a single time of day. Anything that isn't a valid `H:mm` or + * `HH:mm` string is treated as "no time" rather than an error, and the + * hour is zero-padded so times sort and compare as plain strings. + */ + private readTime(value: unknown): string { + if (typeof value !== "string") { + return ""; + } + const match = /^([01]?\d|2[0-3]):([0-5]\d)$/.exec(value.trim()); + if (!match) { + return ""; + } + return `${match[1].padStart(2, "0")}:${match[2]}`; + } + + /** + * Parse a habit's planned times: the `times` list when present, + * otherwise the scalar `time`. Invalid entries are dropped, the rest + * deduplicated and sorted chronologically. + */ + private readTimes(list: unknown, single: unknown): string[] { + const raw = Array.isArray(list) ? list : [single]; + const times = new Set(); + for (const value of raw) { + const parsed = this.readTime(value); + if (parsed) { + times.add(parsed); + } + } + return [...times].sort(); + } + + /** Validate, deduplicate and sort a planned-times list. */ + private normalizeTimes(values: string[]): string[] { + return this.readTimes(values, undefined); + } + + /** Clamp, deduplicate and sort a weekday list, defaulting to Monday. */ + private normalizeWeekdays(values: number[]): number[] { + const days = [ + ...new Set(values.map((value) => this.clampInt(value, 0, 6))), + ].sort((a, b) => a - b); + return days.length > 0 ? days : [1]; + } + + /** + * Parse the completion field in either of the two shapes it may be + * stored in: this plugin's own day → value map, or a bare list of + * done dates (the shape TaskNotes uses for `complete_instances`) — + * each listed date is read as a completed day with value `1`. Both + * shapes are always accepted on read, so a note already carrying + * either one (e.g. authored by another plugin) is picked up without + * configuration — see {@link setRecord} for which shape gets written. + */ + private readRecords(raw: unknown): Record { + const records: Record = {}; + if (Array.isArray(raw)) { + for (const value of raw) { + const dateKey = this.readDateString(value); + if (dateKey) { + records[dateKey] = 1; + } + } + return records; + } + if (raw && typeof raw === "object") { + for (const [key, value] of Object.entries( + raw as Record, + )) { + if (typeof value === "number") { + records[key] = value; + } else if (typeof value === "boolean") { + records[key] = value ? 1 : 0; + } else if (typeof value === "string" && value.trim() !== "") { + const parsed = Number(value); + if (Number.isFinite(parsed)) { + records[key] = parsed; + } + } + } + } + return records; + } + + /** Parse the frontmatter `comments` map, dropping empty entries. */ + private readComments(raw: unknown): Record { + const comments: Record = {}; + if (raw && typeof raw === "object") { + for (const [key, value] of Object.entries( + raw as Record, + )) { + if (typeof value === "string" && value.trim() !== "") { + comments[key] = value; + } + } + } + return comments; + } + + /** Parse the frontmatter `pauses` array, dropping malformed entries. */ + private readPauses(raw: unknown): HabitPause[] { + if (!Array.isArray(raw)) { + return []; + } + const pauses: HabitPause[] = []; + for (const item of raw) { + if (!item || typeof item !== "object") { + continue; + } + const entry = item as Record; + const start = this.readDateString(entry.start); + if (start === "") { + continue; + } + pauses.push({ start, end: this.readDateString(entry.end) }); + } + return pauses; + } + + /** Close any open pause as of yesterday; drop it if it covered no days. */ + private closeOpenPause(pauses: HabitPause[]): HabitPause[] { + const yesterday = toDateKey(addDays(new Date(), -1)); + const closed: HabitPause[] = []; + for (const pause of pauses) { + if (pause.end !== "") { + closed.push(pause); + } else if (pause.start <= yesterday) { + closed.push({ start: pause.start, end: yesterday }); + } + // An open pause that started today covered no full day; drop it. + } + return closed; + } + + /** Frontmatter form of pauses: open pauses omit the `end` key. */ + private serializePauses( + pauses: HabitPause[], + ): { start: string; end?: string }[] { + return pauses.map((pause) => + pause.end === "" + ? { start: pause.start } + : { start: pause.start, end: pause.end }, + ); + } + + /** Parse the frontmatter `reschedules` array, dropping malformed entries. */ + private readReschedules(raw: unknown): HabitReschedule[] { + if (!Array.isArray(raw)) { + return []; + } + const reschedules: HabitReschedule[] = []; + for (const item of raw) { + if (!item || typeof item !== "object") { + continue; + } + const entry = item as Record; + const from = this.readDateString(entry.from); + const to = this.readDateString(entry.to); + if (from === "" || to === "") { + continue; + } + reschedules.push({ from, to }); + } + return reschedules; + } + + private serializeReschedules( + reschedules: HabitReschedule[], + ): { from: string; to: string }[] { + return reschedules.map((r) => ({ from: r.from, to: r.to })); + } + + /** + * Write the frequency fields to frontmatter, keeping it tidy: daily habits + * store nothing (it is the default), and only the fields relevant to the + * chosen frequency are kept so stale keys never linger after a change. + * A weekly habit due on a single day keeps the original scalar `weekday` + * form, so notes from before multi-day support are rewritten unchanged. + */ + private writeFrequency( + fm: Record, + options: NewHabitOptions, + ): void { + const k = this.keys(); + delete fm[k.weekday]; + delete fm[`${k.weekday}s`]; + delete fm[k.monthDay]; + delete fm[k.intervalDays]; + delete fm[k.intervalMode]; + if (options.frequency === "weekly") { + fm[k.frequency] = "weekly"; + const days = this.normalizeWeekdays(options.weekdays); + if (days.length === 1) { + fm[k.weekday] = days[0]; + } else { + fm[`${k.weekday}s`] = days; + } + } else if (options.frequency === "monthly") { + fm[k.frequency] = "monthly"; + fm[k.monthDay] = this.clampInt(options.monthDay, 1, 31); + } else if (options.frequency === "interval") { + fm[k.frequency] = "interval"; + fm[k.intervalDays] = this.clampInt(options.intervalDays, 2, 365); + if (options.intervalMode === "completion") fm[k.intervalMode] = "completion"; + } else if ( + options.frequency === "flexibleWeekly" || + options.frequency === "flexibleMonthly" + ) { + fm[k.frequency] = options.frequency; + } else { + delete fm[k.frequency]; + } + } + + /** + * Write the planned times to frontmatter, mirroring the weekday + * convention: a single time keeps the scalar `time` form, several use + * the `times` list, and none removes both keys. + */ + private writeTimes( + fm: Record, + options: NewHabitOptions, + ): void { + const k = this.keys(); + delete fm[k.time]; + delete fm[`${k.time}s`]; + const times = this.normalizeTimes(options.times); + if (times.length === 1) { + fm[k.time] = times[0]; + } else if (times.length > 1) { + fm[`${k.time}s`] = times; + } + } + + /** + * Write a `note` habit's folder/filename-format/template/completion-mode + * fields, keeping frontmatter tidy: values equal to the default are + * omitted, and every field is dropped for other habit types. A blank + * folder defaults to a dedicated subfolder of the habits folder, named + * after the habit, so every note habit gets a collision-free home + * without the user having to think about it. + */ + private writeNoteFields( + fm: Record, + options: NewHabitOptions, + cleanName: string, + ): void { + const k = this.keys(); + delete fm[k.noteFolder]; + delete fm[k.noteFilenameFormat]; + delete fm[k.templatePath]; + delete fm[k.noteCompletionMode]; + delete fm[k.noteChecklistRequirement]; + delete fm[k.noteChecklistMin]; + delete fm[k.noteFailKeyword]; + if (options.type !== "note") { + return; + } + fm[k.noteFolder] = + options.noteFolder.trim() || `${this.folderPath}/${cleanName}`; + const format = options.noteFilenameFormat.trim(); + if (format && format !== DEFAULT_NOTE_FILENAME_FORMAT) { + fm[k.noteFilenameFormat] = format; + } + if (options.templatePath.trim()) { + fm[k.templatePath] = options.templatePath.trim(); + } + if (options.noteCompletionMode !== "chars") { + fm[k.noteCompletionMode] = options.noteCompletionMode; + } + const usesChecklist = + options.noteCompletionMode === "checklist" || + options.noteCompletionMode === "both"; + if (usesChecklist && options.noteChecklistRequirement === "count") { + fm[k.noteChecklistRequirement] = "count"; + fm[k.noteChecklistMin] = this.clampInt( + options.noteChecklistMin, + 1, + 999, + ); + } + if (options.noteFailKeyword.trim()) { + fm[k.noteFailKeyword] = options.noteFailKeyword.trim(); + } + } + + private fileForHabit(habit: HabitDefinition): TFile | null { + const file = this.app.vault.getAbstractFileByPath(habit.path); + return file instanceof TFile ? file : null; + } + + /** + * Record `value` for `habit` on the day identified by `dateKey`. + * + * A value of zero or less removes the entry to keep the frontmatter tidy. + * + * Writes as a plain day → value map, unless both of these hold: the + * habit is binary (its logged value is always exactly `1`, so a value + * map and a bare date carry the same information) and the completion + * key has been renamed away from its default `records` — the signal + * that this note is meant to interoperate with something else, such as + * TaskNotes' `complete_instances`. In that case it's written as a bare, + * sorted list of completed dates instead (dropping any non-positive + * entries). Repetition/timed habits always use the value map, since + * only it can hold their logged count or duration. + */ + async setRecord( + habit: HabitDefinition, + dateKey: string, + value: number, + ): Promise { + const file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return; + } + + const k = this.keys(); + const useDateList = + habit.type === "binary" && + k.records !== DEFAULT_FRONTMATTER_KEYS.records; + // Repeated +0.1 presses would otherwise store 0.30000000000000004. + value = roundValue(value); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + const records = this.readRecords(fm[k.records]); + if (value > 0) { + records[dateKey] = value; + } else { + delete records[dateKey]; + } + fm[k.records] = useDateList + ? Object.entries(records) + .filter(([, recorded]) => recorded > 0) + .map(([day]) => day) + .sort() + : records; + }); + } + + /** + * Save (or clear) the comment for a habit on the given day. + * + * Comments are written to the note body so that Obsidian indexes the + * `#tags` and `[[links]]` inside them against the day they belong to. + * A note still holding comments in frontmatter is migrated on the same + * pass, so no separate upgrade step is needed. + */ + async setComment( + habit: HabitDefinition, + dateKey: string, + text: string, + ): Promise { + const file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return; + } + + const legacy = this.legacyComments(file); + let written: Record = {}; + await this.app.vault.process(file, (content) => { + const comments = { ...legacy, ...parseCommentLog(content) }; + if (text) { + comments[dateKey] = text; + } else { + delete comments[dateKey]; + } + written = comments; + return applyCommentLog(content, comments); + }); + this.putComments(file.path, written); + + if (Object.keys(legacy).length > 0) { + await this.clearLegacyComments(file, legacy); + } + } + + /** Day comments still stored in a note's frontmatter, if any. */ + private legacyComments(file: TFile): Record { + const fm = this.app.metadataCache.getFileCache(file)?.frontmatter; + return this.readComments(fm?.[this.keys().comments]); + } + + /** True when any habit note still keeps its comments in frontmatter. */ + hasLegacyComments(): boolean { + return this.habitFiles().some( + (file) => Object.keys(this.legacyComments(file)).length > 0, + ); + } + + /** + * Move every note's frontmatter comments into its body. Returns how + * many notes were changed. + */ + async migrateComments(): Promise { + let migrated = 0; + for (const file of this.habitFiles()) { + const legacy = this.legacyComments(file); + if (Object.keys(legacy).length === 0) { + continue; + } + let written: Record = {}; + await this.app.vault.process(file, (content) => { + written = { ...legacy, ...parseCommentLog(content) }; + return applyCommentLog(content, written); + }); + this.putComments(file.path, written); + await this.clearLegacyComments(file, legacy); + migrated++; + } + return migrated; + } + + /** + * Move each rename's value onto its new frontmatter key, across every + * habit note, one `processFrontMatter` pass per file (not one pass per + * key). A value is only ever moved, never overwritten: a rename is + * skipped for a given note if its new key is already in use there, so + * existing data can't be clobbered. Returns how many notes were changed. + */ + async renameFrontmatterKeys( + renames: { old: string; new: string }[], + ): Promise { + let changed = 0; + for (const file of this.habitFiles()) { + let fileChanged = false; + await this.app.fileManager.processFrontMatter( + file, + (frontmatter) => { + const fm = frontmatter as Record; + for (const { old: oldKey, new: newKey } of renames) { + if ( + oldKey !== newKey && + fm[oldKey] !== undefined && + fm[newKey] === undefined + ) { + fm[newKey] = fm[oldKey]; + delete fm[oldKey]; + fileChanged = true; + } + } + }, + ); + if (fileChanged) { + changed++; + } + } + return changed; + } + + /** + * Drop the frontmatter `comments` key once its contents live in the + * body, along with any tags an earlier version mirrored into `tags` — + * the body now supplies those to Obsidian's index directly. + */ + private async clearLegacyComments( + file: TFile, + legacy: Record, + ): Promise { + const mirrored = tagsInComments(legacy); + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + delete fm[k.comments]; + if (mirrored.size === 0 || !("tags" in fm)) { + return; + } + const kept = this.readTagProperty(fm.tags).filter( + (tag) => !mirrored.has(tag), + ); + if (kept.length > 0) { + fm.tags = kept; + } else { + delete fm.tags; + } + }); + } + + /** Read `tags` in any of the shapes Obsidian accepts, minus the `#`. */ + private readTagProperty(raw: unknown): string[] { + const values = Array.isArray(raw) + ? raw + : typeof raw === "string" + ? raw.split(/[,\s]+/) + : []; + const out: string[] = []; + for (const value of values) { + if (typeof value !== "string") { + continue; + } + const tag = value.trim().replace(/^#/, ""); + if (tag !== "" && !out.includes(tag)) { + out.push(tag); + } + } + return out; + } + + /** Every markdown file in the habits folder. */ + private habitFiles(): TFile[] { + const folder = this.app.vault.getAbstractFileByPath(this.folderPath); + if (!(folder instanceof TFolder)) { + return []; + } + return folder.children.filter( + (child): child is TFile => + child instanceof TFile && child.extension === "md", + ); + } + + /** Pause a habit from today. Paused days are skipped by streaks/stats. */ + async pauseHabit(habit: HabitDefinition): Promise { + const file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return; + } + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + const pauses = this.readPauses(fm[k.pauses]); + if (pauses.some((pause) => pause.end === "")) { + return; + } + pauses.push({ start: toDateKey(new Date()), end: "" }); + fm[k.pauses] = this.serializePauses(pauses); + }); + new Notice(t('Paused "{name}".', { name: habit.name })); + } + + /** + * Close a day as failed or skipped, or reopen it (`null`). A day holds at + * most one of the two, so setting one clears the other; empty lists are + * removed from the frontmatter rather than left as `[]`. + */ + async setDayStatus( + habit: HabitDefinition, + dateKey: string, + status: "failed" | "skipped" | null, + ): Promise { + const file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return; + } + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + for (const kind of ["failed", "skipped"] as const) { + const key = k[kind]; + const dates = this.readDateList(fm[key]).filter( + (date) => date !== dateKey, + ); + if (kind === status) { + dates.push(dateKey); + dates.sort(); + } + if (dates.length > 0) { + fm[key] = dates; + } else { + delete fm[key]; + } + } + }); + // Mirror the write so a view repainting before the metadata cache + // catches up already sees the change. + habit.failed = habit.failed.filter((date) => date !== dateKey); + habit.skipped = habit.skipped.filter((date) => date !== dateKey); + if (status) { + habit[status].push(dateKey); + } + } + + /** When the habit's snooze ends (epoch ms), or null if it isn't snoozed. */ + snoozedUntil(habit: HabitDefinition, now = Date.now()): number | null { + const until = this.getSettings().snoozes[habit.path]; + return typeof until === "number" && until > now ? until : null; + } + + /** Hide a habit from today's lists until `until` (epoch ms). */ + async snoozeHabit(habit: HabitDefinition, until: number): Promise { + await this.writeSnoozes((snoozes) => { + snoozes[habit.path] = until; + }); + } + + /** End a habit's snooze early. */ + async clearSnooze(habit: HabitDefinition): Promise { + await this.writeSnoozes((snoozes) => { + delete snoozes[habit.path]; + }); + } + + /** Apply a change to the snoozes, pruning any that have already ended. */ + private async writeSnoozes( + change: (snoozes: Record) => void, + ): Promise { + const now = Date.now(); + const snoozes: Record = {}; + for (const [path, until] of Object.entries(this.getSettings().snoozes)) { + if (until > now) { + snoozes[path] = until; + } + } + change(snoozes); + this.getSettings().snoozes = snoozes; + await this.saveSettings(); + } + + /** Resume a paused habit; the pause period stays excluded from stats. */ + async resumeHabit(habit: HabitDefinition): Promise { + const file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return; + } + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + const pauses = this.closeOpenPause(this.readPauses(fm[k.pauses])); + if (pauses.length > 0) { + fm[k.pauses] = this.serializePauses(pauses); + } else { + delete fm[k.pauses]; + } + }); + new Notice(t('Resumed "{name}".', { name: habit.name })); + } + + /** + * Move a missed due day onto a different one (experimental). Upserts by + * `from`, so calling this again for the same missed day replaces where + * it was previously moved to rather than adding a second entry. Callers + * are expected to have already checked {@link isRescheduleTargetOpen} + * for `to` — this only guards against the note going missing mid-edit. + */ + async rescheduleHabit( + habit: HabitDefinition, + from: string, + to: string, + ): Promise { + const file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return; + } + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + const reschedules = this.readReschedules(fm[k.reschedules]).filter( + (r) => r.from !== from, + ); + reschedules.push({ from, to }); + fm[k.reschedules] = this.serializeReschedules(reschedules); + }); + new Notice( + t('Rescheduled "{name}" to {date}.', { name: habit.name, date: to }), + ); + } + + /** Undo a reschedule: the original day goes back to being due. */ + async cancelReschedule(habit: HabitDefinition, from: string): Promise { + const file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return; + } + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + const reschedules = this.readReschedules(fm[k.reschedules]).filter( + (r) => r.from !== from, + ); + if (reschedules.length > 0) { + fm[k.reschedules] = this.serializeReschedules(reschedules); + } else { + delete fm[k.reschedules]; + } + }); + } + + /** Stop tracking a habit. The note and every record are kept. */ + async stopHabit(habit: HabitDefinition): Promise { + const file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return; + } + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + fm[k.stopped] = true; + fm[k.stopDate] = toDateKey(new Date()); + const pauses = this.closeOpenPause(this.readPauses(fm[k.pauses])); + if (pauses.length > 0) { + fm[k.pauses] = this.serializePauses(pauses); + } else { + delete fm[k.pauses]; + } + }); + new Notice( + t('Stopped tracking "{name}". Its history is kept in the note.', { + name: habit.name, + }), + ); + } + + /** Resume tracking a previously stopped habit. */ + async restartHabit(habit: HabitDefinition): Promise { + const file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return; + } + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + delete fm[k.stopped]; + delete fm[k.stopDate]; + }); + new Notice(t('Resumed tracking "{name}".', { name: habit.name })); + } + + /** Create a new habit note and return the created file. */ + async createHabit(options: NewHabitOptions): Promise { + const cleanName = sanitizeFileName(options.name); + if (!cleanName) { + new Notice(t("Please enter a valid habit name.")); + return null; + } + + await this.ensureFolderExists(); + const path = normalizePath(`${this.folderPath}/${cleanName}.md`); + if (this.app.vault.getAbstractFileByPath(path)) { + new Notice( + t('A habit called "{name}" already exists.', { + name: cleanName, + }), + ); + return null; + } + + const body = [ + `# ${cleanName}`, + "", + t("This note is managed by Task Genius."), + "", + "## Metrics", + "", + "```tg-habit-metrics", + "```", + "", + ].join("\n"); + const file = await this.app.vault.create(path, body); + + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + fm.habit = true; + fm[k.type] = options.type; + // Only limit habits store the field; its absence means "min", so + // notes created before the field existed keep their meaning. + if (options.goalDirection === "max") { + fm[k.goalDirection] = "max"; + } + this.writeFrequency(fm, options); + this.writeTimes(fm, options); + this.writeNoteFields(fm, options, cleanName); + if ( + options.type !== "binary" || + isFlexibleFrequency(options.frequency) + ) { + // A limit of 0 is meaningful ("none at all"), so max habits + // always write the field even when it is zero. A note + // habit's target is its character goal, or 100 for a + // checklist habit's checked percentage. A flexible habit's + // target is its "times per period" goal, which a binary + // habit needs written too (unlike the normal binary case, + // where it is meaningless and left out). + fm[k.target] = options.target; + } + if (options.unit) { + fm[k.unit] = options.unit; + } + // Only written when it differs from the default of 1. + if (options.type === "repetition" && options.step !== 1) { + fm[k.step] = options.step; + } + if (options.weeklyPerfect) { + fm[k.weeklyPerfect] = true; + } else if (options.weeklyTarget > 0) { + fm[k.weeklyTarget] = options.weeklyTarget; + } + if (options.monthlyPerfect) { + fm[k.monthlyPerfect] = true; + } else if (options.monthlyTarget > 0) { + fm[k.monthlyTarget] = options.monthlyTarget; + } + if (options.icon) { + fm[k.icon] = options.icon; + } + if (options.color) { + fm[k.color] = options.color; + } + if (options.group) { + fm[k.group] = options.group; + } + if (options.useGroupColor) { + fm[k.useGroupColor] = true; + } + if (options.tags.length > 0) { + fm.tags = options.tags; + } + fm[k.startDate] = toDateKey(new Date()); + fm[k.records] = {}; + }); + + new Notice(t('Created habit "{name}".', { name: cleanName })); + return file; + } + + /** Update an existing habit's definition, renaming its note if needed. */ + async updateHabit( + habit: HabitDefinition, + options: NewHabitOptions, + ): Promise { + let file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return null; + } + + const cleanName = sanitizeFileName(options.name); + if (!cleanName) { + new Notice(t("Please enter a valid habit name.")); + return null; + } + + if (cleanName !== habit.name) { + const newPath = normalizePath(`${this.folderPath}/${cleanName}.md`); + if (this.app.vault.getAbstractFileByPath(newPath)) { + new Notice( + t('A habit called "{name}" already exists.', { + name: cleanName, + }), + ); + return null; + } + await this.app.fileManager.renameFile(file, newPath); + const renamed = this.app.vault.getAbstractFileByPath(newPath); + if (renamed instanceof TFile) { + file = renamed; + } + } + + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + fm.habit = true; + fm[k.type] = options.type; + if (options.goalDirection === "max") { + fm[k.goalDirection] = "max"; + } else { + delete fm[k.goalDirection]; + } + this.writeFrequency(fm, options); + this.writeTimes(fm, options); + this.writeNoteFields(fm, options, cleanName); + if ( + options.type === "binary" && + !isFlexibleFrequency(options.frequency) + ) { + delete fm[k.target]; + } else { + fm[k.target] = options.target; + } + if (options.unit) { + fm[k.unit] = options.unit; + } else { + delete fm[k.unit]; + } + if (options.type === "repetition" && options.step !== 1) { + fm[k.step] = options.step; + } else { + delete fm[k.step]; + } + if (options.weeklyPerfect) { + fm[k.weeklyPerfect] = true; + delete fm[k.weeklyTarget]; + } else { + delete fm[k.weeklyPerfect]; + if (options.weeklyTarget > 0) { + fm[k.weeklyTarget] = options.weeklyTarget; + } else { + delete fm[k.weeklyTarget]; + } + } + if (options.monthlyPerfect) { + fm[k.monthlyPerfect] = true; + delete fm[k.monthlyTarget]; + } else { + delete fm[k.monthlyPerfect]; + if (options.monthlyTarget > 0) { + fm[k.monthlyTarget] = options.monthlyTarget; + } else { + delete fm[k.monthlyTarget]; + } + } + if (options.icon) { + fm[k.icon] = options.icon; + } else { + delete fm[k.icon]; + } + if (options.color) { + fm[k.color] = options.color; + } else { + delete fm[k.color]; + } + if (options.group) { + fm[k.group] = options.group; + } else { + delete fm[k.group]; + } + if (options.useGroupColor) { + fm[k.useGroupColor] = true; + } else { + delete fm[k.useGroupColor]; + } + if (options.tags.length > 0) { + fm.tags = options.tags; + } else { + delete fm.tags; + } + }); + + new Notice(t('Updated "{name}".', { name: cleanName })); + return file; + } + + /** + * Reassign a habit to a group (or ungroup it with ""), writing the + * note's frontmatter. Leaving a group also clears the group-colour + * override, which would otherwise silently point at the old group. + */ + async setHabitGroup( + habit: HabitDefinition, + group: string, + ): Promise { + const file = this.fileForHabit(habit); + if (!file) { + return; + } + const cleaned = group.trim(); + const k = this.keys(); + await this.app.fileManager.processFrontMatter(file, (frontmatter) => { + const fm = frontmatter as Record; + if (cleaned) { + fm[k.group] = cleaned; + } else { + delete fm[k.group]; + delete fm[k.useGroupColor]; + } + }); + habit.group = cleaned; + if (!cleaned) { + habit.useGroupColor = false; + } + } + + /** Move a habit's note to the trash (respecting the user's settings). */ + async deleteHabit(habit: HabitDefinition): Promise { + const file = this.fileForHabit(habit); + if (!file) { + new Notice( + t('Could not find the note for "{name}".', { + name: habit.name, + }), + ); + return; + } + await this.app.fileManager.trashFile(file); + new Notice(t('Removed "{name}".', { name: habit.name })); + } +} diff --git a/src/integrations/habits/i18n/de.ts b/src/integrations/habits/i18n/de.ts new file mode 100644 index 000000000..69530e701 --- /dev/null +++ b/src/integrations/habits/i18n/de.ts @@ -0,0 +1,657 @@ +/** German translations, keyed by the English source string. */ +export const de: Record = { + // Commands and ribbon + "Create habit": "Gewohnheit erstellen", + "Insert dashboard": "Dashboard einfügen", + "Insert habit metrics": "Gewohnheits-Metriken einfügen", + "Insert habits table": "Gewohnheitstabelle einfügen", + "Open panel": "Seitenleiste öffnen", + "Open habits panel": "Gewohnheiten-Seitenleiste öffnen", + Habits: "Gewohnheiten", + + // Settings + "Habits folder": "Gewohnheiten-Ordner", + "Folder where each habit is stored as its own note. It is created automatically if it does not exist.": + "Ordner, in dem jede Gewohnheit als eigene Notiz gespeichert wird. Er wird automatisch erstellt, falls er nicht existiert.", + "Follow daily note date": "Datum der täglichen Notiz übernehmen", + "When a dashboard is embedded in a daily note (a note whose name contains a date like 2026-07-01), open it on that note's date instead of today.": + "Wenn ein Dashboard in eine tägliche Notiz eingebettet ist (eine Notiz, deren Name ein Datum wie 2026-07-01 enthält), öffnet es sich mit dem Datum dieser Notiz statt mit heute.", + "Daily note date format": "Datumsformat der täglichen Notiz", + "Moment.js format used to read the date from a daily note's name, such as YYYY-MM-DD or YYYYMMDD.": + "Moment.js-Format, mit dem das Datum aus dem Namen einer täglichen Notiz gelesen wird, zum Beispiel YYYY-MM-DD oder YYYYMMDD.", + + // Sorting + "Sort habits by": "Gewohnheiten sortieren nach", + "The base order of habit cards in the dashboard and side panel.": + "Die Grundreihenfolge der Gewohnheitskarten im Dashboard und im Seitenpanel.", + "Name (A–Z)": "Name (A–Z)", + Color: "Farbe", + "Last logged": "Zuletzt protokolliert", + "Planned time": "Geplante Uhrzeit", + Manual: "Manuell", + "Manual order": "Manuelle Reihenfolge", + "Drag the cards into the order you want. New habits join the end of the list.": + "Ziehe die Karten in die gewünschte Reihenfolge. Neue Gewohnheiten werden am Ende der Liste eingefügt.", + "Move completed cards to the end": + "Erledigte Karten ans Ende verschieben", + "Completed habits drift to the end of the queue and paused ones park behind them. Turn this off to keep every card in its sorted position.": + "Erledigte Gewohnheiten wandern ans Ende der Warteschlange, pausierte dahinter. Deaktiviere dies, damit jede Karte an ihrer sortierten Position bleibt.", + Group: "Gruppe", + Ungrouped: "Ohne Gruppe", + "Optional group used to build dashboard sections — for example an area of responsibility.": + "Optionale Gruppe für Abschnitte im Dashboard — zum Beispiel ein Verantwortungsbereich.", + "e.g. Health": "z. B. Gesundheit", + "Group color": "Gruppenfarbe", + "Optional color shared by every habit in this group.": + "Optionale Farbe, die alle Gewohnheiten dieser Gruppe teilen.", + "Group icon": "Gruppensymbol", + "Shown in the group lip on cards and in section headers.": + "Wird in der Gruppenleiste auf Karten und in Abschnittsüberschriften angezeigt.", + "Use group color for this card": "Gruppenfarbe für diese Karte verwenden", + "Show this card in the group color instead of its own.": + "Zeigt diese Karte in der Gruppenfarbe statt in ihrer eigenen.", + General: "Allgemein", + Sorting: "Sortierung", + Groups: "Gruppen", + "How to move through your habit cards: a paged carousel with arrows, a grid that wraps onto new rows, or a fixed-height grid that scrolls vertically. The stats page follows the same choice.": + "Wie du durch deine Gewohnheitskarten navigierst: ein seitenweises Karussell mit Pfeilen, ein Raster, das in neue Zeilen umbricht, oder ein Raster mit fester Höhe, das vertikal scrollt. Die Statistikseite folgt derselben Auswahl.", + "Enable groups": "Gruppen aktivieren", + "Show habits in sections by their group, with a group lip on each card.": + "Zeigt Gewohnheiten in Abschnitten nach Gruppe, mit einer Gruppenleiste auf jeder Karte.", + "Group order": "Gruppenreihenfolge", + "Drag the groups into the order you want. Sections follow the same order.": + "Ziehe die Gruppen in die gewünschte Reihenfolge. Abschnitte folgen derselben Reihenfolge.", + "Completion animations": "Abschluss-Animationen", + "Play the check swoosh, card departure, and perfect-day confetti when habits are completed. Turn off for instant, quiet updates.": + "Spielt beim Abschließen von Gewohnheiten das Häkchen-Swoosh, den Kartenabgang und das Perfekter-Tag-Konfetti ab. Ausschalten für sofortige, ruhige Aktualisierungen.", + "Reminders": "Erinnerungen", + "Write reminders for due habits": + "Erinnerungen für fällige Gewohnheiten schreiben", + "Each day, write one reminder checklist line per planned time of every habit due that day, in the format the Reminder plugin picks up. The lines live in a marked block and refresh as you log habits.": + "Schreibt jeden Tag eine Erinnerungs-Checklistenzeile pro geplanter Uhrzeit für jede an dem Tag fällige Gewohnheit, im Format, das das Reminder-Plugin erkennt. Die Zeilen stehen in einem markierten Block und werden beim Protokollieren aktualisiert.", + "Where to write reminders": "Wohin Erinnerungen geschrieben werden", + "The daily note follows the Daily notes core plugin's folder and date format; the block is added once the note exists. A fixed note is created automatically.": + "Die tägliche Notiz folgt Ordner und Datumsformat des Kern-Plugins „Tägliche Notizen“; der Block wird eingefügt, sobald die Notiz existiert. Eine feste Notiz wird automatisch erstellt.", + "Today's daily note": "Heutige tägliche Notiz", + "A fixed note": "Eine feste Notiz", + "Reminder note path": "Pfad der Erinnerungsnotiz", + "Vault path of the note that holds the reminder block.": + "Vault-Pfad der Notiz, die den Erinnerungsblock enthält.", + "Manage groups": "Gruppen verwalten", + "See every habit by group and drag cards between groups.": + "Zeigt alle Gewohnheiten nach Gruppe und erlaubt das Ziehen von Karten zwischen Gruppen.", + Open: "Öffnen", + "New group": "Neue Gruppe", + Add: "Hinzufügen", + "Drag habits between groups to reassign them, or within a group to reorder them.": + "Ziehe Gewohnheiten zwischen Gruppen, um sie neu zuzuordnen, oder innerhalb einer Gruppe, um sie zu sortieren.", + "No habits": "Keine Gewohnheiten", + "Edit group style": "Gruppenstil bearbeiten", + "Delete group": "Gruppe löschen", + 'Delete "{name}"? Its habits are kept and become ungrouped.': + 'Gruppe "{name}" löschen? Ihre Gewohnheiten bleiben erhalten und werden gruppenlos.', + Delete: "Löschen", + "Dashboard layout": "Dashboard-Layout", + Carousel: "Karussell", + Grid: "Raster", + "Vertical scroll": "Vertikales Scrollen", + "Cards per view": "Karten pro Ansicht", + "How many habit cards fit side by side on wider screens.": + "Wie viele Gewohnheitskarten auf breiten Bildschirmen nebeneinander passen.", + "Cards per view on mobile": "Karten pro Ansicht auf dem Handy", + "How many habit cards fit side by side on phone-sized screens.": + "Wie viele Gewohnheitskarten auf Handy-Bildschirmen nebeneinander passen.", + + // Confirm dialog defaults + Cancel: "Abbrechen", + Confirm: "Bestätigen", + + // Store notices + 'Could not find the note for "{name}".': + 'Die Notiz für „{name}" wurde nicht gefunden.', + "Please enter a valid habit name.": + "Bitte gib einen gültigen Namen für die Gewohnheit ein.", + 'A habit called "{name}" already exists.': + 'Eine Gewohnheit namens „{name}" existiert bereits.', + 'Created habit "{name}".': 'Gewohnheit „{name}" erstellt.', + 'Updated "{name}".': '„{name}" aktualisiert.', + 'Paused "{name}".': '„{name}" pausiert.', + 'Resumed "{name}".': '„{name}" fortgesetzt.', + 'Stopped tracking "{name}". Its history is kept in the note.': + '„{name}" wird nicht mehr verfolgt. Der Verlauf bleibt in der Notiz erhalten.', + 'Resumed tracking "{name}".': '„{name}" wird wieder verfolgt.', + 'Removed "{name}".': '„{name}" entfernt.', + "Habit added to the dashboard.": + "Gewohnheit zum Dashboard hinzugefügt.", + + // Dashboard + "Back to habits": "Zurück zu den Gewohnheiten", + "View stats": "Statistiken anzeigen", + "Export stats": "Statistiken exportieren", + Weekly: "Wöchentlich", + Monthly: "Monatlich", + "Previous day": "Vorheriger Tag", + "Next day": "Nächster Tag", + "Choose a date": "Datum wählen", + "Add habit": "Gewohnheit hinzufügen", + "No habits yet. Create your first habit to get started.": + "Noch keine Gewohnheiten. Erstelle deine erste Gewohnheit, um loszulegen.", + Previous: "Zurück", + Next: "Weiter", + "Go to position {n}": "Zu Position {n} springen", + "Right-click or long-press for more options": + "Rechtsklick oder langes Drücken für weitere Optionen", + "Open habit note": "Notiz der Gewohnheit öffnen", + "Open the note for {name}": "Notiz für {name} öffnen", + Paused: "Pausiert", + Stopped: "Beendet", + "Failed": "Fehlgeschlagen", + "Skipped": "Übersprungen", + "Snoozed": "Schlummert", + "Snoozed until {time}": "Schlummert bis {time}", + "Undo fail": "Fehlschlag rückgängig", + "Undo skip": "Überspringen rückgängig", + "End snooze": "Schlummern beenden", + "Fail for today": "Für heute als fehlgeschlagen markieren", + "Fail this day": "Diesen Tag als fehlgeschlagen markieren", + "Marked \"{name}\" as failed.": "„{name}“ als fehlgeschlagen markiert.", + "Skip for today": "Für heute überspringen", + "Skip this day": "Diesen Tag überspringen", + "Skipped \"{name}\".": "„{name}“ übersprungen.", + "Snooze…": "Schlummern…", + "Snooze \"{name}\"": "„{name}“ schlummern lassen", + "It leaves today's lists and comes back on its own. Snoozing never counts for or against the habit.": "Verschwindet aus den heutigen Listen und kommt von selbst zurück. Schlummern zählt nie für oder gegen die Gewohnheit.", + "Snooze for": "Schlummern für", + "30 minutes": "30 Minuten", + "1 hour": "1 Stunde", + "3 hours": "3 Stunden", + "Snooze until": "Schlummern bis", + "Snooze": "Schlummern", + "Pick a time later today.": "Wähle eine spätere Uhrzeit von heute.", + "Snoozed \"{name}\" until {time}.": "„{name}“ schlummert bis {time}.", + "1 hidden for today": "1 für heute ausgeblendet", + "{count} hidden for today": "{count} für heute ausgeblendet", + "1 hidden for this day": "1 für diesen Tag ausgeblendet", + "{count} hidden for this day": "{count} für diesen Tag ausgeblendet", + "Undo": "Rückgängig", + "Click to undo": "Klicken zum Rückgängigmachen", + "Nothing left on this day's list.": "Für diesen Tag ist nichts mehr offen.", + "Nothing left on today's list.": "Für heute ist nichts mehr offen.", + "At least: reach a target for habits you are building, like drinking 1.5 litres of water. At most: stay within a limit for habits you are cutting down, like no more than 2 coffees.": "Mindestens: Erreiche ein Ziel bei Gewohnheiten, die du aufbaust, etwa 1,5 Liter Wasser trinken. Höchstens: Bleib innerhalb eines Limits bei Gewohnheiten, die du reduzierst, etwa nicht mehr als 2 Kaffee.", + "At least (reach a target)": "Mindestens (Ziel erreichen)", + "At most (stay within a limit)": "Höchstens (im Limit bleiben)", + "Step size": "Schrittweite", + "How much each + and − press adds or removes. Use a decimal such as 0.25 for amounts like litres.": "Wie viel jeder Druck auf + und − hinzufügt oder abzieht. Nutze eine Dezimalzahl wie 0.25 für Mengen wie Liter.", + "Decrease by {n}": "Um {n} verringern", + "4 weeks": "4 Wochen", + "12 weeks": "12 Wochen", + "6 months": "6 Monate", + "1 year": "1 Jahr", + "Completion rate": "Erfüllungsquote", + "Monthly completion rate": "Monatliche Erfüllungsquote", + "Daily activity": "Tägliche Aktivität", + "Week of {date}": "Woche vom {date}", + "Since {date} · right-click to resume": + "Seit {date} · Rechtsklick zum Fortsetzen", + "Paused on this day": "An diesem Tag pausiert", + "Mark as done": "Als erledigt markieren", + "Mark as not done": "Als nicht erledigt markieren", + Done: "Erledigt", + "Not done": "Offen", + "Edit value": "Wert bearbeiten", + Value: "Wert", + "Decrease by 1": "Um 1 verringern", + "Increase by 1": "Um 1 erhöhen", + "Increase by {n}": "Um {n} erhöhen", + "Edit habit": "Gewohnheit bearbeiten", + "Pause habit": "Gewohnheit pausieren", + "Resume habit": "Gewohnheit fortsetzen", + "Stop tracking": "Nicht mehr verfolgen", + "Remove habit": "Gewohnheit entfernen", + 'Stop tracking "{name}"? It leaves the dashboard and stats, but its note and full history are kept. You can resume tracking any time from the note\'s metrics view.': + '„{name}" nicht mehr verfolgen? Sie verschwindet aus dem Dashboard und den Statistiken, aber ihre Notiz und ihr gesamter Verlauf bleiben erhalten. Du kannst die Verfolgung jederzeit über die Metrik-Ansicht der Notiz fortsetzen.', + 'Remove "{name}"? Its note will be moved to the trash.': + '„{name}" entfernen? Ihre Notiz wird in den Papierkorb verschoben.', + Remove: "Entfernen", + "Perfect!": "Perfekt!", + Today: "Heute", + Yesterday: "Gestern", + Tomorrow: "Morgen", + "Last 7 days": "Letzte 7 Tage", + "Last 30 days": "Letzte 30 Tage", + "This week": "Diese Woche", + "This month": "Dieser Monat", + + // Sidebar panel + "Habits completed today": "Heute erledigte Gewohnheiten", + "No habits yet.": "Noch keine Gewohnheiten.", + "Click to type a value": "Klicken, um einen Wert einzugeben", + "Open note": "Notiz öffnen", + + // Stats view + "No habits to show stats for yet.": + "Noch keine Gewohnheiten für Statistiken vorhanden.", + Completion: "Erfüllung", + "Best streak": "Beste Serie", + "Perfect days": "Perfekte Tage", + Completions: "Erledigungen", + "Goals met": "Ziele erreicht", + "{completed}/{days} days": "{completed}/{days} Tage", + "{total} total": "{total} insgesamt", + best: "Rekord", + "perfect week": "perfekte Woche", + "perfect month": "perfekter Monat", + "weekly goal": "Wochenziel", + "monthly goal": "Monatsziel", + "{progress}/{goal} days · {label} · {pct}%": + "{progress}/{goal} Tage · {label} · {pct} %", + + // Habit metrics block + 'Place this block inside a habit note, or point it at one with "habit: ".': + 'Platziere diesen Block in einer Gewohnheitsnotiz oder verweise mit „habit: " auf eine.', + 'No habit called "{name}" was found.': + 'Keine Gewohnheit namens „{name}" gefunden.', + "No longer tracked since {date}. All history is kept.": + "Seit {date} nicht mehr verfolgt. Der gesamte Verlauf bleibt erhalten.", + "No longer tracked. All history is kept.": + "Nicht mehr verfolgt. Der gesamte Verlauf bleibt erhalten.", + "Resume tracking": "Verfolgung fortsetzen", + "Paused since {date}. Paused days don't count against streaks or stats.": + "Pausiert seit {date}. Pausierte Tage zählen weder gegen Serien noch gegen Statistiken.", + "Paused. Paused days don't count against streaks or stats.": + "Pausiert. Pausierte Tage zählen weder gegen Serien noch gegen Statistiken.", + "Current streak": "Aktuelle Serie", + "Days completed": "Erledigte Tage", + "30-day rate": "30-Tage-Quote", + "Weekly completion rate": "Wöchentliche Erfüllungsquote", + Logged: "Erfasst", + Target: "Ziel", + + // Export modal + Title: "Titel", + "Habits report": "Gewohnheiten-Bericht", + "Date range": "Zeitraum", + "Custom range": "Benutzerdefinierter Zeitraum", + From: "Von", + To: "Bis", + "Up to {n} days.": "Bis zu {n} Tage.", + Content: "Inhalt", + "Summary tiles": "Zusammenfassungs-Kacheln", + "Completion trend chart": "Trend-Diagramm der Erfüllung", + "Daily grids": "Tagesraster", + "Goal progress": "Zielfortschritt", + Layout: "Layout", + Orientation: "Ausrichtung", + Portrait: "Hochformat", + Landscape: "Querformat", + Density: "Dichte", + Comfortable: "Komfortabel", + Compact: "Kompakt", + Monochrome: "Monochrom", + "Ink-friendly greys instead of accent colours.": + "Tintensparende Grautöne statt Akzentfarben.", + "Export PDF": "PDF exportieren", + "No habits to export yet.": + "Noch keine Gewohnheiten zum Exportieren.", + 'Exported to "{path}" in your vault.': + 'Nach „{path}" in deinem Vault exportiert.', + + // Habit modal + "New habit": "Neue Gewohnheit", + Name: "Name", + Type: "Typ", + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes.": + "Binär ist erledigt oder nicht erledigt. Wiederholung zählt auf ein Ziel hin. Zeitbasiert erfasst Minuten.", + Binary: "Binär", + Repetition: "Wiederholung", + Timed: "Zeitbasiert", + "Daily target (minutes)": "Tagesziel (Minuten)", + "Daily target": "Tagesziel", + Unit: "Einheit", + "Optional label shown next to the count.": + "Optionale Beschriftung neben dem Zähler.", + Icon: "Symbol", + "Choose a Lucide icon or an emoji to represent this habit.": + "Wähle ein Lucide-Symbol oder ein Emoji für diese Gewohnheit.", + Emoji: "Emoji", + "Choose an emoji": "Emoji wählen", + "Clear icon": "Symbol entfernen", + "Choose icon": "Symbol wählen", + "Save changes": "Änderungen speichern", + "Targets (optional)": "Ziele (optional)", + "Set an optional weekly or monthly goal for how many days you complete this habit. For example, hitting your daily goal on all 7 days is a weekly target of 7. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "Lege optional ein Wochen- oder Monatsziel fest, an wie vielen Tagen du diese Gewohnheit erfüllst. Wer sein Tagesziel z. B. an allen 7 Tagen erreicht, hat ein Wochenziel von 7. Aktiviere einen Perfekt-Schalter, um automatisch jeden Tag des Zeitraums anzustreben, egal wie lang er ist.", + "Perfect week": "Perfekte Woche", + "Aim to complete this habit every day of the week.": + "Strebe an, diese Gewohnheit an jedem Tag der Woche zu erfüllen.", + "Weekly target": "Wochenziel", + "Optional. Days to complete per week (max 7).": + "Optional. Zu erfüllende Tage pro Woche (max. 7).", + None: "Keins", + "Perfect month": "Perfekter Monat", + "Aim to complete this habit every day of the month.": + "Strebe an, diese Gewohnheit an jedem Tag des Monats zu erfüllen.", + "Monthly target": "Monatsziel", + "Optional. Days to complete per month.": + "Optional. Zu erfüllende Tage pro Monat.", + Colour: "Farbe", + "Pick a colour from your theme, or choose a custom one.": + "Wähle eine Farbe aus deinem Theme oder eine eigene.", + "Your habit": "Deine Gewohnheit", + + // Icon and colour pickers + "Search icons…": "Symbole suchen…", + "Search emojis…": "Emojis suchen…", + + // Comments + "Comments on cards": "Kommentare auf Karten", + "Show a comment flap on dashboard cards for jotting a note about any day.": + "Zeigt eine Kommentarlasche auf den Dashboard-Karten, um Notizen zu einzelnen Tagen festzuhalten.", + "Add comment": "Kommentar hinzufügen", + "Flip back": "Zurückdrehen", + "Edit comment": "Kommentar bearbeiten", + "Move day comments into note bodies": + "Tageskommentare in Notiztexte verschieben", + "No comments left to move.": + "Keine Kommentare mehr zu verschieben.", + "Moved comments in 1 note.": "Kommentare in 1 Notiz verschoben.", + "Moved comments in {n} notes.": + "Kommentare in {n} Notizen verschoben.", + "Add a comment for this day…": "Füge einen Kommentar für diesen Tag hinzu…", + Comments: "Kommentare", + + // Limit habits (experimental) + Experimental: "Experimentell", + "These features are still being tested and may change before they become permanent. Turning one off only hides it from menus — anything you created with it keeps working.": + "Diese Funktionen werden noch getestet und können sich ändern, bevor sie dauerhaft werden. Das Ausschalten blendet sie nur aus den Menüs aus — alles, was du damit erstellt hast, funktioniert weiter.", + "Break bad habits": "Schlechte Gewohnheiten ablegen", + "Track habits you want to reduce or avoid by staying under a daily limit — for example at most 2 hours of gaming, or no smoking at all.": + "Verfolge Gewohnheiten, die du reduzieren oder vermeiden möchtest, indem du unter einem Tageslimit bleibst — zum Beispiel höchstens 2 Stunden Gaming oder gar nicht rauchen.", + Goal: "Ziel", + "Reach a target for habits you are building. Stay under a limit for habits you are cutting down or giving up.": + "Erreiche ein Ziel bei Gewohnheiten, die du aufbaust. Bleibe unter einem Limit bei Gewohnheiten, die du reduzierst oder aufgibst.", + "Reach a target": "Ein Ziel erreichen", + "Stay under a limit": "Unter einem Limit bleiben", + "Binary means avoiding it entirely. Repetition counts against a daily limit. Timed tracks minutes against a daily limit.": + "Binär bedeutet, es ganz zu vermeiden. Wiederholung zählt gegen ein Tageslimit. Zeit misst Minuten gegen ein Tageslimit.", + "Daily limit": "Tageslimit", + "Daily limit (minutes)": "Tageslimit (Minuten)", + "0 means none at all.": "0 bedeutet gar nicht.", + "Set an optional weekly or monthly goal for how many days you stay within your limit. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "Lege ein optionales Wochen- oder Monatsziel fest, an wie vielen Tagen du innerhalb deines Limits bleibst. Aktiviere einen Perfekt-Schalter, um automatisch jeden Tag des Zeitraums anzustreben, egal wie lang er ist.", + Clean: "Sauber", + Slipped: "Ausgerutscht", + "Mark as clean": "Als sauber markieren", + "Mark as slipped": "Als ausgerutscht markieren", + "Days within limit": "Tage im Limit", + Limit: "Limit", + + // Frequencies and per-note metrics + Frequency: "Häufigkeit", + Daily: "Täglich", + "Days of week": "Wochentage", + Habit: "Gewohnheit", + Schedule: "Zeitplan", + "Time of day": "Uhrzeit", + "Optional times this habit is planned for — once or several times a day. Shown on the habit's card.": + "Optionale Uhrzeiten, zu denen diese Gewohnheit geplant ist — einmal oder mehrmals täglich. Werden auf der Karte der Gewohnheit angezeigt.", + "Add time": "Uhrzeit hinzufügen", + "Remove time": "Uhrzeit entfernen", + "Every N days": "Alle N Tage", + "Repeat every": "Wiederholen alle", + "Day of month": "Tag des Monats", + "The weekdays this habit is due on. Pick as many as you need.": + "Die Wochentage, an denen diese Gewohnheit fällig ist. Wähle so viele wie nötig.", + "Number of days between due dates, counted from the habit's start date. Use 2 for an alternate-day schedule.": + "Anzahl der Tage zwischen den Fälligkeiten, gezählt ab dem Startdatum der Gewohnheit. 2 ergibt einen Rhythmus von jedem zweiten Tag.", + "The day of the month this habit is due. In shorter months it falls due on the last day, so 31 always lands on the final day of the month.": + "Der Tag des Monats, an dem diese Gewohnheit fällig ist. In kürzeren Monaten fällt sie auf den letzten Tag, sodass 31 immer auf den letzten Tag des Monats fällt.", + "Every {day}": "Jeden {day}", + "Monthly · day {day}": "Monatlich · Tag {day}", + "Every other day": "Jeden zweiten Tag", + "Every {n} days": "Alle {n} Tage", + "No habits are due on this day.": + "An diesem Tag sind keine Gewohnheiten fällig.", + "Nothing due today.": "Heute ist nichts fällig.", + "Weekly activity": "Wöchentliche Aktivität", + "Monthly activity": "Monatliche Aktivität", + "Activity on due days": "Aktivität an Fälligkeitstagen", + "Completion rate over {n} due days": + "Erfolgsquote über {n} Fälligkeitstage", + "Weeks completed": "Abgeschlossene Wochen", + "Months completed": "Abgeschlossene Monate", + "Recent rate": "Aktuelle Quote", + "{n}-week completion rate": "Erfüllungsquote über {n} Wochen", + "{n}-month completion rate": "Erfüllungsquote über {n} Monate", + + // AI summaries + "AI summaries": "KI-Zusammenfassungen", + "AI summary": "KI-Zusammenfassung", + "Show an AI-generated summary with feedback and advice on the stats page tabs. Uses an OpenAI-compatible service you configure below; your habit stats are sent to it only when you press the generate button.": + "Zeigt eine KI-generierte Zusammenfassung mit Feedback und Tipps auf den Tabs der Statistik-Seite. Verwendet einen OpenAI-kompatiblen Dienst, den du unten konfigurierst; deine Gewohnheits-Statistiken werden erst gesendet, wenn du den Erstellen-Button drückst.", + "AI base URL": "KI-Basis-URL", + "Base URL of an OpenAI-compatible API. Works with OpenAI, OpenRouter, or local servers like Ollama (http://localhost:11434/v1).": + "Basis-URL einer OpenAI-kompatiblen API. Funktioniert mit OpenAI, OpenRouter oder lokalen Servern wie Ollama (http://localhost:11434/v1).", + "AI API key": "KI-API-Schlüssel", + "Stored locally in this vault's plugin data. Leave blank for local servers that need no key.": + "Wird lokal in den Plugin-Daten dieses Vaults gespeichert. Für lokale Server ohne Schlüssel leer lassen.", + "AI model": "KI-Modell", + "Model name the service should use.": + "Name des Modells, das der Dienst verwenden soll.", + "Generate summary": "Zusammenfassung erstellen", + Regenerate: "Neu erstellen", + "Get feedback and advice on your habits for this period. Your stats are sent to the AI service you configured only when you press the button.": + "Erhalte Feedback und Tipps zu deinen Gewohnheiten in diesem Zeitraum. Deine Statistiken werden erst an den konfigurierten KI-Dienst gesendet, wenn du den Button drückst.", + "Thinking…": "Denkt nach …", + "Could not generate a summary: {message}": + "Zusammenfassung konnte nicht erstellt werden: {message}", + "Adds an AI-generated overview with feedback and advice. Your habit stats are sent to your configured AI service.": + "Fügt einen KI-generierten Überblick mit Feedback und Tipps hinzu. Deine Gewohnheits-Statistiken werden an den konfigurierten KI-Dienst gesendet.", + "Generating AI summary…": "KI-Zusammenfassung wird erstellt …", + "The AI summary will be generated when you export.": + "Die KI-Zusammenfassung wird beim Exportieren erstellt.", + + // Custom stats range + Custom: "Benutzerdefiniert", + "Start date": "Startdatum", + "End date": "Enddatum", + + // Heatmap start markers + "not tracked yet": "noch nicht erfasst", + "started tracking on {date}": "Erfassung ab {date}", + + // Stats carousel + "Stats rows per page": "Statistik-Zeilen pro Seite", + "How many habits each stats page shows.": + "Wie viele Gewohnheiten jede Statistik-Seite anzeigt.", + // Note habits + '"{name}" uses Templater syntax, but the Templater plugin is not installed — the template was copied as plain text.': + '„{name}" verwendet Templater-Syntax, aber das Templater-Plugin ist nicht installiert — die Vorlage wurde als reiner Text kopiert.', + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes. Note is completed by writing in a per-day note.": + "Binär ist erledigt oder nicht erledigt. Wiederholung zählt auf ein Ziel hin. Zeitbasiert erfasst Minuten. Notiz wird durch Schreiben in eine Tagesnotiz abgeschlossen.", + "Character count is reached": "Eine Zeichenzahl wird erreicht", + "Character goal": "Zeichenziel", + "Completed when": "Abgeschlossen, wenn", + "Every task is checked": "Alle Aufgaben sind abgehakt", + "Filename format": "Dateinamenformat", + "Folder each day's note is created in. Leave blank for a dedicated subfolder named after this habit.": + "Ordner, in dem die Notiz jedes Tages erstellt wird. Leer lassen für einen eigenen Unterordner mit dem Namen dieser Gewohnheit.", + "Moment.js format used to name each day's note, e.g. {example}. May include / for date-based subfolders.": + "Moment.js-Format zur Benennung der Notiz jedes Tages, z. B. {example}. Kann / für datumsbasierte Unterordner enthalten.", + Note: "Notiz", + "Note habits": "Notiz-Gewohnheiten", + "Notes folder": "Notizordner", + "Open this day's note": "Notiz dieses Tages öffnen", + "Open today's note": "Heutige Notiz öffnen", + "Optional template note used when a day's note is created. Expanded through the Templater plugin when it is installed, otherwise copied as plain text.": + "Optionale Vorlagennotiz, die beim Erstellen der Notiz eines Tages verwendet wird. Wird über das Templater-Plugin erweitert, wenn es installiert ist, andernfalls als reiner Text kopiert.", + Template: "Vorlage", + "Track a habit by writing in a per-day note instead of logging a value by hand. A day is complete once the note reaches a character count or every task in it is checked. Works with the Templater plugin to create each day's note from a template.": + "Verfolge eine Gewohnheit, indem du in eine Tagesnotiz schreibst, statt von Hand einen Wert einzutragen. Ein Tag ist abgeschlossen, sobald die Notiz eine Zeichenzahl erreicht oder alle ihre Aufgaben abgehakt sind. Funktioniert mit dem Templater-Plugin, um die Notiz jedes Tages aus einer Vorlage zu erstellen.", + Write: "Schreiben", + "Write this day's note": "Notiz dieses Tages schreiben", + "Write today's note": "Heutige Notiz schreiben", + "e.g. Journal": "z. B. Journal", + "e.g. Templates/Journal.md": "z. B. Templates/Journal.md", + + // Flexible frequency (any day) + "How many times (or, for counted and timed habits, how much in total) this needs to happen somewhere in the period.": + "Wie oft (oder, bei gezählten oder zeitbasierten Gewohnheiten, wie viel insgesamt) dies irgendwann im Zeitraum geschehen muss.", + 'How often this habit is due. Weekly and monthly habits only appear on their due date; the "any day" options appear every day until their quota is met.': + 'Wie oft diese Gewohnheit fällig ist. Wöchentliche und monatliche Gewohnheiten erscheinen nur an ihrem Fälligkeitstag; die Optionen „an beliebigem Tag" erscheinen jeden Tag, bis das Kontingent erreicht ist.', + "Monthly (any day)": "Monatlich (beliebiger Tag)", + "Times per month": "Mal pro Monat", + "Times per week": "Mal pro Woche", + "Weekly (any day)": "Wöchentlich (beliebiger Tag)", + "this month": "diesen Monat", + "this week": "diese Woche", + "{completed}/{days} months": "{completed}/{days} Monate", + "{completed}/{days} weeks": "{completed}/{days} Wochen", + "{n}× a month · any day": "{n}× im Monat · beliebiger Tag", + "{n}× a week · any day": "{n}× in der Woche · beliebiger Tag", + + // Commands + "Insert habits heatmap": "Gewohnheiten-Heatmap einfügen", + + // Habit metrics: heatmap tabs + Charts: "Diagramme", + Month: "Monat", + History: "Verlauf", + "{month} heatmap": "Heatmap für {month}", + "Last {n} weeks": "Letzte {n} Wochen", + + // Heatmap cell states and tooltips + Upcoming: "Bevorstehend", + "Not tracked yet": "Noch nicht erfasst", + "Not due": "Nicht fällig", + "Outside this month": "Außerhalb dieses Monats", + Complete: "Abgeschlossen", + "Over limit": "Über dem Limit", + "Not logged": "Nicht erfasst", + + // Whole-vault heatmap block + "Add a habit to see its heatmap here.": + "Füge eine Gewohnheit hinzu, um hier ihre Heatmap zu sehen.", + "No habits in the \"{group}\" group.": + 'Keine Gewohnheiten in der Gruppe „{group}".', + "No habits due": "Keine Gewohnheiten fällig", + "Perfect day": "Perfekter Tag", + "{completed}/{considered} habits · {pct}%": + "{completed}/{considered} Gewohnheiten · {pct} %", + "This year": "Dieses Jahr", + "Past 6 months": "Letzte 6 Monate", + "{year} heatmap": "Heatmap für {year}", + + // Note habits: checklist requirement and fail keyword + "Both are true": "Beide zutreffend", + "Checklist requirement is met": "Checklisten-Anforderung ist erfüllt", + "Checklist requirement": "Checklisten-Anforderung", + "Require every task to be checked, or just some — useful for a list of alternatives where doing any one of them counts (e.g. \"Cardio\" / \"Weights\" / \"Rest day\").": + 'Verlange, dass alle Aufgaben abgehakt werden, oder nur einige – nützlich für eine Liste von Alternativen, bei der irgendeine davon zählt (z. B. „Cardio" / „Krafttraining" / „Ruhetag").', + "At least this many are checked": "Mindestens so viele sind abgehakt", + "Tasks required": "Erforderliche Aufgaben", + "Fail keyword": "Fehlschlag-Schlüsselwort", + "Optional. Checking a task whose text contains this word forces the day to fail, whatever else is checked — e.g. \"Slipped\" as one of several checklist options. Leave blank to turn this off.": + 'Optional. Wird eine Aufgabe abgehakt, deren Text dieses Wort enthält, gilt der Tag als gescheitert, egal was sonst abgehakt ist — zum Beispiel „Ausgerutscht" als eine von mehreren Checklisten-Optionen. Leer lassen, um dies auszuschalten.', + "e.g. Slipped": "z. B. Ausgerutscht", + "Reach a character count, meet a checklist requirement, or require both.": + "Erreiche eine Zeichenanzahl, erfülle eine Checklisten-Anforderung oder verlange beides.", + + // Tags (cross-plugin compatibility) + Tags: "Tags", + "e.g. task": "z. B. task", + "Optional Obsidian tags for this note, separated by commas or spaces. Useful for making this habit recognisable to another plugin's own tag-based rules — for example TaskNotes' task tag.": + 'Optionale Obsidian-Tags für diese Notiz, getrennt durch Kommas oder Leerzeichen. Nützlich, damit diese Gewohnheit von den eigenen Tag-Regeln eines anderen Plugins erkannt wird — zum Beispiel dem „task"-Tag von TaskNotes.', + + // Advanced settings: frontmatter key remapping + Advanced: "Erweitert", + Apply: "Anwenden", + "Apply key changes": "Schlüsseländerungen anwenden", + "Rename the frontmatter properties habit notes use. Useful for avoiding collisions with another plugin's own properties in the same note (for example TaskNotes).": + "Benenne die Frontmatter-Eigenschaften um, die Gewohnheitsnotizen verwenden. Nützlich, um Kollisionen mit den eigenen Eigenschaften eines anderen Plugins in derselben Notiz zu vermeiden (zum Beispiel TaskNotes).", + "\"{a}\" and \"{b}\" can't use the same property key (\"{value}\").": + '„{a}" und „{b}" können nicht denselben Eigenschaftsschlüssel verwenden („{value}").', + "Property keys can't be empty.": + "Eigenschaftsschlüssel dürfen nicht leer sein.", + "This renames {summary} in every note in your habits folder ({count} habit(s) currently). Existing values are moved, not discarded. Continue?": + "Dies benennt {summary} in jeder Notiz in deinem Gewohnheitsordner um (aktuell {count} Gewohnheit(en)). Vorhandene Werte werden verschoben, nicht verworfen. Fortfahren?", + "Updated the frontmatter keys in {count} note(s).": + "Frontmatter-Schlüssel in {count} Notiz(en) aktualisiert.", + "Renaming this away from the default also changes how binary habits log a day: instead of {\"2026-08-25\": 1}, a completed day becomes a bare date, like [\"2026-08-25\"] — the shape TaskNotes uses for complete_instances. Repetition and timed habits are unaffected either way; they always need a value, never just a date.": + 'Wird dieser Schlüssel vom Standard abweichend umbenannt, ändert sich auch, wie binäre Gewohnheiten einen Tag protokollieren: Statt {"2026-08-25": 1} wird ein abgeschlossener Tag zu einem reinen Datum wie ["2026-08-25"] — dem Format, das TaskNotes für complete_instances verwendet. Wiederholungs- und Zeit-Gewohnheiten sind davon unabhängig nicht betroffen; sie benötigen immer einen Wert, nie nur ein Datum.', + Identity: "Identität", + Legacy: "Altlasten", + Lifecycle: "Lebenszyklus", + Presentation: "Darstellung", + "Note habit": "Notiz-Gewohnheit", + "Habit type key": "Gewohnheitstyp-Schlüssel", + "Completion records key": "Aufzeichnungsschlüssel", + "Frequency key": "Häufigkeitsschlüssel", + "Weekday key": "Wochentagsschlüssel", + "Month day key": "Monatstagsschlüssel", + "Interval days key": "Intervalltage-Schlüssel", + "Planned time key": "Schlüssel für die geplante Uhrzeit", + "Goal direction key": "Zielrichtungsschlüssel", + "Target key": "Zielschlüssel", + "Unit key": "Einheitenschlüssel", + "Step size key": "Schlüssel für die Schrittweite", + "Weekly target key": "Wochenzielschlüssel", + "Monthly target key": "Monatszielschlüssel", + "Weekly perfect key": "Schlüssel für die perfekte Woche", + "Monthly perfect key": "Schlüssel für den perfekten Monat", + "Start date key": "Startdatumsschlüssel", + "Pauses key": "Pausenschlüssel", + "Stopped key": "Schlüssel für den Stopp-Status", + "Stop date key": "Stoppdatumsschlüssel", + "Icon key": "Symbolschlüssel", + "Color key": "Farbschlüssel", + "Group key": "Gruppenschlüssel", + "Use group color key": 'Schlüssel für „Gruppenfarbe verwenden"', + "Note folder key": "Notizordnerschlüssel", + "Note filename format key": "Schlüssel für das Dateinamenformat der Notiz", + "Template path key": "Vorlagenpfadschlüssel", + "Note completion mode key": "Schlüssel für den Abschlussmodus der Notiz", + "Note checklist requirement key": "Schlüssel für die Checklisten-Anforderung", + "Note checklist minimum key": "Schlüssel für die Checklisten-Mindestanzahl", + "Note fail keyword key": "Schlüssel für das Fehlschlag-Schlüsselwort", + "Legacy comments key": "Schlüssel für alte Kommentare", + + // PDF export (read via docT() in export-modal.ts, which falls back to English for zh — jsPDF's built-in fonts can't render CJK) + "Completion trend": "Erfüllungstrend", + "(paused)": "(pausiert)", + "{rate}% · {total} · streak {current} (best {best})": + "{rate} % · {total} · Serie {current} (Rekord {best})", + "Goal: {completed}/{goal} days met": + "Ziel: {completed}/{goal} Tage erreicht", + "{range} · exported {date}": "{range} · exportiert am {date}", + "+{n} more": "+{n} weitere", + + // Back-dating a missed day + Back: "Zurück", + + // Rescheduling missed habits (experimental) + "1 missed habit": "1 verpasste Gewohnheit", + "Add a notification button to the dashboard and sidebar panel when a habit's been missed, opening a review of missed days you can move onto a different one (never a day that habit is already due, so nothing doubles up).": + "Fügt dem Dashboard und dem Seitenpanel eine Benachrichtigungsschaltfläche hinzu, sobald eine Gewohnheit verpasst wurde. Sie öffnet eine Übersicht der verpassten Tage, die du auf einen anderen Tag verschieben kannst (nie auf einen Tag, an dem die Gewohnheit ohnehin schon fällig ist, damit nichts doppelt gezählt wird).", + "Missed habits": "Verpasste Gewohnheiten", + "Move this missed day onto a different one": + "Diesen verpassten Tag auf einen anderen verschieben", + "Move to": "Verschieben auf", + "Nothing missed right now.": "Gerade nichts verpasst.", + "Pick a habit to move it onto a different day.": + "Wähle eine Gewohnheit, um sie auf einen anderen Tag zu verschieben.", + Reschedule: "Verschieben", + "Reschedule missed habits": "Verpasste Gewohnheiten verschieben", + "Rescheduled \"{name}\" to {date}.": '„{name}" wurde auf {date} verschoben.', + "Rescheduled from {date}": "Verschoben von {date}", + "Reschedules key": "Schlüssel für Verschiebungen", + "Failed days key": "Schlüssel für fehlgeschlagene Tage", + "Skipped days key": "Schlüssel für übersprungene Tage", + "Rescheduling \"{name}\" — missed {date}.": + '„{name}" verschieben — verpasst am {date}.', + "That day no longer works — pick another.": + "Dieser Tag funktioniert nicht mehr — wähle einen anderen.", + "That day won't work — it's either already due for this habit or already claimed by another reschedule.": + "Dieser Tag geht nicht — entweder ist die Gewohnheit an diesem Tag bereits fällig, oder er ist schon durch eine andere Verschiebung belegt.", + "{count} missed habits": "{count} verpasste Gewohnheiten", +}; diff --git a/src/integrations/habits/i18n/es.ts b/src/integrations/habits/i18n/es.ts new file mode 100644 index 000000000..46fabc298 --- /dev/null +++ b/src/integrations/habits/i18n/es.ts @@ -0,0 +1,652 @@ +/** Spanish translations, keyed by the English source string. */ +export const es: Record = { + // Commands and ribbon + "Create habit": "Crear hábito", + "Insert dashboard": "Insertar panel de hábitos", + "Insert habit metrics": "Insertar métricas de hábito", + "Insert habits table": "Insertar tabla de hábitos", + "Open panel": "Abrir panel", + "Open habits panel": "Abrir el panel de hábitos", + Habits: "Hábitos", + + // Settings + "Habits folder": "Carpeta de hábitos", + "Folder where each habit is stored as its own note. It is created automatically if it does not exist.": + "Carpeta donde cada hábito se guarda como una nota propia. Se crea automáticamente si no existe.", + "Follow daily note date": "Seguir la fecha de la nota diaria", + "When a dashboard is embedded in a daily note (a note whose name contains a date like 2026-07-01), open it on that note's date instead of today.": + "Cuando un panel está insertado en una nota diaria (una nota cuyo nombre contiene una fecha como 2026-07-01), se abre en la fecha de esa nota en lugar de hoy.", + "Daily note date format": "Formato de fecha de la nota diaria", + "Moment.js format used to read the date from a daily note's name, such as YYYY-MM-DD or YYYYMMDD.": + "Formato de Moment.js usado para leer la fecha del nombre de una nota diaria, por ejemplo YYYY-MM-DD o YYYYMMDD.", + + // Sorting + "Sort habits by": "Ordenar hábitos por", + "The base order of habit cards in the dashboard and side panel.": + "El orden base de las tarjetas de hábitos en el panel principal y el panel lateral.", + "Name (A–Z)": "Nombre (A–Z)", + Color: "Color", + "Last logged": "Último registro", + "Planned time": "Hora prevista", + Manual: "Manual", + "Manual order": "Orden manual", + "Drag the cards into the order you want. New habits join the end of the list.": + "Arrastra las tarjetas en el orden que quieras. Los hábitos nuevos se añaden al final de la lista.", + "Move completed cards to the end": + "Mover las tarjetas completadas al final", + "Completed habits drift to the end of the queue and paused ones park behind them. Turn this off to keep every card in its sorted position.": + "Los hábitos completados se desplazan al final de la cola y los pausados quedan detrás. Desactívalo para que cada tarjeta mantenga su posición ordenada.", + Group: "Grupo", + Ungrouped: "Sin grupo", + "Optional group used to build dashboard sections — for example an area of responsibility.": + "Grupo opcional para crear secciones en el panel — por ejemplo, un área de responsabilidad.", + "e.g. Health": "p. ej. Salud", + "Group color": "Color del grupo", + "Optional color shared by every habit in this group.": + "Color opcional compartido por todos los hábitos de este grupo.", + "Group icon": "Icono del grupo", + "Shown in the group lip on cards and in section headers.": + "Se muestra en la pestaña de grupo de las tarjetas y en los encabezados de sección.", + "Use group color for this card": + "Usar el color del grupo para esta tarjeta", + "Show this card in the group color instead of its own.": + "Muestra esta tarjeta con el color del grupo en lugar del suyo.", + General: "General", + Sorting: "Ordenación", + Groups: "Grupos", + "How to move through your habit cards: a paged carousel with arrows, a grid that wraps onto new rows, or a fixed-height grid that scrolls vertically. The stats page follows the same choice.": + "Cómo navegar por tus tarjetas de hábitos: un carrusel paginado con flechas, una cuadrícula que salta a nuevas filas o una cuadrícula de altura fija con desplazamiento vertical. La página de estadísticas sigue la misma elección.", + "Enable groups": "Activar grupos", + "Show habits in sections by their group, with a group lip on each card.": + "Muestra los hábitos en secciones según su grupo, con una pestaña de grupo en cada tarjeta.", + "Group order": "Orden de los grupos", + "Drag the groups into the order you want. Sections follow the same order.": + "Arrastra los grupos en el orden que quieras. Las secciones siguen el mismo orden.", + "Completion animations": "Animaciones de finalización", + "Play the check swoosh, card departure, and perfect-day confetti when habits are completed. Turn off for instant, quiet updates.": + "Reproduce el swoosh de la marca, la salida de la tarjeta y el confeti del día perfecto al completar hábitos. Desactívalo para actualizaciones instantáneas y silenciosas.", + "Reminders": "Recordatorios", + "Write reminders for due habits": + "Escribir recordatorios para hábitos pendientes", + "Each day, write one reminder checklist line per planned time of every habit due that day, in the format the Reminder plugin picks up. The lines live in a marked block and refresh as you log habits.": + "Cada día escribe una línea de recordatorio por cada hora prevista de cada hábito que toque ese día, en el formato que reconoce el plugin Reminder. Las líneas viven en un bloque marcado y se actualizan al registrar hábitos.", + "Where to write reminders": "Dónde escribir los recordatorios", + "The daily note follows the Daily notes core plugin's folder and date format; the block is added once the note exists. A fixed note is created automatically.": + "La nota diaria sigue la carpeta y el formato de fecha del plugin básico de notas diarias; el bloque se añade cuando la nota existe. Una nota fija se crea automáticamente.", + "Today's daily note": "Nota diaria de hoy", + "A fixed note": "Una nota fija", + "Reminder note path": "Ruta de la nota de recordatorios", + "Vault path of the note that holds the reminder block.": + "Ruta en el vault de la nota que contiene el bloque de recordatorios.", + "Manage groups": "Gestionar grupos", + "See every habit by group and drag cards between groups.": + "Ve todos los hábitos por grupo y arrastra tarjetas entre grupos.", + Open: "Abrir", + "New group": "Nuevo grupo", + Add: "Añadir", + "Drag habits between groups to reassign them, or within a group to reorder them.": + "Arrastra hábitos entre grupos para reasignarlos, o dentro de un grupo para reordenarlos.", + "No habits": "Sin hábitos", + "Edit group style": "Editar estilo del grupo", + "Delete group": "Eliminar grupo", + 'Delete "{name}"? Its habits are kept and become ungrouped.': + '¿Eliminar "{name}"? Sus hábitos se conservan y quedan sin grupo.', + Delete: "Eliminar", + "Dashboard layout": "Diseño del panel", + Carousel: "Carrusel", + Grid: "Cuadrícula", + "Vertical scroll": "Desplazamiento vertical", + "Cards per view": "Tarjetas por vista", + "How many habit cards fit side by side on wider screens.": + "Cuántas tarjetas de hábitos caben una junto a otra en pantallas anchas.", + "Cards per view on mobile": "Tarjetas por vista en el móvil", + "How many habit cards fit side by side on phone-sized screens.": + "Cuántas tarjetas de hábitos caben una junto a otra en pantallas de móvil.", + + // Confirm dialog defaults + Cancel: "Cancelar", + Confirm: "Confirmar", + + // Store notices + 'Could not find the note for "{name}".': + 'No se encontró la nota de "{name}".', + "Please enter a valid habit name.": + "Introduce un nombre de hábito válido.", + 'A habit called "{name}" already exists.': + 'Ya existe un hábito llamado "{name}".', + 'Created habit "{name}".': 'Hábito "{name}" creado.', + 'Updated "{name}".': '"{name}" actualizado.', + 'Paused "{name}".': '"{name}" pausado.', + 'Resumed "{name}".': '"{name}" reanudado.', + 'Stopped tracking "{name}". Its history is kept in the note.': + 'Se dejó de seguir "{name}". Su historial se conserva en la nota.', + 'Resumed tracking "{name}".': 'Se reanudó el seguimiento de "{name}".', + 'Removed "{name}".': '"{name}" eliminado.', + "Habit added to the dashboard.": "Hábito añadido al panel.", + + // Dashboard + "Back to habits": "Volver a los hábitos", + "View stats": "Ver estadísticas", + "Export stats": "Exportar estadísticas", + Weekly: "Semanal", + Monthly: "Mensual", + "Previous day": "Día anterior", + "Next day": "Día siguiente", + "Choose a date": "Elegir una fecha", + "Add habit": "Añadir hábito", + "No habits yet. Create your first habit to get started.": + "Aún no hay hábitos. Crea tu primer hábito para empezar.", + Previous: "Anterior", + Next: "Siguiente", + "Go to position {n}": "Ir a la posición {n}", + "Right-click or long-press for more options": + "Clic derecho o pulsación larga para más opciones", + "Open habit note": "Abrir la nota del hábito", + "Open the note for {name}": "Abrir la nota de {name}", + Paused: "Pausado", + Stopped: "Detenido", + "Failed": "Fallado", + "Skipped": "Omitido", + "Snoozed": "Pospuesto", + "Snoozed until {time}": "Pospuesto hasta las {time}", + "Undo fail": "Deshacer fallo", + "Undo skip": "Deshacer omisión", + "End snooze": "Terminar posposición", + "Fail for today": "Fallar por hoy", + "Fail this day": "Fallar este día", + "Marked \"{name}\" as failed.": "«{name}» marcado como fallado.", + "Skip for today": "Omitir por hoy", + "Skip this day": "Omitir este día", + "Skipped \"{name}\".": "«{name}» omitido.", + "Snooze…": "Posponer…", + "Snooze \"{name}\"": "Posponer «{name}»", + "It leaves today's lists and comes back on its own. Snoozing never counts for or against the habit.": "Sale de las listas de hoy y vuelve por sí solo. Posponer nunca cuenta a favor ni en contra del hábito.", + "Snooze for": "Posponer durante", + "30 minutes": "30 minutos", + "1 hour": "1 hora", + "3 hours": "3 horas", + "Snooze until": "Posponer hasta", + "Snooze": "Posponer", + "Pick a time later today.": "Elige una hora posterior de hoy.", + "Snoozed \"{name}\" until {time}.": "«{name}» pospuesto hasta las {time}.", + "1 hidden for today": "1 oculto por hoy", + "{count} hidden for today": "{count} ocultos por hoy", + "1 hidden for this day": "1 oculto en este día", + "{count} hidden for this day": "{count} ocultos en este día", + "Undo": "Deshacer", + "Click to undo": "Haz clic para deshacer", + "Nothing left on this day's list.": "No queda nada en la lista de este día.", + "Nothing left on today's list.": "No queda nada en la lista de hoy.", + "At least: reach a target for habits you are building, like drinking 1.5 litres of water. At most: stay within a limit for habits you are cutting down, like no more than 2 coffees.": "Al menos: alcanza una meta en los hábitos que estás creando, como beber 1,5 litros de agua. Como máximo: no superes un límite en los hábitos que estás reduciendo, como no más de 2 cafés.", + "At least (reach a target)": "Al menos (alcanzar una meta)", + "At most (stay within a limit)": "Como máximo (no superar un límite)", + "Step size": "Tamaño del paso", + "How much each + and − press adds or removes. Use a decimal such as 0.25 for amounts like litres.": "Cuánto suma o resta cada pulsación de + y −. Usa un decimal como 0.25 para cantidades como litros.", + "Decrease by {n}": "Reducir en {n}", + "4 weeks": "4 semanas", + "12 weeks": "12 semanas", + "6 months": "6 meses", + "1 year": "1 año", + "Completion rate": "Tasa de cumplimiento", + "Monthly completion rate": "Tasa de cumplimiento mensual", + "Daily activity": "Actividad diaria", + "Week of {date}": "Semana del {date}", + "Since {date} · right-click to resume": + "Desde {date} · clic derecho para reanudar", + "Paused on this day": "Pausado en este día", + "Mark as done": "Marcar como hecho", + "Mark as not done": "Marcar como no hecho", + Done: "Hecho", + "Not done": "Pendiente", + "Edit value": "Editar valor", + Value: "Valor", + "Decrease by 1": "Reducir en 1", + "Increase by 1": "Aumentar en 1", + "Increase by {n}": "Aumentar en {n}", + "Edit habit": "Editar hábito", + "Pause habit": "Pausar hábito", + "Resume habit": "Reanudar hábito", + "Stop tracking": "Dejar de seguir", + "Remove habit": "Eliminar hábito", + 'Stop tracking "{name}"? It leaves the dashboard and stats, but its note and full history are kept. You can resume tracking any time from the note\'s metrics view.': + '¿Dejar de seguir "{name}"? Desaparece del panel y de las estadísticas, pero su nota y todo su historial se conservan. Puedes reanudar el seguimiento en cualquier momento desde la vista de métricas de la nota.', + 'Remove "{name}"? Its note will be moved to the trash.': + '¿Eliminar "{name}"? Su nota se moverá a la papelera.', + Remove: "Eliminar", + "Perfect!": "¡Perfecto!", + Today: "Hoy", + Yesterday: "Ayer", + Tomorrow: "Mañana", + "Last 7 days": "Últimos 7 días", + "Last 30 days": "Últimos 30 días", + "This week": "Esta semana", + "This month": "Este mes", + + // Sidebar panel + "Habits completed today": "Hábitos completados hoy", + "No habits yet.": "Aún no hay hábitos.", + "Click to type a value": "Haz clic para escribir un valor", + "Open note": "Abrir nota", + + // Stats view + "No habits to show stats for yet.": + "Aún no hay hábitos para mostrar estadísticas.", + Completion: "Cumplimiento", + "Best streak": "Mejor racha", + "Perfect days": "Días perfectos", + Completions: "Completados", + "Goals met": "Metas logradas", + "{completed}/{days} days": "{completed}/{days} días", + "{total} total": "{total} en total", + best: "mejor", + "perfect week": "semana perfecta", + "perfect month": "mes perfecto", + "weekly goal": "meta semanal", + "monthly goal": "meta mensual", + "{progress}/{goal} days · {label} · {pct}%": + "{progress}/{goal} días · {label} · {pct}%", + + // Habit metrics block + 'Place this block inside a habit note, or point it at one with "habit: ".': + 'Coloca este bloque dentro de una nota de hábito, o indícale uno con "habit: ".', + 'No habit called "{name}" was found.': + 'No se encontró ningún hábito llamado "{name}".', + "No longer tracked since {date}. All history is kept.": + "Sin seguimiento desde {date}. Todo el historial se conserva.", + "No longer tracked. All history is kept.": + "Sin seguimiento. Todo el historial se conserva.", + "Resume tracking": "Reanudar seguimiento", + "Paused since {date}. Paused days don't count against streaks or stats.": + "Pausado desde {date}. Los días en pausa no afectan a las rachas ni a las estadísticas.", + "Paused. Paused days don't count against streaks or stats.": + "Pausado. Los días en pausa no afectan a las rachas ni a las estadísticas.", + "Current streak": "Racha actual", + "Days completed": "Días completados", + "30-day rate": "Tasa de 30 días", + "Weekly completion rate": "Tasa de cumplimiento semanal", + Logged: "Registrado", + Target: "Objetivo", + + // Export modal + Title: "Título", + "Habits report": "Informe de hábitos", + "Date range": "Rango de fechas", + "Custom range": "Rango personalizado", + From: "Desde", + To: "Hasta", + "Up to {n} days.": "Hasta {n} días.", + Content: "Contenido", + "Summary tiles": "Mosaicos de resumen", + "Completion trend chart": "Gráfico de tendencia de cumplimiento", + "Daily grids": "Cuadrículas diarias", + "Goal progress": "Progreso de metas", + Layout: "Diseño", + Orientation: "Orientación", + Portrait: "Vertical", + Landscape: "Horizontal", + Density: "Densidad", + Comfortable: "Cómodo", + Compact: "Compacto", + Monochrome: "Monocromo", + "Ink-friendly greys instead of accent colours.": + "Grises que ahorran tinta en lugar de colores de acento.", + "Export PDF": "Exportar PDF", + "No habits to export yet.": "Aún no hay hábitos para exportar.", + 'Exported to "{path}" in your vault.': + 'Exportado a "{path}" en tu bóveda.', + + // Habit modal + "New habit": "Nuevo hábito", + Name: "Nombre", + Type: "Tipo", + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes.": + "Binario es hecho o no hecho. Repetición cuenta hacia un objetivo. Temporizado registra minutos.", + Binary: "Binario", + Repetition: "Repetición", + Timed: "Temporizado", + "Daily target (minutes)": "Objetivo diario (minutos)", + "Daily target": "Objetivo diario", + Unit: "Unidad", + "Optional label shown next to the count.": + "Etiqueta opcional que se muestra junto al recuento.", + Icon: "Icono", + "Choose a Lucide icon or an emoji to represent this habit.": + "Elige un icono de Lucide o un emoji para representar este hábito.", + Emoji: "Emoji", + "Choose an emoji": "Elegir un emoji", + "Clear icon": "Quitar icono", + "Choose icon": "Elegir icono", + "Save changes": "Guardar cambios", + "Targets (optional)": "Metas (opcional)", + "Set an optional weekly or monthly goal for how many days you complete this habit. For example, hitting your daily goal on all 7 days is a weekly target of 7. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "Establece una meta semanal o mensual opcional de cuántos días completas este hábito. Por ejemplo, lograr tu objetivo diario los 7 días es una meta semanal de 7. Activa un interruptor de perfección para aspirar automáticamente a todos los días del período, sea cual sea su duración.", + "Perfect week": "Semana perfecta", + "Aim to complete this habit every day of the week.": + "Aspira a completar este hábito todos los días de la semana.", + "Weekly target": "Meta semanal", + "Optional. Days to complete per week (max 7).": + "Opcional. Días a completar por semana (máx. 7).", + None: "Ninguno", + "Perfect month": "Mes perfecto", + "Aim to complete this habit every day of the month.": + "Aspira a completar este hábito todos los días del mes.", + "Monthly target": "Meta mensual", + "Optional. Days to complete per month.": + "Opcional. Días a completar por mes.", + Colour: "Color", + "Pick a colour from your theme, or choose a custom one.": + "Elige un color de tu tema o escoge uno personalizado.", + "Your habit": "Tu hábito", + + // Icon and colour pickers + "Search icons…": "Buscar iconos…", + "Search emojis…": "Buscar emojis…", + + // Comments + "Comments on cards": "Comentarios en las tarjetas", + "Show a comment flap on dashboard cards for jotting a note about any day.": + "Muestra una pestaña de comentarios en las tarjetas del panel para anotar cualquier día.", + "Add comment": "Añadir comentario", + "Flip back": "Volver a girar", + "Edit comment": "Editar comentario", + "Move day comments into note bodies": + "Mover los comentarios diarios al cuerpo de las notas", + "No comments left to move.": "No quedan comentarios por mover.", + "Moved comments in 1 note.": "Comentarios movidos en 1 nota.", + "Moved comments in {n} notes.": + "Comentarios movidos en {n} notas.", + "Add a comment for this day…": "Añade un comentario para este día…", + Comments: "Comentarios", + + // Limit habits (experimental) + Experimental: "Experimental", + "These features are still being tested and may change before they become permanent. Turning one off only hides it from menus — anything you created with it keeps working.": + "Estas funciones aún se están probando y pueden cambiar antes de ser permanentes. Desactivarlas solo las oculta de los menús: todo lo que hayas creado con ellas sigue funcionando.", + "Break bad habits": "Romper malos hábitos", + "Track habits you want to reduce or avoid by staying under a daily limit — for example at most 2 hours of gaming, or no smoking at all.": + "Controla hábitos que quieres reducir o evitar manteniéndote por debajo de un límite diario — por ejemplo, como máximo 2 horas de videojuegos, o no fumar en absoluto.", + Goal: "Objetivo", + "Reach a target for habits you are building. Stay under a limit for habits you are cutting down or giving up.": + "Alcanza una meta para hábitos que estás construyendo. Mantente bajo un límite para hábitos que estás reduciendo o dejando.", + "Reach a target": "Alcanzar una meta", + "Stay under a limit": "Mantenerse bajo un límite", + "Binary means avoiding it entirely. Repetition counts against a daily limit. Timed tracks minutes against a daily limit.": + "Binario significa evitarlo por completo. Repetición cuenta contra un límite diario. Cronometrado mide minutos contra un límite diario.", + "Daily limit": "Límite diario", + "Daily limit (minutes)": "Límite diario (minutos)", + "0 means none at all.": "0 significa nada en absoluto.", + "Set an optional weekly or monthly goal for how many days you stay within your limit. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "Establece una meta semanal o mensual opcional de cuántos días te mantienes dentro de tu límite. Activa un interruptor de perfección para aspirar automáticamente a todos los días del período, sea cual sea su duración.", + Clean: "Limpio", + Slipped: "Recaída", + "Mark as clean": "Marcar como limpio", + "Mark as slipped": "Marcar como recaída", + "Days within limit": "Días dentro del límite", + Limit: "Límite", + + // Frequencies and per-note metrics + Frequency: "Frecuencia", + Daily: "Diario", + "Days of week": "Días de la semana", + Habit: "Hábito", + Schedule: "Programación", + "Time of day": "Hora del día", + "Optional times this habit is planned for — once or several times a day. Shown on the habit's card.": + "Horas opcionales previstas para este hábito — una o varias veces al día. Se muestran en la tarjeta del hábito.", + "Add time": "Añadir hora", + "Remove time": "Quitar hora", + "Every N days": "Cada N días", + "Repeat every": "Repetir cada", + "Day of month": "Día del mes", + "The weekdays this habit is due on. Pick as many as you need.": + "Los días de la semana en que vence este hábito. Elige tantos como necesites.", + "Number of days between due dates, counted from the habit's start date. Use 2 for an alternate-day schedule.": + "Número de días entre vencimientos, contado desde la fecha de inicio del hábito. Usa 2 para un esquema de días alternos.", + "The day of the month this habit is due. In shorter months it falls due on the last day, so 31 always lands on the final day of the month.": + "El día del mes en que vence este hábito. En meses más cortos vence el último día, así que 31 siempre cae en el último día del mes.", + "Every {day}": "Cada {day}", + "Monthly · day {day}": "Mensual · día {day}", + "Every other day": "Cada dos días", + "Every {n} days": "Cada {n} días", + "No habits are due on this day.": "Ningún hábito vence este día.", + "Nothing due today.": "Nada vence hoy.", + "Weekly activity": "Actividad semanal", + "Monthly activity": "Actividad mensual", + "Activity on due days": "Actividad en días de vencimiento", + "Completion rate over {n} due days": + "Tasa de cumplimiento en {n} días de vencimiento", + "Weeks completed": "Semanas completadas", + "Months completed": "Meses completados", + "Recent rate": "Tasa reciente", + "{n}-week completion rate": "Tasa de cumplimiento de {n} semanas", + "{n}-month completion rate": "Tasa de cumplimiento de {n} meses", + + // AI summaries + "AI summaries": "Resúmenes con IA", + "AI summary": "Resumen con IA", + "Show an AI-generated summary with feedback and advice on the stats page tabs. Uses an OpenAI-compatible service you configure below; your habit stats are sent to it only when you press the generate button.": + "Muestra un resumen generado por IA con comentarios y consejos en las pestañas de la página de estadísticas. Usa un servicio compatible con OpenAI que configuras abajo; tus estadísticas de hábitos se le envían solo cuando pulsas el botón de generar.", + "AI base URL": "URL base de IA", + "Base URL of an OpenAI-compatible API. Works with OpenAI, OpenRouter, or local servers like Ollama (http://localhost:11434/v1).": + "URL base de una API compatible con OpenAI. Funciona con OpenAI, OpenRouter o servidores locales como Ollama (http://localhost:11434/v1).", + "AI API key": "Clave de API de IA", + "Stored locally in this vault's plugin data. Leave blank for local servers that need no key.": + "Se guarda localmente en los datos del plugin de este vault. Déjala en blanco para servidores locales que no necesitan clave.", + "AI model": "Modelo de IA", + "Model name the service should use.": + "Nombre del modelo que debe usar el servicio.", + "Generate summary": "Generar resumen", + Regenerate: "Regenerar", + "Get feedback and advice on your habits for this period. Your stats are sent to the AI service you configured only when you press the button.": + "Recibe comentarios y consejos sobre tus hábitos en este período. Tus estadísticas se envían al servicio de IA que configuraste solo cuando pulsas el botón.", + "Thinking…": "Pensando…", + "Could not generate a summary: {message}": + "No se pudo generar el resumen: {message}", + "Adds an AI-generated overview with feedback and advice. Your habit stats are sent to your configured AI service.": + "Añade un resumen generado por IA con comentarios y consejos. Tus estadísticas de hábitos se envían al servicio de IA configurado.", + "Generating AI summary…": "Generando resumen con IA…", + "The AI summary will be generated when you export.": + "El resumen con IA se generará al exportar.", + + // Custom stats range + Custom: "Personalizado", + "Start date": "Fecha de inicio", + "End date": "Fecha de fin", + + // Heatmap start markers + "not tracked yet": "aún sin seguimiento", + "started tracking on {date}": "seguimiento iniciado el {date}", + + // Stats carousel + "Stats rows per page": "Filas de estadísticas por página", + "How many habits each stats page shows.": + "Cuántos hábitos muestra cada página de estadísticas.", + // Note habits + '"{name}" uses Templater syntax, but the Templater plugin is not installed — the template was copied as plain text.': + '"{name}" usa la sintaxis de Templater, pero el plugin Templater no está instalado — la plantilla se copió como texto sin formato.', + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes. Note is completed by writing in a per-day note.": + "Binario es hecho o no hecho. Repetición cuenta hacia un objetivo. Temporizado registra minutos. Nota se completa escribiendo en una nota diaria.", + "Character count is reached": "Se alcanza un número de caracteres", + "Character goal": "Meta de caracteres", + "Completed when": "Completado cuando", + "Every task is checked": "Se marcan todas las tareas", + "Filename format": "Formato del nombre de archivo", + "Folder each day's note is created in. Leave blank for a dedicated subfolder named after this habit.": + "Carpeta donde se crea la nota de cada día. Déjalo en blanco para usar una subcarpeta dedicada con el nombre de este hábito.", + "Moment.js format used to name each day's note, e.g. {example}. May include / for date-based subfolders.": + "Formato de Moment.js usado para nombrar la nota de cada día, p. ej. {example}. Puede incluir / para subcarpetas basadas en fechas.", + Note: "Nota", + "Note habits": "Hábitos de notas", + "Notes folder": "Carpeta de notas", + "Open this day's note": "Abrir la nota de este día", + "Open today's note": "Abrir la nota de hoy", + "Optional template note used when a day's note is created. Expanded through the Templater plugin when it is installed, otherwise copied as plain text.": + "Nota de plantilla opcional usada al crear la nota de un día. Se expande mediante el plugin Templater cuando está instalado; si no, se copia como texto sin formato.", + Template: "Plantilla", + "Track a habit by writing in a per-day note instead of logging a value by hand. A day is complete once the note reaches a character count or every task in it is checked. Works with the Templater plugin to create each day's note from a template.": + "Sigue un hábito escribiendo en una nota diaria en lugar de registrar un valor a mano. Un día se completa cuando la nota alcanza un número de caracteres o se marcan todas sus tareas. Funciona con el plugin Templater para crear la nota de cada día a partir de una plantilla.", + Write: "Escribir", + "Write this day's note": "Escribir la nota de este día", + "Write today's note": "Escribir la nota de hoy", + "e.g. Journal": "p. ej. Diario", + "e.g. Templates/Journal.md": "p. ej. Templates/Diario.md", + + // Flexible frequency (any day) + "How many times (or, for counted and timed habits, how much in total) this needs to happen somewhere in the period.": + "Cuántas veces (o, en hábitos contados o temporizados, cuánto en total) debe ocurrir esto en algún momento del período.", + 'How often this habit is due. Weekly and monthly habits only appear on their due date; the "any day" options appear every day until their quota is met.': + 'Con qué frecuencia vence este hábito. Los hábitos semanales y mensuales solo aparecen en su día de vencimiento; las opciones "cualquier día" aparecen todos los días hasta alcanzar su cuota.', + "Monthly (any day)": "Mensual (cualquier día)", + "Times per month": "Veces al mes", + "Times per week": "Veces a la semana", + "Weekly (any day)": "Semanal (cualquier día)", + "this month": "este mes", + "this week": "esta semana", + "{completed}/{days} months": "{completed}/{days} meses", + "{completed}/{days} weeks": "{completed}/{days} semanas", + "{n}× a month · any day": "{n}× al mes · cualquier día", + "{n}× a week · any day": "{n}× a la semana · cualquier día", + + // Commands + "Insert habits heatmap": "Insertar mapa de calor de hábitos", + + // Habit metrics: heatmap tabs + Charts: "Gráficos", + Month: "Mes", + History: "Historial", + "{month} heatmap": "Mapa de calor de {month}", + "Last {n} weeks": "Últimas {n} semanas", + + // Heatmap cell states and tooltips + Upcoming: "Próximo", + "Not tracked yet": "Aún sin seguimiento", + "Not due": "No vence", + "Outside this month": "Fuera de este mes", + Complete: "Completado", + "Over limit": "Por encima del límite", + "Not logged": "Sin registrar", + + // Whole-vault heatmap block + "Add a habit to see its heatmap here.": + "Añade un hábito para ver aquí su mapa de calor.", + "No habits in the \"{group}\" group.": 'No hay hábitos en el grupo "{group}".', + "No habits due": "No había hábitos previstos", + "Perfect day": "Día perfecto", + "{completed}/{considered} habits · {pct}%": + "{completed}/{considered} hábitos · {pct}%", + "This year": "Este año", + "Past 6 months": "Últimos 6 meses", + "{year} heatmap": "Mapa de calor de {year}", + + // Note habits: checklist requirement and fail keyword + "Both are true": "Se cumplen ambas", + "Checklist requirement is met": "Se cumple el requisito de la lista de tareas", + "Checklist requirement": "Requisito de la lista de tareas", + "Require every task to be checked, or just some — useful for a list of alternatives where doing any one of them counts (e.g. \"Cardio\" / \"Weights\" / \"Rest day\").": + 'Exige marcar todas las tareas, o solo algunas — útil para una lista de alternativas en la que hacer cualquiera de ellas cuenta (p. ej. "Cardio" / "Pesas" / "Día de descanso").', + "At least this many are checked": "Se marca al menos esta cantidad", + "Tasks required": "Tareas requeridas", + "Fail keyword": "Palabra clave de fallo", + "Optional. Checking a task whose text contains this word forces the day to fail, whatever else is checked — e.g. \"Slipped\" as one of several checklist options. Leave blank to turn this off.": + 'Opcional. Marcar una tarea cuyo texto contenga esta palabra obliga a que el día falle, sea lo que sea lo demás que esté marcado — por ejemplo, "Fallé" como una más de las opciones de la lista. Déjalo en blanco para desactivarlo.', + "e.g. Slipped": "p. ej. Fallé", + "Reach a character count, meet a checklist requirement, or require both.": + "Alcanza un número de caracteres, cumple un requisito de lista de tareas, o exige ambos.", + + // Tags (cross-plugin compatibility) + Tags: "Etiquetas", + "e.g. task": "p. ej. task", + "Optional Obsidian tags for this note, separated by commas or spaces. Useful for making this habit recognisable to another plugin's own tag-based rules — for example TaskNotes' task tag.": + 'Etiquetas opcionales de Obsidian para esta nota, separadas por comas o espacios. Útil para que otro plugin reconozca este hábito mediante sus propias reglas basadas en etiquetas, por ejemplo la etiqueta "task" de TaskNotes.', + + // Advanced settings: frontmatter key remapping + Advanced: "Avanzado", + Apply: "Aplicar", + "Apply key changes": "Aplicar cambios de claves", + "Rename the frontmatter properties habit notes use. Useful for avoiding collisions with another plugin's own properties in the same note (for example TaskNotes).": + "Cambia el nombre de las propiedades de frontmatter que usan las notas de hábito. Útil para evitar colisiones con las propiedades propias de otro plugin en la misma nota (por ejemplo, TaskNotes).", + "\"{a}\" and \"{b}\" can't use the same property key (\"{value}\").": + '"{a}" y "{b}" no pueden usar la misma clave de propiedad ("{value}").', + "Property keys can't be empty.": + "Las claves de propiedad no pueden estar vacías.", + "This renames {summary} in every note in your habits folder ({count} habit(s) currently). Existing values are moved, not discarded. Continue?": + "Esto renombrará {summary} en todas las notas de tu carpeta de hábitos ({count} hábito(s) actualmente). Los valores existentes se trasladan, no se descartan. ¿Continuar?", + "Updated the frontmatter keys in {count} note(s).": + "Se actualizaron las claves de frontmatter en {count} nota(s).", + "Renaming this away from the default also changes how binary habits log a day: instead of {\"2026-08-25\": 1}, a completed day becomes a bare date, like [\"2026-08-25\"] — the shape TaskNotes uses for complete_instances. Repetition and timed habits are unaffected either way; they always need a value, never just a date.": + 'Cambiar esta clave del valor predeterminado también cambia cómo los hábitos binarios registran un día: en lugar de {"2026-08-25": 1}, un día completado se convierte en una fecha simple, como ["2026-08-25"] — la forma que usa TaskNotes para complete_instances. Los hábitos de repetición y de tiempo no se ven afectados de todos modos; siempre necesitan un valor, nunca solo una fecha.', + Identity: "Identidad", + Legacy: "Heredado", + Lifecycle: "Ciclo de vida", + Presentation: "Presentación", + "Note habit": "Hábito de nota", + "Habit type key": "Clave del tipo de hábito", + "Completion records key": "Clave de los registros", + "Frequency key": "Clave de la frecuencia", + "Weekday key": "Clave del día de la semana", + "Month day key": "Clave del día del mes", + "Interval days key": "Clave de los días de intervalo", + "Planned time key": "Clave de la hora prevista", + "Goal direction key": "Clave de la dirección de la meta", + "Target key": "Clave de la meta", + "Unit key": "Clave de la unidad", + "Step size key": "Clave del tamaño del paso", + "Weekly target key": "Clave de la meta semanal", + "Monthly target key": "Clave de la meta mensual", + "Weekly perfect key": "Clave de semana perfecta", + "Monthly perfect key": "Clave de mes perfecto", + "Start date key": "Clave de la fecha de inicio", + "Pauses key": "Clave de las pausas", + "Stopped key": "Clave de detenido", + "Stop date key": "Clave de la fecha de detención", + "Icon key": "Clave del icono", + "Color key": "Clave del color", + "Group key": "Clave del grupo", + "Use group color key": "Clave de «usar color de grupo»", + "Note folder key": "Clave de la carpeta de notas", + "Note filename format key": "Clave del formato de nombre de archivo", + "Template path key": "Clave de la ruta de la plantilla", + "Note completion mode key": "Clave del modo de finalización", + "Note checklist requirement key": "Clave del requisito de la lista de tareas", + "Note checklist minimum key": "Clave del mínimo de la lista de tareas", + "Note fail keyword key": "Clave de la palabra clave de fallo", + "Legacy comments key": "Clave de los comentarios heredados", + + // PDF export (read via docT() in export-modal.ts, which falls back to English for zh — jsPDF's built-in fonts can't render CJK) + "Completion trend": "Tendencia de cumplimiento", + "(paused)": "(pausado)", + "{rate}% · {total} · streak {current} (best {best})": + "{rate}% · {total} · racha {current} (mejor {best})", + "Goal: {completed}/{goal} days met": + "Meta: {completed}/{goal} días logrados", + "{range} · exported {date}": "{range} · exportado el {date}", + "+{n} more": "+{n} más", + + // Back-dating a missed day + Back: "Atrás", + + // Rescheduling missed habits (experimental) + "1 missed habit": "1 hábito omitido", + "Add a notification button to the dashboard and sidebar panel when a habit's been missed, opening a review of missed days you can move onto a different one (never a day that habit is already due, so nothing doubles up).": + "Añade un botón de notificación al panel principal y a la barra lateral cuando se ha omitido un hábito, que abre una revisión de los días omitidos para moverlos a otro día (nunca a un día en el que ese hábito ya venza, para que nada se duplique).", + "Missed habits": "Hábitos omitidos", + "Move this missed day onto a different one": "Mover este día omitido a otro", + "Move to": "Mover a", + "Nothing missed right now.": "No hay nada omitido por ahora.", + "Pick a habit to move it onto a different day.": + "Elige un hábito para moverlo a otro día.", + Reschedule: "Reprogramar", + "Reschedule missed habits": "Reprogramar hábitos omitidos", + "Rescheduled \"{name}\" to {date}.": '"{name}" se reprogramó para {date}.', + "Rescheduled from {date}": "Reprogramado desde {date}", + "Reschedules key": "Clave de reprogramaciones", + "Failed days key": "Clave de días fallados", + "Skipped days key": "Clave de días omitidos", + "Rescheduling \"{name}\" — missed {date}.": + 'Reprogramando "{name}" — se omitió el {date}.', + "That day no longer works — pick another.": + "Ese día ya no funciona — elige otro.", + "That day won't work — it's either already due for this habit or already claimed by another reschedule.": + "Ese día no sirve — o ya vence este hábito ese día, o ya lo ha reclamado otra reprogramación.", + "{count} missed habits": "{count} hábitos omitidos", +}; diff --git a/src/integrations/habits/i18n/fr.ts b/src/integrations/habits/i18n/fr.ts new file mode 100644 index 000000000..dc6e2ea86 --- /dev/null +++ b/src/integrations/habits/i18n/fr.ts @@ -0,0 +1,656 @@ +/** French translations, keyed by the English source string. */ +export const fr: Record = { + // Commands and ribbon + "Create habit": "Créer une habitude", + "Insert dashboard": "Insérer le tableau de bord", + "Insert habit metrics": "Insérer les métriques d'habitude", + "Insert habits table": "Insérer le tableau des habitudes", + "Open panel": "Ouvrir le panneau", + "Open habits panel": "Ouvrir le panneau des habitudes", + Habits: "Habitudes", + + // Settings + "Habits folder": "Dossier des habitudes", + "Folder where each habit is stored as its own note. It is created automatically if it does not exist.": + "Dossier où chaque habitude est enregistrée dans sa propre note. Il est créé automatiquement s'il n'existe pas.", + "Follow daily note date": "Suivre la date de la note quotidienne", + "When a dashboard is embedded in a daily note (a note whose name contains a date like 2026-07-01), open it on that note's date instead of today.": + "Lorsqu'un tableau de bord est intégré dans une note quotidienne (une note dont le nom contient une date comme 2026-07-01), il s'ouvre à la date de cette note plutôt qu'à aujourd'hui.", + "Daily note date format": "Format de date de la note quotidienne", + "Moment.js format used to read the date from a daily note's name, such as YYYY-MM-DD or YYYYMMDD.": + "Format Moment.js utilisé pour lire la date dans le nom d'une note quotidienne, par exemple YYYY-MM-DD ou YYYYMMDD.", + + // Sorting + "Sort habits by": "Trier les habitudes par", + "The base order of habit cards in the dashboard and side panel.": + "L'ordre de base des cartes d'habitudes dans le tableau de bord et le panneau latéral.", + "Name (A–Z)": "Nom (A–Z)", + Color: "Couleur", + "Last logged": "Dernier enregistrement", + "Planned time": "Heure prévue", + Manual: "Manuel", + "Manual order": "Ordre manuel", + "Drag the cards into the order you want. New habits join the end of the list.": + "Faites glisser les cartes dans l'ordre souhaité. Les nouvelles habitudes rejoignent la fin de la liste.", + "Move completed cards to the end": + "Déplacer les cartes terminées à la fin", + "Completed habits drift to the end of the queue and paused ones park behind them. Turn this off to keep every card in its sorted position.": + "Les habitudes terminées glissent en fin de file et celles en pause se rangent derrière. Désactivez pour garder chaque carte à sa position triée.", + Group: "Groupe", + Ungrouped: "Sans groupe", + "Optional group used to build dashboard sections — for example an area of responsibility.": + "Groupe facultatif pour créer des sections dans le tableau de bord — par exemple un domaine de responsabilité.", + "e.g. Health": "p. ex. Santé", + "Group color": "Couleur du groupe", + "Optional color shared by every habit in this group.": + "Couleur facultative partagée par toutes les habitudes de ce groupe.", + "Group icon": "Icône du groupe", + "Shown in the group lip on cards and in section headers.": + "Affichée dans le bandeau de groupe des cartes et dans les en-têtes de section.", + "Use group color for this card": + "Utiliser la couleur du groupe pour cette carte", + "Show this card in the group color instead of its own.": + "Affiche cette carte dans la couleur du groupe plutôt que la sienne.", + General: "Général", + Sorting: "Tri", + Groups: "Groupes", + "How to move through your habit cards: a paged carousel with arrows, a grid that wraps onto new rows, or a fixed-height grid that scrolls vertically. The stats page follows the same choice.": + "Comment parcourir vos cartes d'habitudes : un carrousel paginé avec flèches, une grille qui passe à la ligne, ou une grille à hauteur fixe qui défile verticalement. La page de statistiques suit le même choix.", + "Enable groups": "Activer les groupes", + "Show habits in sections by their group, with a group lip on each card.": + "Affiche les habitudes en sections selon leur groupe, avec un bandeau de groupe sur chaque carte.", + "Group order": "Ordre des groupes", + "Drag the groups into the order you want. Sections follow the same order.": + "Faites glisser les groupes dans l'ordre souhaité. Les sections suivent le même ordre.", + "Completion animations": "Animations de complétion", + "Play the check swoosh, card departure, and perfect-day confetti when habits are completed. Turn off for instant, quiet updates.": + "Joue le swoosh de la coche, le départ de la carte et les confettis du jour parfait quand une habitude est complétée. Désactivez pour des mises à jour instantanées et discrètes.", + "Reminders": "Rappels", + "Write reminders for due habits": "Écrire des rappels pour les habitudes dues", + "Each day, write one reminder checklist line per planned time of every habit due that day, in the format the Reminder plugin picks up. The lines live in a marked block and refresh as you log habits.": + "Chaque jour, écrit une ligne de rappel par heure prévue pour chaque habitude due ce jour-là, au format reconnu par le plugin Reminder. Les lignes vivent dans un bloc balisé et se mettent à jour au fil des enregistrements.", + "Where to write reminders": "Où écrire les rappels", + "The daily note follows the Daily notes core plugin's folder and date format; the block is added once the note exists. A fixed note is created automatically.": + "La note quotidienne suit le dossier et le format de date du plugin de base « Notes quotidiennes » ; le bloc est ajouté dès que la note existe. Une note fixe est créée automatiquement.", + "Today's daily note": "Note quotidienne du jour", + "A fixed note": "Une note fixe", + "Reminder note path": "Chemin de la note de rappels", + "Vault path of the note that holds the reminder block.": + "Chemin dans le coffre de la note qui contient le bloc de rappels.", + "Manage groups": "Gérer les groupes", + "See every habit by group and drag cards between groups.": + "Voyez chaque habitude par groupe et faites glisser les cartes entre les groupes.", + Open: "Ouvrir", + "New group": "Nouveau groupe", + Add: "Ajouter", + "Drag habits between groups to reassign them, or within a group to reorder them.": + "Faites glisser les habitudes entre les groupes pour les réaffecter, ou au sein d'un groupe pour les réordonner.", + "No habits": "Aucune habitude", + "Edit group style": "Modifier le style du groupe", + "Delete group": "Supprimer le groupe", + 'Delete "{name}"? Its habits are kept and become ungrouped.': + "Supprimer « {name} » ? Ses habitudes sont conservées et deviennent sans groupe.", + Delete: "Supprimer", + "Dashboard layout": "Disposition du tableau de bord", + Carousel: "Carrousel", + Grid: "Grille", + "Vertical scroll": "Défilement vertical", + "Cards per view": "Cartes par vue", + "How many habit cards fit side by side on wider screens.": + "Combien de cartes d'habitudes tiennent côte à côte sur les grands écrans.", + "Cards per view on mobile": "Cartes par vue sur mobile", + "How many habit cards fit side by side on phone-sized screens.": + "Combien de cartes d'habitudes tiennent côte à côte sur les écrans de téléphone.", + + // Confirm dialog defaults + Cancel: "Annuler", + Confirm: "Confirmer", + + // Store notices + 'Could not find the note for "{name}".': + 'Impossible de trouver la note de « {name} ».', + "Please enter a valid habit name.": + "Veuillez saisir un nom d'habitude valide.", + 'A habit called "{name}" already exists.': + 'Une habitude nommée « {name} » existe déjà.', + 'Created habit "{name}".': 'Habitude « {name} » créée.', + 'Updated "{name}".': '« {name} » mise à jour.', + 'Paused "{name}".': '« {name} » mise en pause.', + 'Resumed "{name}".': '« {name} » reprise.', + 'Stopped tracking "{name}". Its history is kept in the note.': + 'Suivi de « {name} » arrêté. Son historique est conservé dans la note.', + 'Resumed tracking "{name}".': 'Suivi de « {name} » repris.', + 'Removed "{name}".': '« {name} » supprimée.', + "Habit added to the dashboard.": "Habitude ajoutée au tableau de bord.", + + // Dashboard + "Back to habits": "Retour aux habitudes", + "View stats": "Voir les statistiques", + "Export stats": "Exporter les statistiques", + Weekly: "Hebdomadaire", + Monthly: "Mensuel", + "Previous day": "Jour précédent", + "Next day": "Jour suivant", + "Choose a date": "Choisir une date", + "Add habit": "Ajouter une habitude", + "No habits yet. Create your first habit to get started.": + "Aucune habitude pour l'instant. Créez votre première habitude pour commencer.", + Previous: "Précédent", + Next: "Suivant", + "Go to position {n}": "Aller à la position {n}", + "Right-click or long-press for more options": + "Clic droit ou appui long pour plus d'options", + "Open habit note": "Ouvrir la note de l'habitude", + "Open the note for {name}": "Ouvrir la note de {name}", + Paused: "En pause", + Stopped: "Arrêté", + "Failed": "Échoué", + "Skipped": "Passé", + "Snoozed": "En sommeil", + "Snoozed until {time}": "En sommeil jusqu'à {time}", + "Undo fail": "Annuler l'échec", + "Undo skip": "Annuler le passage", + "End snooze": "Réveiller", + "Fail for today": "Échouer pour aujourd'hui", + "Fail this day": "Échouer ce jour", + "Marked \"{name}\" as failed.": "« {name} » marqué comme échoué.", + "Skip for today": "Passer pour aujourd'hui", + "Skip this day": "Passer ce jour", + "Skipped \"{name}\".": "« {name} » passé.", + "Snooze…": "Mettre en sommeil…", + "Snooze \"{name}\"": "Mettre « {name} » en sommeil", + "It leaves today's lists and comes back on its own. Snoozing never counts for or against the habit.": "L'habitude quitte les listes du jour et revient d'elle-même. La mise en sommeil ne compte jamais pour ou contre l'habitude.", + "Snooze for": "Mettre en sommeil pendant", + "30 minutes": "30 minutes", + "1 hour": "1 heure", + "3 hours": "3 heures", + "Snooze until": "En sommeil jusqu'à", + "Snooze": "Mettre en sommeil", + "Pick a time later today.": "Choisissez une heure plus tard aujourd'hui.", + "Snoozed \"{name}\" until {time}.": "« {name} » en sommeil jusqu'à {time}.", + "1 hidden for today": "1 masquée aujourd'hui", + "{count} hidden for today": "{count} masquées aujourd'hui", + "1 hidden for this day": "1 masquée ce jour", + "{count} hidden for this day": "{count} masquées ce jour", + "Undo": "Annuler", + "Click to undo": "Cliquez pour annuler", + "Nothing left on this day's list.": "Plus rien dans la liste de ce jour.", + "Nothing left on today's list.": "Plus rien dans la liste du jour.", + "At least: reach a target for habits you are building, like drinking 1.5 litres of water. At most: stay within a limit for habits you are cutting down, like no more than 2 coffees.": "Au moins : atteignez un objectif pour les habitudes que vous construisez, comme boire 1,5 litre d'eau. Au plus : restez sous une limite pour les habitudes que vous réduisez, comme pas plus de 2 cafés.", + "At least (reach a target)": "Au moins (atteindre un objectif)", + "At most (stay within a limit)": "Au plus (rester sous une limite)", + "Step size": "Pas", + "How much each + and − press adds or removes. Use a decimal such as 0.25 for amounts like litres.": "Quantité ajoutée ou retirée à chaque appui sur + et −. Utilisez une décimale comme 0.25 pour des quantités comme les litres.", + "Decrease by {n}": "Diminuer de {n}", + "4 weeks": "4 semaines", + "12 weeks": "12 semaines", + "6 months": "6 mois", + "1 year": "1 an", + "Completion rate": "Taux de réussite", + "Monthly completion rate": "Taux de réussite mensuel", + "Daily activity": "Activité quotidienne", + "Week of {date}": "Semaine du {date}", + "Since {date} · right-click to resume": + "Depuis le {date} · clic droit pour reprendre", + "Paused on this day": "En pause ce jour-là", + "Mark as done": "Marquer comme fait", + "Mark as not done": "Marquer comme non fait", + Done: "Fait", + "Not done": "À faire", + "Edit value": "Modifier la valeur", + Value: "Valeur", + "Decrease by 1": "Diminuer de 1", + "Increase by 1": "Augmenter de 1", + "Increase by {n}": "Augmenter de {n}", + "Edit habit": "Modifier l'habitude", + "Pause habit": "Mettre en pause", + "Resume habit": "Reprendre l'habitude", + "Stop tracking": "Arrêter le suivi", + "Remove habit": "Supprimer l'habitude", + 'Stop tracking "{name}"? It leaves the dashboard and stats, but its note and full history are kept. You can resume tracking any time from the note\'s metrics view.': + 'Arrêter le suivi de « {name} » ? Elle quitte le tableau de bord et les statistiques, mais sa note et tout son historique sont conservés. Vous pouvez reprendre le suivi à tout moment depuis la vue des métriques de la note.', + 'Remove "{name}"? Its note will be moved to the trash.': + 'Supprimer « {name} » ? Sa note sera déplacée vers la corbeille.', + Remove: "Supprimer", + "Perfect!": "Parfait !", + Today: "Aujourd'hui", + Yesterday: "Hier", + Tomorrow: "Demain", + "Last 7 days": "7 derniers jours", + "Last 30 days": "30 derniers jours", + "This week": "Cette semaine", + "This month": "Ce mois-ci", + + // Sidebar panel + "Habits completed today": "Habitudes accomplies aujourd'hui", + "No habits yet.": "Aucune habitude pour l'instant.", + "Click to type a value": "Cliquez pour saisir une valeur", + "Open note": "Ouvrir la note", + + // Stats view + "No habits to show stats for yet.": + "Aucune habitude à afficher dans les statistiques pour l'instant.", + Completion: "Réussite", + "Best streak": "Meilleure série", + "Perfect days": "Jours parfaits", + Completions: "Accomplissements", + "Goals met": "Objectifs atteints", + "{completed}/{days} days": "{completed}/{days} jours", + "{total} total": "{total} au total", + best: "record", + "perfect week": "semaine parfaite", + "perfect month": "mois parfait", + "weekly goal": "objectif hebdomadaire", + "monthly goal": "objectif mensuel", + "{progress}/{goal} days · {label} · {pct}%": + "{progress}/{goal} jours · {label} · {pct} %", + + // Habit metrics block + 'Place this block inside a habit note, or point it at one with "habit: ".': + 'Placez ce bloc dans une note d\'habitude, ou désignez-en une avec « habit: ».', + 'No habit called "{name}" was found.': + 'Aucune habitude nommée « {name} » n\'a été trouvée.', + "No longer tracked since {date}. All history is kept.": + "Suivi arrêté depuis le {date}. Tout l'historique est conservé.", + "No longer tracked. All history is kept.": + "Suivi arrêté. Tout l'historique est conservé.", + "Resume tracking": "Reprendre le suivi", + "Paused since {date}. Paused days don't count against streaks or stats.": + "En pause depuis le {date}. Les jours en pause ne comptent ni pour les séries ni pour les statistiques.", + "Paused. Paused days don't count against streaks or stats.": + "En pause. Les jours en pause ne comptent ni pour les séries ni pour les statistiques.", + "Current streak": "Série actuelle", + "Days completed": "Jours accomplis", + "30-day rate": "Taux sur 30 jours", + "Weekly completion rate": "Taux de réussite hebdomadaire", + Logged: "Enregistré", + Target: "Objectif", + + // Export modal + Title: "Titre", + "Habits report": "Rapport d'habitudes", + "Date range": "Plage de dates", + "Custom range": "Plage personnalisée", + From: "Du", + To: "Au", + "Up to {n} days.": "Jusqu'à {n} jours.", + Content: "Contenu", + "Summary tiles": "Tuiles de résumé", + "Completion trend chart": "Graphique de tendance de réussite", + "Daily grids": "Grilles quotidiennes", + "Goal progress": "Progression des objectifs", + Layout: "Mise en page", + Orientation: "Orientation", + Portrait: "Portrait", + Landscape: "Paysage", + Density: "Densité", + Comfortable: "Confortable", + Compact: "Compact", + Monochrome: "Monochrome", + "Ink-friendly greys instead of accent colours.": + "Des gris économes en encre plutôt que des couleurs d'accent.", + "Export PDF": "Exporter le PDF", + "No habits to export yet.": "Aucune habitude à exporter pour l'instant.", + 'Exported to "{path}" in your vault.': + 'Exporté vers « {path} » dans votre coffre.', + + // Habit modal + "New habit": "Nouvelle habitude", + Name: "Nom", + Type: "Type", + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes.": + "Binaire : fait ou non fait. Répétition : compte vers un objectif. Chronométré : enregistre des minutes.", + Binary: "Binaire", + Repetition: "Répétition", + Timed: "Chronométré", + "Daily target (minutes)": "Objectif quotidien (minutes)", + "Daily target": "Objectif quotidien", + Unit: "Unité", + "Optional label shown next to the count.": + "Étiquette facultative affichée à côté du compteur.", + Icon: "Icône", + "Choose a Lucide icon or an emoji to represent this habit.": + "Choisissez une icône Lucide ou un emoji pour représenter cette habitude.", + Emoji: "Emoji", + "Choose an emoji": "Choisir un emoji", + "Clear icon": "Effacer l'icône", + "Choose icon": "Choisir une icône", + "Save changes": "Enregistrer les modifications", + "Targets (optional)": "Objectifs (facultatif)", + "Set an optional weekly or monthly goal for how many days you complete this habit. For example, hitting your daily goal on all 7 days is a weekly target of 7. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "Définissez un objectif hebdomadaire ou mensuel facultatif indiquant combien de jours vous accomplissez cette habitude. Par exemple, atteindre votre objectif quotidien les 7 jours équivaut à un objectif hebdomadaire de 7. Activez une option « parfait » pour viser automatiquement chaque jour de la période, quelle que soit sa durée.", + "Perfect week": "Semaine parfaite", + "Aim to complete this habit every day of the week.": + "Visez à accomplir cette habitude chaque jour de la semaine.", + "Weekly target": "Objectif hebdomadaire", + "Optional. Days to complete per week (max 7).": + "Facultatif. Jours à accomplir par semaine (max. 7).", + None: "Aucun", + "Perfect month": "Mois parfait", + "Aim to complete this habit every day of the month.": + "Visez à accomplir cette habitude chaque jour du mois.", + "Monthly target": "Objectif mensuel", + "Optional. Days to complete per month.": + "Facultatif. Jours à accomplir par mois.", + Colour: "Couleur", + "Pick a colour from your theme, or choose a custom one.": + "Choisissez une couleur de votre thème ou une couleur personnalisée.", + "Your habit": "Votre habitude", + + // Icon and colour pickers + "Search icons…": "Rechercher des icônes…", + "Search emojis…": "Rechercher des émojis…", + + // Comments + "Comments on cards": "Commentaires sur les cartes", + "Show a comment flap on dashboard cards for jotting a note about any day.": + "Affiche un volet de commentaire sur les cartes du tableau de bord pour annoter n'importe quel jour.", + "Add comment": "Ajouter un commentaire", + "Flip back": "Retourner la carte", + "Edit comment": "Modifier le commentaire", + "Move day comments into note bodies": + "Déplacer les commentaires quotidiens dans le corps des notes", + "No comments left to move.": + "Plus aucun commentaire à déplacer.", + "Moved comments in 1 note.": + "Commentaires déplacés dans 1 note.", + "Moved comments in {n} notes.": + "Commentaires déplacés dans {n} notes.", + "Add a comment for this day…": "Ajoutez un commentaire pour ce jour…", + Comments: "Commentaires", + + // Limit habits (experimental) + Experimental: "Expérimental", + "These features are still being tested and may change before they become permanent. Turning one off only hides it from menus — anything you created with it keeps working.": + "Ces fonctionnalités sont encore en cours de test et peuvent changer avant de devenir permanentes. Les désactiver ne fait que les masquer des menus — tout ce que vous avez créé avec continue de fonctionner.", + "Break bad habits": "Rompre avec les mauvaises habitudes", + "Track habits you want to reduce or avoid by staying under a daily limit — for example at most 2 hours of gaming, or no smoking at all.": + "Suivez les habitudes que vous voulez réduire ou éviter en restant sous une limite quotidienne — par exemple au plus 2 heures de jeu vidéo, ou ne pas fumer du tout.", + Goal: "Objectif", + "Reach a target for habits you are building. Stay under a limit for habits you are cutting down or giving up.": + "Atteignez un objectif pour les habitudes que vous construisez. Restez sous une limite pour les habitudes que vous réduisez ou abandonnez.", + "Reach a target": "Atteindre un objectif", + "Stay under a limit": "Rester sous une limite", + "Binary means avoiding it entirely. Repetition counts against a daily limit. Timed tracks minutes against a daily limit.": + "Binaire signifie l'éviter complètement. Répétition compte par rapport à une limite quotidienne. Chronométré mesure des minutes par rapport à une limite quotidienne.", + "Daily limit": "Limite quotidienne", + "Daily limit (minutes)": "Limite quotidienne (minutes)", + "0 means none at all.": "0 signifie pas du tout.", + "Set an optional weekly or monthly goal for how many days you stay within your limit. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "Définissez un objectif hebdomadaire ou mensuel facultatif pour le nombre de jours où vous restez dans votre limite. Activez une bascule parfaite pour viser automatiquement chaque jour de la période, quelle que soit sa durée.", + Clean: "Sans écart", + Slipped: "Écart", + "Mark as clean": "Marquer comme sans écart", + "Mark as slipped": "Marquer comme écart", + "Days within limit": "Jours dans la limite", + Limit: "Limite", + + // Frequencies and per-note metrics + Frequency: "Fréquence", + Daily: "Quotidien", + "Days of week": "Jours de la semaine", + Habit: "Habitude", + Schedule: "Programme", + "Time of day": "Heure de la journée", + "Optional times this habit is planned for — once or several times a day. Shown on the habit's card.": + "Heures facultatives prévues pour cette habitude — une ou plusieurs fois par jour. Affichées sur la carte de l'habitude.", + "Add time": "Ajouter une heure", + "Remove time": "Supprimer l'heure", + "Every N days": "Tous les N jours", + "Repeat every": "Répéter tous les", + "Day of month": "Jour du mois", + "The weekdays this habit is due on. Pick as many as you need.": + "Les jours de la semaine où cette habitude est due. Choisissez-en autant que nécessaire.", + "Number of days between due dates, counted from the habit's start date. Use 2 for an alternate-day schedule.": + "Nombre de jours entre les échéances, compté à partir de la date de début de l'habitude. Utilisez 2 pour un rythme d'un jour sur deux.", + "The day of the month this habit is due. In shorter months it falls due on the last day, so 31 always lands on the final day of the month.": + "Le jour du mois où cette habitude est due. Les mois plus courts la placent le dernier jour, donc 31 tombe toujours en fin de mois.", + "Every {day}": "Chaque {day}", + "Monthly · day {day}": "Mensuel · jour {day}", + "Every other day": "Un jour sur deux", + "Every {n} days": "Tous les {n} jours", + "No habits are due on this day.": + "Aucune habitude n'est due ce jour-là.", + "Nothing due today.": "Rien à faire aujourd'hui.", + "Weekly activity": "Activité hebdomadaire", + "Monthly activity": "Activité mensuelle", + "Activity on due days": "Activité aux jours d'échéance", + "Completion rate over {n} due days": + "Taux de réussite sur {n} jours d'échéance", + "Weeks completed": "Semaines accomplies", + "Months completed": "Mois accomplis", + "Recent rate": "Taux récent", + "{n}-week completion rate": "Taux de réussite sur {n} semaines", + "{n}-month completion rate": "Taux de réussite sur {n} mois", + + // AI summaries + "AI summaries": "Résumés par IA", + "AI summary": "Résumé par IA", + "Show an AI-generated summary with feedback and advice on the stats page tabs. Uses an OpenAI-compatible service you configure below; your habit stats are sent to it only when you press the generate button.": + "Affiche un résumé généré par IA avec retours et conseils dans les onglets de la page de statistiques. Utilise un service compatible OpenAI que vous configurez ci-dessous ; vos statistiques d'habitudes ne lui sont envoyées que lorsque vous appuyez sur le bouton de génération.", + "AI base URL": "URL de base de l'IA", + "Base URL of an OpenAI-compatible API. Works with OpenAI, OpenRouter, or local servers like Ollama (http://localhost:11434/v1).": + "URL de base d'une API compatible OpenAI. Fonctionne avec OpenAI, OpenRouter ou des serveurs locaux comme Ollama (http://localhost:11434/v1).", + "AI API key": "Clé d'API IA", + "Stored locally in this vault's plugin data. Leave blank for local servers that need no key.": + "Stockée localement dans les données du plugin de ce coffre. Laissez vide pour les serveurs locaux sans clé.", + "AI model": "Modèle d'IA", + "Model name the service should use.": + "Nom du modèle que le service doit utiliser.", + "Generate summary": "Générer le résumé", + Regenerate: "Régénérer", + "Get feedback and advice on your habits for this period. Your stats are sent to the AI service you configured only when you press the button.": + "Recevez des retours et des conseils sur vos habitudes pour cette période. Vos statistiques ne sont envoyées au service d'IA configuré que lorsque vous appuyez sur le bouton.", + "Thinking…": "Réflexion…", + "Could not generate a summary: {message}": + "Impossible de générer le résumé : {message}", + "Adds an AI-generated overview with feedback and advice. Your habit stats are sent to your configured AI service.": + "Ajoute un aperçu généré par IA avec retours et conseils. Vos statistiques d'habitudes sont envoyées au service d'IA configuré.", + "Generating AI summary…": "Génération du résumé par IA…", + "The AI summary will be generated when you export.": + "Le résumé par IA sera généré lors de l'export.", + + // Custom stats range + Custom: "Personnalisé", + "Start date": "Date de début", + "End date": "Date de fin", + + // Heatmap start markers + "not tracked yet": "pas encore suivi", + "started tracking on {date}": "suivi commencé le {date}", + + // Stats carousel + "Stats rows per page": "Lignes de statistiques par page", + "How many habits each stats page shows.": + "Combien d'habitudes chaque page de statistiques affiche.", + // Note habits + '"{name}" uses Templater syntax, but the Templater plugin is not installed — the template was copied as plain text.': + "« {name} » utilise la syntaxe Templater, mais le plugin Templater n'est pas installé — le modèle a été copié en texte brut.", + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes. Note is completed by writing in a per-day note.": + "Binaire : fait ou non fait. Répétition : compte vers un objectif. Chronométré : enregistre des minutes. Note : se complète en écrivant dans une note quotidienne.", + "Character count is reached": "Un nombre de caractères est atteint", + "Character goal": "Objectif de caractères", + "Completed when": "Complété quand", + "Every task is checked": "Toutes les tâches sont cochées", + "Filename format": "Format du nom de fichier", + "Folder each day's note is created in. Leave blank for a dedicated subfolder named after this habit.": + "Dossier où la note de chaque jour est créée. Laissez vide pour un sous-dossier dédié portant le nom de cette habitude.", + "Moment.js format used to name each day's note, e.g. {example}. May include / for date-based subfolders.": + "Format Moment.js utilisé pour nommer la note de chaque jour, p. ex. {example}. Peut inclure / pour des sous-dossiers basés sur la date.", + Note: "Note", + "Note habits": "Habitudes en note", + "Notes folder": "Dossier des notes", + "Open this day's note": "Ouvrir la note de ce jour", + "Open today's note": "Ouvrir la note d'aujourd'hui", + "Optional template note used when a day's note is created. Expanded through the Templater plugin when it is installed, otherwise copied as plain text.": + "Note modèle optionnelle utilisée lors de la création de la note d'un jour. Développée via le plugin Templater lorsqu'il est installé, sinon copiée en texte brut.", + Template: "Modèle", + "Track a habit by writing in a per-day note instead of logging a value by hand. A day is complete once the note reaches a character count or every task in it is checked. Works with the Templater plugin to create each day's note from a template.": + "Suivez une habitude en écrivant dans une note quotidienne plutôt qu'en enregistrant une valeur à la main. Un jour est complet une fois que la note atteint un nombre de caractères ou que toutes ses tâches sont cochées. Fonctionne avec le plugin Templater pour créer la note de chaque jour à partir d'un modèle.", + Write: "Écrire", + "Write this day's note": "Écrire la note de ce jour", + "Write today's note": "Écrire la note d'aujourd'hui", + "e.g. Journal": "p. ex. Journal", + "e.g. Templates/Journal.md": "p. ex. Templates/Journal.md", + + // Flexible frequency (any day) + "How many times (or, for counted and timed habits, how much in total) this needs to happen somewhere in the period.": + "Combien de fois (ou, pour les habitudes comptées ou chronométrées, quelle quantité au total) cela doit se produire dans la période.", + 'How often this habit is due. Weekly and monthly habits only appear on their due date; the "any day" options appear every day until their quota is met.': + "La fréquence à laquelle cette habitude est due. Les habitudes hebdomadaires et mensuelles n'apparaissent qu'à leur date d'échéance ; les options « n'importe quel jour » apparaissent chaque jour jusqu'à ce que le quota soit atteint.", + "Monthly (any day)": "Mensuel (n'importe quel jour)", + "Times per month": "Fois par mois", + "Times per week": "Fois par semaine", + "Weekly (any day)": "Hebdomadaire (n'importe quel jour)", + "this month": "ce mois-ci", + "this week": "cette semaine", + "{completed}/{days} months": "{completed}/{days} mois", + "{completed}/{days} weeks": "{completed}/{days} semaines", + "{n}× a month · any day": "{n}× par mois · n'importe quel jour", + "{n}× a week · any day": "{n}× par semaine · n'importe quel jour", + + // Commands + "Insert habits heatmap": "Insérer la carte de chaleur des habitudes", + + // Habit metrics: heatmap tabs + Charts: "Graphiques", + Month: "Mois", + History: "Historique", + "{month} heatmap": "Carte de chaleur de {month}", + "Last {n} weeks": "{n} dernières semaines", + + // Heatmap cell states and tooltips + Upcoming: "À venir", + "Not tracked yet": "Pas encore suivi", + "Not due": "Non prévu", + "Outside this month": "Hors de ce mois", + Complete: "Terminé", + "Over limit": "Dépassement de limite", + "Not logged": "Non enregistré", + + // Whole-vault heatmap block + "Add a habit to see its heatmap here.": + "Ajoutez une habitude pour voir sa carte de chaleur ici.", + "No habits in the \"{group}\" group.": + "Aucune habitude dans le groupe « {group} ».", + "No habits due": "Aucune habitude prévue", + "Perfect day": "Journée parfaite", + "{completed}/{considered} habits · {pct}%": + "{completed}/{considered} habitudes · {pct} %", + "This year": "Cette année", + "Past 6 months": "6 derniers mois", + "{year} heatmap": "Carte de chaleur de {year}", + + // Note habits: checklist requirement and fail keyword + "Both are true": "Les deux sont vraies", + "Checklist requirement is met": "L'exigence de la liste de tâches est remplie", + "Checklist requirement": "Exigence de la liste de tâches", + "Require every task to be checked, or just some — useful for a list of alternatives where doing any one of them counts (e.g. \"Cardio\" / \"Weights\" / \"Rest day\").": + "Exigez que toutes les tâches soient cochées, ou seulement certaines — utile pour une liste d'alternatives où faire l'une d'elles suffit (par ex. « Cardio » / « Musculation » / « Jour de repos »).", + "At least this many are checked": "Au moins ce nombre est coché", + "Tasks required": "Tâches requises", + "Fail keyword": "Mot-clé d'échec", + "Optional. Checking a task whose text contains this word forces the day to fail, whatever else is checked — e.g. \"Slipped\" as one of several checklist options. Leave blank to turn this off.": + "Facultatif. Cocher une tâche dont le texte contient ce mot force la journée à échouer, quoi que vous ayez coché par ailleurs — par exemple « Raté » comme l'une des options de la liste. Laissez vide pour désactiver.", + "e.g. Slipped": "p. ex. Raté", + "Reach a character count, meet a checklist requirement, or require both.": + "Atteignez un nombre de caractères, remplissez une exigence de liste de tâches, ou exigez les deux.", + + // Tags (cross-plugin compatibility) + Tags: "Étiquettes", + "e.g. task": "p. ex. task", + "Optional Obsidian tags for this note, separated by commas or spaces. Useful for making this habit recognisable to another plugin's own tag-based rules — for example TaskNotes' task tag.": + "Tags Obsidian optionnels pour cette note, séparés par des virgules ou des espaces. Utile pour rendre cette habitude reconnaissable par les règles basées sur les tags d'un autre plugin — par exemple le tag « task » de TaskNotes.", + + // Advanced settings: frontmatter key remapping + Advanced: "Avancé", + Apply: "Appliquer", + "Apply key changes": "Appliquer les changements de clés", + "Rename the frontmatter properties habit notes use. Useful for avoiding collisions with another plugin's own properties in the same note (for example TaskNotes).": + "Renommez les propriétés de frontmatter utilisées par les notes d'habitude. Utile pour éviter les collisions avec les propriétés d'un autre plugin dans la même note (par exemple TaskNotes).", + "\"{a}\" and \"{b}\" can't use the same property key (\"{value}\").": + "« {a} » et « {b} » ne peuvent pas utiliser la même clé de propriété (« {value} »).", + "Property keys can't be empty.": + "Les clés de propriété ne peuvent pas être vides.", + "This renames {summary} in every note in your habits folder ({count} habit(s) currently). Existing values are moved, not discarded. Continue?": + "Cette opération renomme {summary} dans toutes les notes de votre dossier d'habitudes ({count} habitude(s) actuellement). Les valeurs existantes sont déplacées, pas supprimées. Continuer ?", + "Updated the frontmatter keys in {count} note(s).": + "Clés de frontmatter mises à jour dans {count} note(s).", + "Renaming this away from the default also changes how binary habits log a day: instead of {\"2026-08-25\": 1}, a completed day becomes a bare date, like [\"2026-08-25\"] — the shape TaskNotes uses for complete_instances. Repetition and timed habits are unaffected either way; they always need a value, never just a date.": + "Renommer cette clé par rapport à sa valeur par défaut change aussi la façon dont les habitudes binaires enregistrent un jour : au lieu de {\"2026-08-25\": 1}, un jour terminé devient une simple date, comme [\"2026-08-25\"] — le format que TaskNotes utilise pour complete_instances. Les habitudes à répétitions et chronométrées ne sont pas concernées dans tous les cas ; elles ont toujours besoin d'une valeur, jamais d'une simple date.", + Identity: "Identité", + Legacy: "Hérité", + Lifecycle: "Cycle de vie", + Presentation: "Présentation", + "Note habit": "Habitude de note", + "Habit type key": "Clé du type d'habitude", + "Completion records key": "Clé des enregistrements", + "Frequency key": "Clé de fréquence", + "Weekday key": "Clé du jour de la semaine", + "Month day key": "Clé du jour du mois", + "Interval days key": "Clé des jours d'intervalle", + "Planned time key": "Clé de l'heure prévue", + "Goal direction key": "Clé du sens de l'objectif", + "Target key": "Clé de l'objectif", + "Unit key": "Clé de l'unité", + "Step size key": "Clé du pas", + "Weekly target key": "Clé de l'objectif hebdomadaire", + "Monthly target key": "Clé de l'objectif mensuel", + "Weekly perfect key": "Clé de la semaine parfaite", + "Monthly perfect key": "Clé du mois parfait", + "Start date key": "Clé de la date de début", + "Pauses key": "Clé des pauses", + "Stopped key": "Clé de l'arrêt", + "Stop date key": "Clé de la date d'arrêt", + "Icon key": "Clé de l'icône", + "Color key": "Clé de la couleur", + "Group key": "Clé du groupe", + "Use group color key": "Clé « utiliser la couleur du groupe »", + "Note folder key": "Clé du dossier des notes", + "Note filename format key": "Clé du format de nom de fichier", + "Template path key": "Clé du chemin du modèle", + "Note completion mode key": "Clé du mode d'achèvement", + "Note checklist requirement key": "Clé de l'exigence de la liste de tâches", + "Note checklist minimum key": "Clé du minimum de la liste de tâches", + "Note fail keyword key": "Clé du mot-clé d'échec", + "Legacy comments key": "Clé des commentaires hérités", + + // PDF export (read via docT() in export-modal.ts, which falls back to English for zh — jsPDF's built-in fonts can't render CJK) + "Completion trend": "Tendance de réussite", + "(paused)": "(en pause)", + "{rate}% · {total} · streak {current} (best {best})": + "{rate} % · {total} · série {current} (record {best})", + "Goal: {completed}/{goal} days met": + "Objectif : {completed}/{goal} jours atteints", + "{range} · exported {date}": "{range} · exporté le {date}", + "+{n} more": "+{n} de plus", + + // Back-dating a missed day + Back: "Retour", + + // Rescheduling missed habits (experimental) + "1 missed habit": "1 habitude manquée", + "Add a notification button to the dashboard and sidebar panel when a habit's been missed, opening a review of missed days you can move onto a different one (never a day that habit is already due, so nothing doubles up).": + "Ajoute un bouton de notification au tableau de bord et au panneau latéral lorsqu'une habitude a été manquée, ouvrant une revue des jours manqués que vous pouvez déplacer vers un autre jour (jamais un jour où cette habitude est déjà due, pour qu'il n'y ait jamais de doublon).", + "Missed habits": "Habitudes manquées", + "Move this missed day onto a different one": + "Déplacer ce jour manqué vers un autre", + "Move to": "Déplacer vers", + "Nothing missed right now.": "Rien de manqué pour l'instant.", + "Pick a habit to move it onto a different day.": + "Choisissez une habitude à déplacer vers un autre jour.", + Reschedule: "Replanifier", + "Reschedule missed habits": "Replanifier les habitudes manquées", + "Rescheduled \"{name}\" to {date}.": "« {name} » a été replanifiée au {date}.", + "Rescheduled from {date}": "Reporté depuis {date}", + "Reschedules key": "Clé des replanifications", + "Failed days key": "Clé des jours échoués", + "Skipped days key": "Clé des jours passés", + "Rescheduling \"{name}\" — missed {date}.": + "Replanification de « {name} » — manqué le {date}.", + "That day no longer works — pick another.": + "Ce jour ne fonctionne plus — choisissez-en un autre.", + "That day won't work — it's either already due for this habit or already claimed by another reschedule.": + "Ce jour ne convient pas — soit cette habitude y est déjà due, soit un autre déplacement l'a déjà pris.", + "{count} missed habits": "{count} habitudes manquées", +}; diff --git a/src/integrations/habits/i18n/index.ts b/src/integrations/habits/i18n/index.ts new file mode 100644 index 000000000..9e262fe9e --- /dev/null +++ b/src/integrations/habits/i18n/index.ts @@ -0,0 +1,61 @@ +import { moment } from "obsidian"; +import { es } from "./es"; +import { fr } from "./fr"; +import { de } from "./de"; +import { zh } from "./zh"; +import { ja } from "./ja"; +import { ko } from "./ko"; + +const LOCALES: Record> = { + es, + fr, + de, + zh, + ja, + ko, +}; + +/** Resolve the active dictionary from Obsidian's language setting. */ +function dictionary(): Record | null { + const lang = moment.locale(); + if (lang.startsWith("zh")) { + // Only Simplified Chinese is bundled; Traditional falls back to + // English rather than showing Simplified text. + return lang === "zh-tw" ? null : LOCALES.zh; + } + return LOCALES[lang.split("-")[0]] ?? null; +} + +/** + * Translate an English source string, interpolating `{placeholders}`. + * + * The English text itself is the lookup key (i18next-style natural keys), + * so any string missing from a dictionary safely falls back to English. + */ +export function t( + text: string, + vars?: Record, +): string { + return interpolate(dictionary()?.[text] ?? text, vars); +} + +/** Interpolate placeholders without translating (English source text). */ +export function tEn( + text: string, + vars?: Record, +): string { + return interpolate(text, vars); +} + +function interpolate( + text: string, + vars?: Record, +): string { + let out = text; + if (vars) { + for (const [key, value] of Object.entries(vars)) { + out = out.split(`{${key}}`).join(String(value)); + } + } + return out; +} diff --git a/src/integrations/habits/i18n/ja.ts b/src/integrations/habits/i18n/ja.ts new file mode 100644 index 000000000..c792264b7 --- /dev/null +++ b/src/integrations/habits/i18n/ja.ts @@ -0,0 +1,643 @@ +/** Japanese translations, keyed by the English source string. */ +export const ja: Record = { + // Commands and ribbon + "Create habit": "習慣を作成", + "Insert dashboard": "ダッシュボードを挿入", + "Insert habit metrics": "習慣メトリクスを挿入", + "Insert habits table": "習慣テーブルを挿入", + "Open panel": "パネルを開く", + "Open habits panel": "習慣パネルを開く", + Habits: "習慣", + + // Settings + "Habits folder": "習慣フォルダー", + "Folder where each habit is stored as its own note. It is created automatically if it does not exist.": + "各習慣を個別のノートとして保存するフォルダー。存在しない場合は自動的に作成されます。", + "Follow daily note date": "デイリーノートの日付に従う", + "When a dashboard is embedded in a daily note (a note whose name contains a date like 2026-07-01), open it on that note's date instead of today.": + "ダッシュボードがデイリーノート(2026-07-01 のような日付を名前に含むノート)に埋め込まれている場合、今日ではなくそのノートの日付で開きます。", + "Daily note date format": "デイリーノートの日付形式", + "Moment.js format used to read the date from a daily note's name, such as YYYY-MM-DD or YYYYMMDD.": + "デイリーノート名から日付を読み取るための Moment.js 形式。例:YYYY-MM-DD、YYYYMMDD。", + + // Sorting + "Sort habits by": "習慣の並び順", + "The base order of habit cards in the dashboard and side panel.": + "ダッシュボードとサイドパネルでのカードの基本的な並び順。", + "Name (A–Z)": "名前(A–Z)", + Color: "色", + "Last logged": "最終記録", + "Planned time": "予定時刻", + Manual: "手動", + "Manual order": "手動の順序", + "Drag the cards into the order you want. New habits join the end of the list.": + "カードをドラッグして好きな順序に並べます。新しい習慣はリストの最後に追加されます。", + "Move completed cards to the end": "完了したカードを最後に移動", + "Completed habits drift to the end of the queue and paused ones park behind them. Turn this off to keep every card in its sorted position.": + "完了した習慣はキューの最後へ移動し、一時停止中の習慣はその後ろに並びます。オフにすると、すべてのカードが並び順の位置に留まります。", + Group: "グループ", + Ungrouped: "グループなし", + "Optional group used to build dashboard sections — for example an area of responsibility.": + "ダッシュボードのセクションを作るための任意のグループ — 例えば責任範囲など。", + "e.g. Health": "例:健康", + "Group color": "グループの色", + "Optional color shared by every habit in this group.": + "このグループのすべての習慣で共有される任意の色。", + "Group icon": "グループのアイコン", + "Shown in the group lip on cards and in section headers.": + "カードのグループバーとセクション見出しに表示されます。", + "Use group color for this card": "このカードにグループの色を使う", + "Show this card in the group color instead of its own.": + "このカードを自身の色ではなくグループの色で表示します。", + General: "一般", + Sorting: "並べ替え", + Groups: "グループ", + "How to move through your habit cards: a paged carousel with arrows, a grid that wraps onto new rows, or a fixed-height grid that scrolls vertically. The stats page follows the same choice.": + "カードの表示方法:矢印で切り替えるカルーセル、行を折り返すグリッド、または高さ固定で縦にスクロールするグリッド。統計ページも同じ設定に従います。", + "Enable groups": "グループを有効にする", + "Show habits in sections by their group, with a group lip on each card.": + "習慣をグループごとのセクションで表示し、各カードにグループバーを付けます。", + "Group order": "グループの順序", + "Drag the groups into the order you want. Sections follow the same order.": + "グループを好きな順序にドラッグします。セクションも同じ順序に従います。", + "Completion animations": "完了アニメーション", + "Play the check swoosh, card departure, and perfect-day confetti when habits are completed. Turn off for instant, quiet updates.": + "習慣の完了時にチェックのスウッシュ、カードの退場、パーフェクトデーの紙吹雪を再生します。オフにすると即座に静かに更新されます。", + "Reminders": "リマインダー", + "Write reminders for due habits": "当日実施予定の習慣のリマインダーを書き込む", + "Each day, write one reminder checklist line per planned time of every habit due that day, in the format the Reminder plugin picks up. The lines live in a marked block and refresh as you log habits.": + "毎日、その日に実施予定の各習慣の予定時刻ごとにリマインダー行を書き込みます。形式は Reminder プラグインが認識するものです。行はマーカー付きブロック内にあり、記録に応じて更新されます。", + "Where to write reminders": "リマインダーの書き込み先", + "The daily note follows the Daily notes core plugin's folder and date format; the block is added once the note exists. A fixed note is created automatically.": + "デイリーノートはコアプラグイン「デイリーノート」のフォルダーと日付形式に従い、ノートが存在すればブロックが追加されます。固定ノートは自動的に作成されます。", + "Today's daily note": "今日のデイリーノート", + "A fixed note": "固定ノート", + "Reminder note path": "リマインダーノートのパス", + "Vault path of the note that holds the reminder block.": + "リマインダーブロックを保持するノートの保管庫内パス。", + "Manage groups": "グループを管理", + "See every habit by group and drag cards between groups.": + "グループごとに習慣を確認し、カードをグループ間でドラッグできます。", + Open: "開く", + "New group": "新しいグループ", + Add: "追加", + "Drag habits between groups to reassign them, or within a group to reorder them.": + "習慣をグループ間でドラッグして割り当て直すか、グループ内でドラッグして並べ替えます。", + "No habits": "習慣なし", + "Edit group style": "グループのスタイルを編集", + "Delete group": "グループを削除", + 'Delete "{name}"? Its habits are kept and become ungrouped.': + "「{name}」を削除しますか?習慣は保持され、グループなしになります。", + Delete: "削除", + "Dashboard layout": "ダッシュボードのレイアウト", + Carousel: "カルーセル", + Grid: "グリッド", + "Vertical scroll": "縦スクロール", + "Cards per view": "1画面あたりのカード数", + "How many habit cards fit side by side on wider screens.": + "広い画面で横に並べるカードの数。", + "Cards per view on mobile": "モバイルでの1画面あたりのカード数", + "How many habit cards fit side by side on phone-sized screens.": + "スマートフォンの画面で横に並べるカードの数。", + + // Confirm dialog defaults + Cancel: "キャンセル", + Confirm: "確認", + + // Store notices + 'Could not find the note for "{name}".': + "「{name}」のノートが見つかりませんでした。", + "Please enter a valid habit name.": "有効な習慣名を入力してください。", + 'A habit called "{name}" already exists.': + "「{name}」という習慣はすでに存在します。", + 'Created habit "{name}".': "習慣「{name}」を作成しました。", + 'Updated "{name}".': "「{name}」を更新しました。", + 'Paused "{name}".': "「{name}」を一時停止しました。", + 'Resumed "{name}".': "「{name}」を再開しました。", + 'Stopped tracking "{name}". Its history is kept in the note.': + "「{name}」のトラッキングを停止しました。履歴はノートに保存されています。", + 'Resumed tracking "{name}".': "「{name}」のトラッキングを再開しました。", + 'Removed "{name}".': "「{name}」を削除しました。", + "Habit added to the dashboard.": "習慣をダッシュボードに追加しました。", + + // Dashboard + "Back to habits": "習慣に戻る", + "View stats": "統計を表示", + "Export stats": "統計をエクスポート", + Weekly: "週間", + Monthly: "月間", + "Previous day": "前の日", + "Next day": "次の日", + "Choose a date": "日付を選択", + "Add habit": "習慣を追加", + "No habits yet. Create your first habit to get started.": + "まだ習慣がありません。最初の習慣を作成して始めましょう。", + Previous: "前へ", + Next: "次へ", + "Go to position {n}": "位置 {n} へ移動", + "Right-click or long-press for more options": + "右クリックまたは長押しでその他のオプション", + "Open habit note": "習慣のノートを開く", + "Open the note for {name}": "{name} のノートを開く", + Paused: "一時停止中", + Stopped: "記録停止", + "Failed": "失敗", + "Skipped": "スキップ", + "Snoozed": "スヌーズ中", + "Snoozed until {time}": "{time} までスヌーズ中", + "Undo fail": "失敗を取り消す", + "Undo skip": "スキップを取り消す", + "End snooze": "スヌーズを終了", + "Fail for today": "今日は失敗にする", + "Fail this day": "この日を失敗にする", + "Marked \"{name}\" as failed.": "「{name}」を失敗にしました。", + "Skip for today": "今日はスキップ", + "Skip this day": "この日をスキップ", + "Skipped \"{name}\".": "「{name}」をスキップしました。", + "Snooze…": "スヌーズ…", + "Snooze \"{name}\"": "「{name}」をスヌーズ", + "It leaves today's lists and comes back on its own. Snoozing never counts for or against the habit.": "今日のリストから外れ、時間になると戻ってきます。スヌーズは習慣の記録に影響しません。", + "Snooze for": "スヌーズする時間", + "30 minutes": "30分", + "1 hour": "1時間", + "3 hours": "3時間", + "Snooze until": "スヌーズの終了時刻", + "Snooze": "スヌーズ", + "Pick a time later today.": "今日のこれより後の時刻を選んでください。", + "Snoozed \"{name}\" until {time}.": "「{name}」を {time} までスヌーズしました。", + "1 hidden for today": "今日は1件非表示", + "{count} hidden for today": "今日は{count}件非表示", + "1 hidden for this day": "この日は1件非表示", + "{count} hidden for this day": "この日は{count}件非表示", + "Undo": "元に戻す", + "Click to undo": "クリックで元に戻す", + "Nothing left on this day's list.": "この日のリストには何も残っていません。", + "Nothing left on today's list.": "今日のリストには何も残っていません。", + "At least: reach a target for habits you are building, like drinking 1.5 litres of water. At most: stay within a limit for habits you are cutting down, like no more than 2 coffees.": "以上:身につけたい習慣の目標を達成します(例:水を1.5リットル飲む)。以下:減らしたい習慣を上限内に収めます(例:コーヒーは2杯まで)。", + "At least (reach a target)": "以上(目標を達成)", + "At most (stay within a limit)": "以下(上限内に収める)", + "Step size": "増減の単位", + "How much each + and − press adds or removes. Use a decimal such as 0.25 for amounts like litres.": "+ と − を1回押したときに増減する量です。リットルなどの量には 0.25 のような小数を使えます。", + "Decrease by {n}": "{n} 減らす", + "4 weeks": "4週間", + "12 weeks": "12週間", + "6 months": "6か月", + "1 year": "1年", + "Completion rate": "達成率", + "Monthly completion rate": "月間達成率", + "Daily activity": "日別アクティビティ", + "Week of {date}": "{date}の週", + "Since {date} · right-click to resume": + "{date} から · 右クリックで再開", + "Paused on this day": "この日は一時停止中", + "Mark as done": "完了にする", + "Mark as not done": "未完了にする", + Done: "完了", + "Not done": "未完了", + "Edit value": "値を編集", + Value: "値", + "Decrease by 1": "1 減らす", + "Increase by 1": "1 増やす", + "Increase by {n}": "{n} 増やす", + "Edit habit": "習慣を編集", + "Pause habit": "習慣を一時停止", + "Resume habit": "習慣を再開", + "Stop tracking": "トラッキングを停止", + "Remove habit": "習慣を削除", + 'Stop tracking "{name}"? It leaves the dashboard and stats, but its note and full history are kept. You can resume tracking any time from the note\'s metrics view.': + "「{name}」のトラッキングを停止しますか?ダッシュボードと統計から消えますが、ノートと履歴はすべて保存されます。ノートのメトリクス表示からいつでも再開できます。", + 'Remove "{name}"? Its note will be moved to the trash.': + "「{name}」を削除しますか?ノートはゴミ箱に移動されます。", + Remove: "削除", + "Perfect!": "パーフェクト!", + Today: "今日", + Yesterday: "昨日", + Tomorrow: "明日", + "Last 7 days": "過去7日間", + "Last 30 days": "過去30日間", + "This week": "今週", + "This month": "今月", + + // Sidebar panel + "Habits completed today": "今日完了した習慣", + "No habits yet.": "まだ習慣がありません。", + "Click to type a value": "クリックして値を入力", + "Open note": "ノートを開く", + + // Stats view + "No habits to show stats for yet.": + "統計を表示できる習慣がまだありません。", + Completion: "達成率", + "Best streak": "最長ストリーク", + "Perfect days": "パーフェクトな日", + Completions: "達成回数", + "Goals met": "達成した目標", + "{completed}/{days} days": "{completed}/{days} 日", + "{total} total": "合計 {total}", + best: "最高", + "perfect week": "パーフェクトな週", + "perfect month": "パーフェクトな月", + "weekly goal": "週間目標", + "monthly goal": "月間目標", + "{progress}/{goal} days · {label} · {pct}%": + "{progress}/{goal} 日 · {label} · {pct}%", + + // Habit metrics block + 'Place this block inside a habit note, or point it at one with "habit: ".': + "このブロックは習慣ノート内に置くか、「habit: <名前>」で習慣を指定してください。", + 'No habit called "{name}" was found.': + "「{name}」という習慣は見つかりませんでした。", + "No longer tracked since {date}. All history is kept.": + "{date} 以降トラッキングされていません。履歴はすべて保存されています。", + "No longer tracked. All history is kept.": + "トラッキングされていません。履歴はすべて保存されています。", + "Resume tracking": "トラッキングを再開", + "Paused since {date}. Paused days don't count against streaks or stats.": + "{date} から一時停止中。一時停止した日はストリークや統計に影響しません。", + "Paused. Paused days don't count against streaks or stats.": + "一時停止中。一時停止した日はストリークや統計に影響しません。", + "Current streak": "現在のストリーク", + "Days completed": "完了した日数", + "30-day rate": "30日間の達成率", + "Weekly completion rate": "週間達成率", + Logged: "記録", + Target: "目標", + + // Export modal + Title: "タイトル", + "Habits report": "習慣レポート", + "Date range": "期間", + "Custom range": "カスタム期間", + From: "開始", + To: "終了", + "Up to {n} days.": "最大 {n} 日。", + Content: "内容", + "Summary tiles": "サマリータイル", + "Completion trend chart": "達成率トレンドのグラフ", + "Daily grids": "日別グリッド", + "Goal progress": "目標の進捗", + Layout: "レイアウト", + Orientation: "向き", + Portrait: "縦", + Landscape: "横", + Density: "密度", + Comfortable: "ゆったり", + Compact: "コンパクト", + Monochrome: "モノクロ", + "Ink-friendly greys instead of accent colours.": + "アクセントカラーの代わりにインクにやさしいグレーを使います。", + "Export PDF": "PDF をエクスポート", + "No habits to export yet.": + "エクスポートできる習慣がまだありません。", + 'Exported to "{path}" in your vault.': + "ボルト内の「{path}」にエクスポートしました。", + + // Habit modal + "New habit": "新しい習慣", + Name: "名前", + Type: "タイプ", + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes.": + "バイナリは完了か未完了か。回数は目標に向けてカウント。時間は分を記録します。", + Binary: "バイナリ", + Repetition: "回数", + Timed: "時間", + "Daily target (minutes)": "1日の目標(分)", + "Daily target": "1日の目標", + Unit: "単位", + "Optional label shown next to the count.": + "カウントの横に表示される任意のラベル。", + Icon: "アイコン", + "Choose a Lucide icon or an emoji to represent this habit.": + "この習慣を表す Lucide アイコンか絵文字を選んでください。", + Emoji: "絵文字", + "Choose an emoji": "絵文字を選択", + "Clear icon": "アイコンをクリア", + "Choose icon": "アイコンを選択", + "Save changes": "変更を保存", + "Targets (optional)": "目標(任意)", + "Set an optional weekly or monthly goal for how many days you complete this habit. For example, hitting your daily goal on all 7 days is a weekly target of 7. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "この習慣を達成する日数について、週間または月間の目標を任意で設定できます。たとえば7日間すべてで1日の目標を達成すると週間目標は7です。パーフェクトのスイッチをオンにすると、期間の長さに関係なく毎日を自動的に目指します。", + "Perfect week": "パーフェクトな週", + "Aim to complete this habit every day of the week.": + "この習慣を週の毎日達成することを目指します。", + "Weekly target": "週間目標", + "Optional. Days to complete per week (max 7).": + "任意。1週間に達成する日数(最大7)。", + None: "なし", + "Perfect month": "パーフェクトな月", + "Aim to complete this habit every day of the month.": + "この習慣を月の毎日達成することを目指します。", + "Monthly target": "月間目標", + "Optional. Days to complete per month.": + "任意。1か月に達成する日数。", + Colour: "カラー", + "Pick a colour from your theme, or choose a custom one.": + "テーマのカラーから選ぶか、カスタムカラーを指定してください。", + "Your habit": "あなたの習慣", + + // Icon and colour pickers + "Search icons…": "アイコンを検索…", + "Search emojis…": "絵文字を検索…", + + // Comments + "Comments on cards": "カードのコメント", + "Show a comment flap on dashboard cards for jotting a note about any day.": + "ダッシュボードのカードにコメント用のフラップを表示し、その日のメモを書き留められます。", + "Add comment": "コメントを追加", + "Flip back": "表に戻す", + "Edit comment": "コメントを編集", + "Move day comments into note bodies": "日別コメントをノート本文へ移動", + "No comments left to move.": "移動するコメントはありません。", + "Moved comments in 1 note.": "1 件のノートのコメントを移動しました。", + "Moved comments in {n} notes.": "{n} 件のノートのコメントを移動しました。", + "Add a comment for this day…": "この日のコメントを追加…", + Comments: "コメント", + + // Limit habits (experimental) + Experimental: "実験的機能", + "These features are still being tested and may change before they become permanent. Turning one off only hides it from menus — anything you created with it keeps working.": + "これらの機能はまだテスト中で、正式版になる前に変更される可能性があります。オフにしてもメニューから隠れるだけで、作成したものはそのまま動き続けます。", + "Break bad habits": "悪い習慣を断つ", + "Track habits you want to reduce or avoid by staying under a daily limit — for example at most 2 hours of gaming, or no smoking at all.": + "1日の上限内に収めることで、減らしたい・やめたい習慣をトラッキングします。たとえばゲームは1日2時間まで、喫煙はゼロなど。", + Goal: "ゴール", + "Reach a target for habits you are building. Stay under a limit for habits you are cutting down or giving up.": + "身につけたい習慣は目標を達成し、減らしたい・やめたい習慣は上限内にとどめます。", + "Reach a target": "目標を達成する", + "Stay under a limit": "上限内にとどめる", + "Binary means avoiding it entirely. Repetition counts against a daily limit. Timed tracks minutes against a daily limit.": + "バイナリは完全に避けること。回数は1日の上限に対してカウント。時間は1日の上限に対して分を記録します。", + "Daily limit": "1日の上限", + "Daily limit (minutes)": "1日の上限(分)", + "0 means none at all.": "0 は一切なしという意味です。", + "Set an optional weekly or monthly goal for how many days you stay within your limit. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "上限内に収めた日数について、週間または月間の目標を任意で設定できます。パーフェクトのスイッチをオンにすると、期間の長さに関係なく毎日を自動的に目指します。", + Clean: "クリーン", + Slipped: "スリップ", + "Mark as clean": "クリーンにする", + "Mark as slipped": "スリップにする", + "Days within limit": "上限内の日数", + Limit: "上限", + + // Frequencies and per-note metrics + Frequency: "頻度", + Daily: "毎日", + "Days of week": "曜日", + Habit: "習慣", + Schedule: "スケジュール", + "Time of day": "時刻", + "Optional times this habit is planned for — once or several times a day. Shown on the habit's card.": + "この習慣を行う予定時刻(任意)。1日1回または複数回。習慣のカードに表示されます。", + "Add time": "時刻を追加", + "Remove time": "時刻を削除", + "Every N days": "N日ごと", + "Repeat every": "繰り返し間隔", + "Day of month": "日にち", + "The weekdays this habit is due on. Pick as many as you need.": + "この習慣の期日となる曜日。複数選択できます。", + "Number of days between due dates, counted from the habit's start date. Use 2 for an alternate-day schedule.": + "期日と期日の間の日数。習慣の開始日から数えます。2にすると1日おきになります。", + "The day of the month this habit is due. In shorter months it falls due on the last day, so 31 always lands on the final day of the month.": + "この習慣の期日となる日。短い月では月末が期日になるため、31 は常にその月の最終日になります。", + "Every {day}": "毎週 {day}", + "Monthly · day {day}": "毎月 · {day} 日", + "Every other day": "1日おき", + "Every {n} days": "{n}日ごと", + "No habits are due on this day.": + "この日に期日の習慣はありません。", + "Nothing due today.": "今日は期日のものがありません。", + "Weekly activity": "週間アクティビティ", + "Monthly activity": "月間アクティビティ", + "Activity on due days": "期日の活動", + "Completion rate over {n} due days": "直近{n}回の期日の達成率", + "Weeks completed": "完了した週", + "Months completed": "完了した月", + "Recent rate": "最近の達成率", + "{n}-week completion rate": "{n} 週間の達成率", + "{n}-month completion rate": "{n} か月の達成率", + + // AI summaries + "AI summaries": "AI サマリー", + "AI summary": "AI サマリー", + "Show an AI-generated summary with feedback and advice on the stats page tabs. Uses an OpenAI-compatible service you configure below; your habit stats are sent to it only when you press the generate button.": + "統計ページのタブに、フィードバックとアドバイス付きの AI 生成サマリーを表示します。下で設定する OpenAI 互換サービスを使用し、習慣の統計は生成ボタンを押したときにのみ送信されます。", + "AI base URL": "AI ベース URL", + "Base URL of an OpenAI-compatible API. Works with OpenAI, OpenRouter, or local servers like Ollama (http://localhost:11434/v1).": + "OpenAI 互換 API のベース URL。OpenAI、OpenRouter、Ollama(http://localhost:11434/v1)などのローカルサーバーで動作します。", + "AI API key": "AI API キー", + "Stored locally in this vault's plugin data. Leave blank for local servers that need no key.": + "このボルトのプラグインデータにローカル保存されます。キー不要のローカルサーバーでは空欄のままにしてください。", + "AI model": "AI モデル", + "Model name the service should use.": + "サービスが使用するモデル名。", + "Generate summary": "サマリーを生成", + Regenerate: "再生成", + "Get feedback and advice on your habits for this period. Your stats are sent to the AI service you configured only when you press the button.": + "この期間の習慣についてフィードバックとアドバイスを受け取ります。統計は、ボタンを押したときにのみ設定した AI サービスへ送信されます。", + "Thinking…": "考え中…", + "Could not generate a summary: {message}": + "サマリーを生成できませんでした:{message}", + "Adds an AI-generated overview with feedback and advice. Your habit stats are sent to your configured AI service.": + "フィードバックとアドバイス付きの AI 生成概要を追加します。習慣の統計は設定した AI サービスへ送信されます。", + "Generating AI summary…": "AI サマリーを生成中…", + "The AI summary will be generated when you export.": + "AI サマリーはエクスポート時に生成されます。", + + // Custom stats range + Custom: "カスタム", + "Start date": "開始日", + "End date": "終了日", + + // Heatmap start markers + "not tracked yet": "まだ記録なし", + "started tracking on {date}": "{date} にトラッキング開始", + + // Stats carousel + "Stats rows per page": "1ページあたりの統計行数", + "How many habits each stats page shows.": + "各統計ページに表示する習慣の数。", + // Note habits + '"{name}" uses Templater syntax, but the Templater plugin is not installed — the template was copied as plain text.': + "「{name}」はTemplater構文を使用していますが、Templaterプラグインがインストールされていません — テンプレートはプレーンテキストとしてコピーされました。", + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes. Note is completed by writing in a per-day note.": + "バイナリは完了か未完了か。回数は目標に向けてカウント。時間は分を記録します。ノートは日ごとのノートに書き込むことで完了します。", + "Character count is reached": "文字数に到達する", + "Character goal": "文字数の目標", + "Completed when": "完了の条件", + "Every task is checked": "すべてのタスクにチェックが入る", + "Filename format": "ファイル名の形式", + "Folder each day's note is created in. Leave blank for a dedicated subfolder named after this habit.": + "毎日のノートを作成するフォルダー。空欄のままにすると、この習慣の名前が付いた専用サブフォルダーが使われます。", + "Moment.js format used to name each day's note, e.g. {example}. May include / for date-based subfolders.": + "毎日のノートの名前に使うMoment.js形式。例:{example}。日付ごとのサブフォルダーには / を含めることができます。", + Note: "ノート", + "Note habits": "ノート習慣", + "Notes folder": "ノートのフォルダー", + "Open this day's note": "この日のノートを開く", + "Open today's note": "今日のノートを開く", + "Optional template note used when a day's note is created. Expanded through the Templater plugin when it is installed, otherwise copied as plain text.": + "日ごとのノート作成時に使う任意のテンプレートノート。Templaterプラグインがインストールされていれば展開され、なければプレーンテキストとしてコピーされます。", + Template: "テンプレート", + "Track a habit by writing in a per-day note instead of logging a value by hand. A day is complete once the note reaches a character count or every task in it is checked. Works with the Templater plugin to create each day's note from a template.": + "値を手動で記録する代わりに、日ごとのノートに書き込むことで習慣を記録します。ノートが文字数に到達するか、すべてのタスクにチェックが入ると、その日は完了になります。Templaterプラグインと連携し、テンプレートから毎日のノートを作成できます。", + Write: "書く", + "Write this day's note": "この日のノートを書く", + "Write today's note": "今日のノートを書く", + "e.g. Journal": "例: Journal", + "e.g. Templates/Journal.md": "例: Templates/Journal.md", + + // Flexible frequency (any day) + "How many times (or, for counted and timed habits, how much in total) this needs to happen somewhere in the period.": + "期間内のどこかでこれが何回(カウントや時間の習慣では合計でどれだけ)必要かを指定します。", + 'How often this habit is due. Weekly and monthly habits only appear on their due date; the "any day" options appear every day until their quota is met.': + "この習慣の頻度。週間・月間の習慣は期日にのみ表示されますが、「任意の日」オプションはノルマを達成するまで毎日表示されます。", + "Monthly (any day)": "月間(任意の日)", + "Times per month": "月あたりの回数", + "Times per week": "週あたりの回数", + "Weekly (any day)": "週間(任意の日)", + "this month": "今月", + "this week": "今週", + "{completed}/{days} months": "{completed}/{days} か月", + "{completed}/{days} weeks": "{completed}/{days} 週", + "{n}× a month · any day": "月{n}回 · 任意の日", + "{n}× a week · any day": "週{n}回 · 任意の日", + + // Commands + "Insert habits heatmap": "習慣ヒートマップを挿入", + + // Habit metrics: heatmap tabs + Charts: "グラフ", + Month: "月", + History: "履歴", + "{month} heatmap": "{month}のヒートマップ", + "Last {n} weeks": "直近{n}週間", + + // Heatmap cell states and tooltips + Upcoming: "今後", + "Not tracked yet": "まだ記録なし", + "Not due": "対象外", + "Outside this month": "今月の範囲外", + Complete: "達成", + "Over limit": "上限超過", + "Not logged": "未記録", + + // Whole-vault heatmap block + "Add a habit to see its heatmap here.": "習慣を追加すると、ここにヒートマップが表示されます。", + "No habits in the \"{group}\" group.": "「{group}」グループに習慣がありません。", + "No habits due": "予定されている習慣なし", + "Perfect day": "パーフェクトな日", + "{completed}/{considered} habits · {pct}%": + "{completed}/{considered} 件の習慣 · {pct}%", + "This year": "今年", + "Past 6 months": "過去6か月", + "{year} heatmap": "{year}年のヒートマップ", + + // Note habits: checklist requirement and fail keyword + "Both are true": "両方とも満たす", + "Checklist requirement is met": "チェックリストの条件を満たす", + "Checklist requirement": "チェックリストの条件", + "Require every task to be checked, or just some — useful for a list of alternatives where doing any one of them counts (e.g. \"Cardio\" / \"Weights\" / \"Rest day\").": + "すべてのタスクにチェックを必須にするか、一部だけでもよいことにするか選べます — 「有酸素運動」「筋トレ」「休養日」のように、どれか一つで達成とみなしたい選択肢リストに便利です。", + "At least this many are checked": "少なくともこの数だけチェックが入る", + "Tasks required": "必要なタスク数", + "Fail keyword": "失敗キーワード", + "Optional. Checking a task whose text contains this word forces the day to fail, whatever else is checked — e.g. \"Slipped\" as one of several checklist options. Leave blank to turn this off.": + "任意設定です。テキストにこの単語を含むタスクにチェックを入れると、他に何をチェックしていても、その日は強制的に失敗扱いになります — 例えば「失敗」をチェックリストの選択肢の一つにする、といった使い方です。空欄にするとオフになります。", + "e.g. Slipped": "例: 失敗", + "Reach a character count, meet a checklist requirement, or require both.": + "文字数に到達する、チェックリストの条件を満たす、またはその両方を必須にする、から選べます。", + + // Tags (cross-plugin compatibility) + Tags: "タグ", + "e.g. task": "例: task", + "Optional Obsidian tags for this note, separated by commas or spaces. Useful for making this habit recognisable to another plugin's own tag-based rules — for example TaskNotes' task tag.": + "このノートの任意の Obsidian タグです。カンマまたはスペースで区切ります。別のプラグイン独自のタグルールにこの習慣を認識させるのに便利です — 例えば TaskNotes の task タグなど。", + + // Advanced settings: frontmatter key remapping + Advanced: "詳細設定", + Apply: "適用", + "Apply key changes": "キーの変更を適用", + "Rename the frontmatter properties habit notes use. Useful for avoiding collisions with another plugin's own properties in the same note (for example TaskNotes).": + "習慣ノートが使用するフロントマターのプロパティ名を変更します。同じノート内で別のプラグイン(例: TaskNotes)独自のプロパティと衝突するのを避けるのに便利です。", + "\"{a}\" and \"{b}\" can't use the same property key (\"{value}\").": + "「{a}」と「{b}」に同じプロパティキー(「{value}」)は使用できません。", + "Property keys can't be empty.": "プロパティキーを空にすることはできません。", + "This renames {summary} in every note in your habits folder ({count} habit(s) currently). Existing values are moved, not discarded. Continue?": + "これにより、習慣フォルダー内のすべてのノート(現在 {count} 件の習慣)で {summary} の名前が変更されます。既存の値は破棄されず移動します。続行しますか?", + "Updated the frontmatter keys in {count} note(s).": + "{count} 件のノートでフロントマターのキーを更新しました。", + "Renaming this away from the default also changes how binary habits log a day: instead of {\"2026-08-25\": 1}, a completed day becomes a bare date, like [\"2026-08-25\"] — the shape TaskNotes uses for complete_instances. Repetition and timed habits are unaffected either way; they always need a value, never just a date.": + 'このキーを既定値から変更すると、バイナリ習慣が1日をどう記録するかも変わります。{"2026-08-25": 1} の代わりに、完了した日は ["2026-08-25"] のような単なる日付になります — これは TaskNotes が complete_instances に使う形式です。回数記録・時間記録の習慣はどちらの場合も影響を受けません。常に値が必要で、日付だけになることはありません。', + Identity: "識別情報", + Legacy: "レガシー", + Lifecycle: "ライフサイクル", + Presentation: "表示", + "Note habit": "ノート習慣", + "Habit type key": "習慣タイプキー", + "Completion records key": "完了記録キー", + "Frequency key": "頻度キー", + "Weekday key": "曜日キー", + "Month day key": "月内日キー", + "Interval days key": "間隔日数キー", + "Planned time key": "予定時刻キー", + "Goal direction key": "目標の方向キー", + "Target key": "目標キー", + "Unit key": "単位キー", + "Step size key": "増減単位キー", + "Weekly target key": "週間目標キー", + "Monthly target key": "月間目標キー", + "Weekly perfect key": "パーフェクト週キー", + "Monthly perfect key": "パーフェクト月キー", + "Start date key": "開始日キー", + "Pauses key": "一時停止記録キー", + "Stopped key": "停止状態キー", + "Stop date key": "停止日キー", + "Icon key": "アイコンキー", + "Color key": "色キー", + "Group key": "グループキー", + "Use group color key": "「グループの色を使用」キー", + "Note folder key": "ノートフォルダーキー", + "Note filename format key": "ノートのファイル名形式キー", + "Template path key": "テンプレートパスキー", + "Note completion mode key": "ノート完了モードキー", + "Note checklist requirement key": "チェックリスト条件キー", + "Note checklist minimum key": "チェックリスト最小数キー", + "Note fail keyword key": "失敗ワードのキー", + "Legacy comments key": "旧形式コメントキー", + + // PDF export (read via docT() in export-modal.ts, which falls back to English for zh — jsPDF's built-in fonts can't render CJK) + "Completion trend": "達成率トレンド", + "(paused)": "(一時停止中)", + "{rate}% · {total} · streak {current} (best {best})": + "{rate}% · {total} · ストリーク {current}(最高 {best})", + "Goal: {completed}/{goal} days met": + "目標:{completed}/{goal} 日達成", + "{range} · exported {date}": "{range} · {date} にエクスポート", + "+{n} more": "他 {n} 件", + + // Back-dating a missed day + Back: "戻る", + + // Rescheduling missed habits (experimental) + "1 missed habit": "見逃した習慣が1件", + "Add a notification button to the dashboard and sidebar panel when a habit's been missed, opening a review of missed days you can move onto a different one (never a day that habit is already due, so nothing doubles up).": + "習慣を見逃したときに、ダッシュボードとサイドパネルに通知ボタンを追加します。見逃した日を確認し、別の日に移動できます(その習慣がもともと予定されている日には移動できないため、二重記録にはなりません)。", + "Missed habits": "見逃した習慣", + "Move this missed day onto a different one": "この見逃した日を別の日に移動", + "Move to": "移動先", + "Nothing missed right now.": "現在、見逃したものはありません。", + "Pick a habit to move it onto a different day.": "別の日に移動する習慣を選んでください。", + Reschedule: "リスケジュール", + "Reschedule missed habits": "見逃した習慣をリスケジュール", + "Rescheduled \"{name}\" to {date}.": "「{name}」を{date}にリスケジュールしました。", + "Rescheduled from {date}": "{date}からリスケジュール", + "Reschedules key": "リスケジュールキー", + "Failed days key": "失敗した日のキー", + "Skipped days key": "スキップした日のキー", + "Rescheduling \"{name}\" — missed {date}.": + "「{name}」をリスケジュール中 — {date}に見逃しました。", + "That day no longer works — pick another.": "その日はもう使えません — 別の日を選んでください。", + "That day won't work — it's either already due for this habit or already claimed by another reschedule.": + "その日は使えません — その習慣がもともとその日に予定されているか、すでに別のリスケジュールで使われています。", + "{count} missed habits": "見逃した習慣が{count}件", +}; diff --git a/src/integrations/habits/i18n/ko.ts b/src/integrations/habits/i18n/ko.ts new file mode 100644 index 000000000..b8d767807 --- /dev/null +++ b/src/integrations/habits/i18n/ko.ts @@ -0,0 +1,644 @@ +/** Korean translations, keyed by the English source string. */ +export const ko: Record = { + // Commands and ribbon + "Create habit": "습관 만들기", + "Insert dashboard": "대시보드 삽입", + "Insert habit metrics": "습관 지표 삽입", + "Insert habits table": "습관 표 삽입", + "Open panel": "패널 열기", + "Open habits panel": "습관 패널 열기", + Habits: "습관", + + // Settings + "Habits folder": "습관 폴더", + "Folder where each habit is stored as its own note. It is created automatically if it does not exist.": + "각 습관이 개별 노트로 저장되는 폴더입니다. 없으면 자동으로 생성됩니다.", + "Follow daily note date": "데일리 노트 날짜 따라가기", + "When a dashboard is embedded in a daily note (a note whose name contains a date like 2026-07-01), open it on that note's date instead of today.": + "대시보드가 데일리 노트(이름에 2026-07-01 같은 날짜가 포함된 노트)에 삽입된 경우, 오늘 대신 해당 노트의 날짜로 엽니다.", + "Daily note date format": "데일리 노트 날짜 형식", + "Moment.js format used to read the date from a daily note's name, such as YYYY-MM-DD or YYYYMMDD.": + "데일리 노트 이름에서 날짜를 읽는 데 사용하는 Moment.js 형식입니다. 예: YYYY-MM-DD, YYYYMMDD.", + + // Sorting + "Sort habits by": "습관 정렬 기준", + "The base order of habit cards in the dashboard and side panel.": + "대시보드와 사이드 패널에서 습관 카드의 기본 순서.", + "Name (A–Z)": "이름(A–Z)", + Color: "색상", + "Last logged": "마지막 기록", + "Planned time": "예정 시간", + Manual: "수동", + "Manual order": "수동 순서", + "Drag the cards into the order you want. New habits join the end of the list.": + "카드를 원하는 순서로 드래그하세요. 새 습관은 목록 끝에 추가됩니다.", + "Move completed cards to the end": "완료된 카드를 끝으로 이동", + "Completed habits drift to the end of the queue and paused ones park behind them. Turn this off to keep every card in its sorted position.": + "완료된 습관은 대기열 끝으로 이동하고 일시정지된 습관은 그 뒤에 놓입니다. 끄면 모든 카드가 정렬된 위치를 유지합니다.", + Group: "그룹", + Ungrouped: "그룹 없음", + "Optional group used to build dashboard sections — for example an area of responsibility.": + "대시보드 섹션을 만들기 위한 선택적 그룹 — 예를 들어 책임 영역.", + "e.g. Health": "예: 건강", + "Group color": "그룹 색상", + "Optional color shared by every habit in this group.": + "이 그룹의 모든 습관이 공유하는 선택적 색상.", + "Group icon": "그룹 아이콘", + "Shown in the group lip on cards and in section headers.": + "카드의 그룹 표시줄과 섹션 머리글에 표시됩니다.", + "Use group color for this card": "이 카드에 그룹 색상 사용", + "Show this card in the group color instead of its own.": + "이 카드를 자체 색상 대신 그룹 색상으로 표시합니다.", + General: "일반", + Sorting: "정렬", + Groups: "그룹", + "How to move through your habit cards: a paged carousel with arrows, a grid that wraps onto new rows, or a fixed-height grid that scrolls vertically. The stats page follows the same choice.": + "습관 카드 탐색 방식: 화살표로 넘기는 캐러셀, 새 줄로 이어지는 그리드, 또는 고정 높이에서 세로로 스크롤되는 그리드. 통계 페이지도 같은 설정을 따릅니다.", + "Enable groups": "그룹 사용", + "Show habits in sections by their group, with a group lip on each card.": + "습관을 그룹별 섹션으로 표시하고 각 카드에 그룹 표시줄을 붙입니다.", + "Group order": "그룹 순서", + "Drag the groups into the order you want. Sections follow the same order.": + "그룹을 원하는 순서로 드래그하세요. 섹션도 같은 순서를 따릅니다.", + "Completion animations": "완료 애니메이션", + "Play the check swoosh, card departure, and perfect-day confetti when habits are completed. Turn off for instant, quiet updates.": + "습관을 완료할 때 체크 스우시, 카드 퇴장, 완벽한 하루 색종이를 재생합니다. 끄면 즉시 조용히 갱신됩니다.", + "Reminders": "알림", + "Write reminders for due habits": "오늘 해야 할 습관의 알림 작성", + "Each day, write one reminder checklist line per planned time of every habit due that day, in the format the Reminder plugin picks up. The lines live in a marked block and refresh as you log habits.": + "매일 그날 해야 할 각 습관의 예정 시간마다 알림 체크리스트 한 줄을 Reminder 플러그인이 인식하는 형식으로 작성합니다. 이 줄들은 표시된 블록 안에 있으며 기록에 따라 갱신됩니다.", + "Where to write reminders": "알림을 작성할 위치", + "The daily note follows the Daily notes core plugin's folder and date format; the block is added once the note exists. A fixed note is created automatically.": + "데일리 노트는 코어 데일리 노트 플러그인의 폴더와 날짜 형식을 따르며, 노트가 존재하면 블록이 추가됩니다. 고정 노트는 자동으로 생성됩니다.", + "Today's daily note": "오늘의 데일리 노트", + "A fixed note": "고정 노트", + "Reminder note path": "알림 노트 경로", + "Vault path of the note that holds the reminder block.": + "알림 블록을 담는 노트의 볼트 경로.", + "Manage groups": "그룹 관리", + "See every habit by group and drag cards between groups.": + "그룹별로 습관을 보고 카드를 그룹 간에 드래그하세요.", + Open: "열기", + "New group": "새 그룹", + Add: "추가", + "Drag habits between groups to reassign them, or within a group to reorder them.": + "습관을 그룹 간에 드래그하여 다시 지정하거나, 그룹 안에서 드래그하여 순서를 바꾸세요.", + "No habits": "습관 없음", + "Edit group style": "그룹 스타일 편집", + "Delete group": "그룹 삭제", + 'Delete "{name}"? Its habits are kept and become ungrouped.': + '"{name}"을(를) 삭제할까요? 습관은 유지되며 그룹 없음이 됩니다.', + Delete: "삭제", + "Dashboard layout": "대시보드 레이아웃", + Carousel: "캐러셀", + Grid: "그리드", + "Vertical scroll": "세로 스크롤", + "Cards per view": "한 화면당 카드 수", + "How many habit cards fit side by side on wider screens.": + "넓은 화면에서 나란히 표시할 습관 카드 수.", + "Cards per view on mobile": "모바일 한 화면당 카드 수", + "How many habit cards fit side by side on phone-sized screens.": + "휴대폰 화면에서 나란히 표시할 습관 카드 수.", + + // Confirm dialog defaults + Cancel: "취소", + Confirm: "확인", + + // Store notices + 'Could not find the note for "{name}".': + "“{name}”의 노트를 찾을 수 없습니다.", + "Please enter a valid habit name.": "올바른 습관 이름을 입력하세요.", + 'A habit called "{name}" already exists.': + "“{name}” 습관이 이미 있습니다.", + 'Created habit "{name}".': "습관 “{name}”을(를) 만들었습니다.", + 'Updated "{name}".': "“{name}”을(를) 업데이트했습니다.", + 'Paused "{name}".': "“{name}”을(를) 일시정지했습니다.", + 'Resumed "{name}".': "“{name}”을(를) 재개했습니다.", + 'Stopped tracking "{name}". Its history is kept in the note.': + "“{name}” 추적을 중단했습니다. 기록은 노트에 보관됩니다.", + 'Resumed tracking "{name}".': "“{name}” 추적을 재개했습니다.", + 'Removed "{name}".': "“{name}”을(를) 삭제했습니다.", + "Habit added to the dashboard.": "습관을 대시보드에 추가했습니다.", + + // Dashboard + "Back to habits": "습관으로 돌아가기", + "View stats": "통계 보기", + "Export stats": "통계 내보내기", + Weekly: "주간", + Monthly: "월간", + "Previous day": "이전 날", + "Next day": "다음 날", + "Choose a date": "날짜 선택", + "Add habit": "습관 추가", + "No habits yet. Create your first habit to get started.": + "아직 습관이 없습니다. 첫 습관을 만들어 시작해 보세요.", + Previous: "이전", + Next: "다음", + "Go to position {n}": "{n}번 위치로 이동", + "Right-click or long-press for more options": + "더 많은 옵션은 우클릭 또는 길게 누르기", + "Open habit note": "습관 노트 열기", + "Open the note for {name}": "{name} 노트 열기", + Paused: "일시정지됨", + Stopped: "추적 중지됨", + "Failed": "실패", + "Skipped": "건너뜀", + "Snoozed": "다시 알림 대기", + "Snoozed until {time}": "{time}까지 다시 알림 대기", + "Undo fail": "실패 취소", + "Undo skip": "건너뛰기 취소", + "End snooze": "다시 알림 종료", + "Fail for today": "오늘은 실패로 표시", + "Fail this day": "이 날을 실패로 표시", + "Marked \"{name}\" as failed.": "\"{name}\"을(를) 실패로 표시했습니다.", + "Skip for today": "오늘은 건너뛰기", + "Skip this day": "이 날 건너뛰기", + "Skipped \"{name}\".": "\"{name}\"을(를) 건너뛰었습니다.", + "Snooze…": "다시 알림…", + "Snooze \"{name}\"": "\"{name}\" 다시 알림", + "It leaves today's lists and comes back on its own. Snoozing never counts for or against the habit.": "오늘 목록에서 사라졌다가 저절로 돌아옵니다. 다시 알림은 습관 기록에 영향을 주지 않습니다.", + "Snooze for": "다시 알림 시간", + "30 minutes": "30분", + "1 hour": "1시간", + "3 hours": "3시간", + "Snooze until": "다시 알림 종료 시각", + "Snooze": "다시 알림", + "Pick a time later today.": "오늘 이후의 시각을 선택하세요.", + "Snoozed \"{name}\" until {time}.": "\"{name}\"을(를) {time}까지 다시 알림으로 설정했습니다.", + "1 hidden for today": "오늘 1개 숨김", + "{count} hidden for today": "오늘 {count}개 숨김", + "1 hidden for this day": "이 날 1개 숨김", + "{count} hidden for this day": "이 날 {count}개 숨김", + "Undo": "실행 취소", + "Click to undo": "클릭하여 실행 취소", + "Nothing left on this day's list.": "이 날 목록에 남은 항목이 없습니다.", + "Nothing left on today's list.": "오늘 목록에 남은 항목이 없습니다.", + "At least: reach a target for habits you are building, like drinking 1.5 litres of water. At most: stay within a limit for habits you are cutting down, like no more than 2 coffees.": "이상: 만들고 싶은 습관의 목표를 달성합니다(예: 물 1.5리터 마시기). 이하: 줄이고 싶은 습관을 한도 안에서 유지합니다(예: 커피 2잔 이하).", + "At least (reach a target)": "이상 (목표 달성)", + "At most (stay within a limit)": "이하 (한도 유지)", + "Step size": "증감 단위", + "How much each + and − press adds or removes. Use a decimal such as 0.25 for amounts like litres.": "+ 와 − 를 한 번 누를 때 더하거나 빼는 양입니다. 리터 같은 양에는 0.25 같은 소수를 사용하세요.", + "Decrease by {n}": "{n}만큼 줄이기", + "4 weeks": "4주", + "12 weeks": "12주", + "6 months": "6개월", + "1 year": "1년", + "Completion rate": "달성률", + "Monthly completion rate": "월간 달성률", + "Daily activity": "일별 활동", + "Week of {date}": "{date} 주", + "Since {date} · right-click to resume": + "{date}부터 · 우클릭으로 재개", + "Paused on this day": "이 날은 일시정지됨", + "Mark as done": "완료로 표시", + "Mark as not done": "미완료로 표시", + Done: "완료", + "Not done": "미완료", + "Edit value": "값 편집", + Value: "값", + "Decrease by 1": "1 줄이기", + "Increase by 1": "1 늘리기", + "Increase by {n}": "{n} 늘리기", + "Edit habit": "습관 편집", + "Pause habit": "습관 일시정지", + "Resume habit": "습관 재개", + "Stop tracking": "추적 중단", + "Remove habit": "습관 삭제", + 'Stop tracking "{name}"? It leaves the dashboard and stats, but its note and full history are kept. You can resume tracking any time from the note\'s metrics view.': + "“{name}” 추적을 중단할까요? 대시보드와 통계에서 사라지지만 노트와 전체 기록은 보관됩니다. 노트의 지표 화면에서 언제든지 다시 시작할 수 있습니다.", + 'Remove "{name}"? Its note will be moved to the trash.': + "“{name}”을(를) 삭제할까요? 노트는 휴지통으로 이동합니다.", + Remove: "삭제", + "Perfect!": "퍼펙트!", + Today: "오늘", + Yesterday: "어제", + Tomorrow: "내일", + "Last 7 days": "지난 7일", + "Last 30 days": "지난 30일", + "This week": "이번 주", + "This month": "이번 달", + + // Sidebar panel + "Habits completed today": "오늘 완료한 습관", + "No habits yet.": "아직 습관이 없습니다.", + "Click to type a value": "클릭해서 값 입력", + "Open note": "노트 열기", + + // Stats view + "No habits to show stats for yet.": + "아직 통계를 표시할 습관이 없습니다.", + Completion: "달성률", + "Best streak": "최고 연속 기록", + "Perfect days": "퍼펙트한 날", + Completions: "달성 횟수", + "Goals met": "달성한 목표", + "{completed}/{days} days": "{completed}/{days}일", + "{total} total": "총 {total}", + best: "최고", + "perfect week": "퍼펙트한 주", + "perfect month": "퍼펙트한 달", + "weekly goal": "주간 목표", + "monthly goal": "월간 목표", + "{progress}/{goal} days · {label} · {pct}%": + "{progress}/{goal}일 · {label} · {pct}%", + + // Habit metrics block + 'Place this block inside a habit note, or point it at one with "habit: ".': + "이 블록을 습관 노트 안에 넣거나 “habit: <이름>”으로 습관을 지정하세요.", + 'No habit called "{name}" was found.': + "“{name}” 습관을 찾을 수 없습니다.", + "No longer tracked since {date}. All history is kept.": + "{date}부터 더 이상 추적하지 않습니다. 모든 기록은 보관됩니다.", + "No longer tracked. All history is kept.": + "더 이상 추적하지 않습니다. 모든 기록은 보관됩니다.", + "Resume tracking": "추적 재개", + "Paused since {date}. Paused days don't count against streaks or stats.": + "{date}부터 일시정지됨. 일시정지된 날은 연속 기록이나 통계에 영향을 주지 않습니다.", + "Paused. Paused days don't count against streaks or stats.": + "일시정지됨. 일시정지된 날은 연속 기록이나 통계에 영향을 주지 않습니다.", + "Current streak": "현재 연속 기록", + "Days completed": "완료한 일수", + "30-day rate": "30일 달성률", + "Weekly completion rate": "주간 달성률", + Logged: "기록", + Target: "목표", + + // Export modal + Title: "제목", + "Habits report": "습관 보고서", + "Date range": "기간", + "Custom range": "사용자 지정 기간", + From: "시작", + To: "끝", + "Up to {n} days.": "최대 {n}일.", + Content: "내용", + "Summary tiles": "요약 타일", + "Completion trend chart": "달성률 추이 차트", + "Daily grids": "일별 그리드", + "Goal progress": "목표 진행률", + Layout: "레이아웃", + Orientation: "방향", + Portrait: "세로", + Landscape: "가로", + Density: "밀도", + Comfortable: "여유", + Compact: "간결", + Monochrome: "흑백", + "Ink-friendly greys instead of accent colours.": + "강조 색 대신 잉크를 아끼는 회색을 사용합니다.", + "Export PDF": "PDF 내보내기", + "No habits to export yet.": + "아직 내보낼 습관이 없습니다.", + 'Exported to "{path}" in your vault.': + "보관소의 “{path}”에 내보냈습니다.", + + // Habit modal + "New habit": "새 습관", + Name: "이름", + Type: "유형", + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes.": + "이진은 완료 여부만 기록합니다. 반복은 목표 횟수를 세고, 시간은 분을 기록합니다.", + Binary: "이진", + Repetition: "반복", + Timed: "시간", + "Daily target (minutes)": "일일 목표(분)", + "Daily target": "일일 목표", + Unit: "단위", + "Optional label shown next to the count.": + "횟수 옆에 표시되는 선택적 라벨입니다.", + Icon: "아이콘", + "Choose a Lucide icon or an emoji to represent this habit.": + "이 습관을 나타낼 Lucide 아이콘이나 이모지를 선택하세요.", + Emoji: "이모지", + "Choose an emoji": "이모지 선택", + "Clear icon": "아이콘 지우기", + "Choose icon": "아이콘 선택", + "Save changes": "변경 사항 저장", + "Targets (optional)": "목표(선택)", + "Set an optional weekly or monthly goal for how many days you complete this habit. For example, hitting your daily goal on all 7 days is a weekly target of 7. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "이 습관을 달성할 일수에 대한 주간 또는 월간 목표를 선택적으로 설정하세요. 예를 들어 7일 모두 일일 목표를 달성하면 주간 목표는 7입니다. 퍼펙트 토글을 켜면 기간 길이와 관계없이 자동으로 매일을 목표로 합니다.", + "Perfect week": "퍼펙트한 주", + "Aim to complete this habit every day of the week.": + "이 습관을 일주일 내내 달성하는 것을 목표로 합니다.", + "Weekly target": "주간 목표", + "Optional. Days to complete per week (max 7).": + "선택. 일주일에 달성할 일수(최대 7).", + None: "없음", + "Perfect month": "퍼펙트한 달", + "Aim to complete this habit every day of the month.": + "이 습관을 한 달 내내 달성하는 것을 목표로 합니다.", + "Monthly target": "월간 목표", + "Optional. Days to complete per month.": + "선택. 한 달에 달성할 일수.", + Colour: "색상", + "Pick a colour from your theme, or choose a custom one.": + "테마 색상 중에서 고르거나 사용자 지정 색상을 선택하세요.", + "Your habit": "나의 습관", + + // Icon and colour pickers + "Search icons…": "아이콘 검색…", + "Search emojis…": "이모지 검색…", + + // Comments + "Comments on cards": "카드 코멘트", + "Show a comment flap on dashboard cards for jotting a note about any day.": + "대시보드 카드에 코멘트 플랩을 표시해 그날에 대한 메모를 남길 수 있습니다.", + "Add comment": "코멘트 추가", + "Flip back": "앞면으로 돌리기", + "Edit comment": "코멘트 편집", + "Move day comments into note bodies": "일별 코멘트를 노트 본문으로 이동", + "No comments left to move.": "이동할 코멘트가 없습니다.", + "Moved comments in 1 note.": "노트 1개의 코멘트를 이동했습니다.", + "Moved comments in {n} notes.": "노트 {n}개의 코멘트를 이동했습니다.", + "Add a comment for this day…": "이 날에 대한 코멘트 추가…", + Comments: "코멘트", + + // Limit habits (experimental) + Experimental: "실험 기능", + "These features are still being tested and may change before they become permanent. Turning one off only hides it from menus — anything you created with it keeps working.": + "이 기능들은 아직 테스트 중이며 정식 기능이 되기 전에 바뀔 수 있습니다. 끄면 메뉴에서 숨겨질 뿐, 이미 만든 것은 계속 작동합니다.", + "Break bad habits": "나쁜 습관 끊기", + "Track habits you want to reduce or avoid by staying under a daily limit — for example at most 2 hours of gaming, or no smoking at all.": + "하루 한도 안에 머무는 방식으로 줄이거나 피하고 싶은 습관을 추적합니다. 예: 게임 하루 최대 2시간, 금연.", + Goal: "목표", + "Reach a target for habits you are building. Stay under a limit for habits you are cutting down or giving up.": + "만들고 싶은 습관은 목표를 달성하고, 줄이거나 끊고 싶은 습관은 한도 안에 머뭅니다.", + "Reach a target": "목표 달성하기", + "Stay under a limit": "한도 안에 머물기", + "Binary means avoiding it entirely. Repetition counts against a daily limit. Timed tracks minutes against a daily limit.": + "이진은 완전히 피하는 것을 뜻합니다. 반복은 하루 한도에 대해 횟수를 세고, 시간은 하루 한도에 대해 분을 기록합니다.", + "Daily limit": "일일 한도", + "Daily limit (minutes)": "일일 한도(분)", + "0 means none at all.": "0은 전혀 하지 않음을 뜻합니다.", + "Set an optional weekly or monthly goal for how many days you stay within your limit. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "한도 안에 머문 일수에 대한 주간 또는 월간 목표를 선택적으로 설정하세요. 퍼펙트 토글을 켜면 기간 길이와 관계없이 자동으로 매일을 목표로 합니다.", + Clean: "클린", + Slipped: "실수", + "Mark as clean": "클린으로 표시", + "Mark as slipped": "실수로 표시", + "Days within limit": "한도 내 일수", + Limit: "한도", + + // Frequencies and per-note metrics + Frequency: "주기", + Daily: "매일", + "Days of week": "요일", + Habit: "습관", + Schedule: "일정", + "Time of day": "시간", + "Optional times this habit is planned for — once or several times a day. Shown on the habit's card.": + "이 습관을 실행할 예정 시간(선택) — 하루 한 번 또는 여러 번. 습관 카드에 표시됩니다.", + "Add time": "시간 추가", + "Remove time": "시간 제거", + "Every N days": "N일마다", + "Repeat every": "반복 주기", + "Day of month": "날짜(일)", + "The weekdays this habit is due on. Pick as many as you need.": + "이 습관이 예정된 요일입니다. 여러 개를 선택할 수 있습니다.", + "Number of days between due dates, counted from the habit's start date. Use 2 for an alternate-day schedule.": + "예정일 사이의 일수로, 습관 시작일부터 계산합니다. 격일로 하려면 2를 입력하세요.", + "The day of the month this habit is due. In shorter months it falls due on the last day, so 31 always lands on the final day of the month.": + "이 습관의 예정 일자입니다. 더 짧은 달에는 마지막 날로 넘어가므로 31은 항상 그 달의 마지막 날이 됩니다.", + "Every {day}": "매주 {day}", + "Monthly · day {day}": "매월 {day}일", + "Every other day": "격일", + "Every {n} days": "{n}일마다", + "No habits are due on this day.": + "이 날에 예정된 습관이 없습니다.", + "Nothing due today.": "오늘은 예정된 것이 없습니다.", + "Weekly activity": "주간 활동", + "Monthly activity": "월간 활동", + "Activity on due days": "예정일 활동", + "Completion rate over {n} due days": "최근 예정일 {n}회 완료율", + "Weeks completed": "완료한 주", + "Months completed": "완료한 달", + "Recent rate": "최근 달성률", + "{n}-week completion rate": "{n}주 달성률", + "{n}-month completion rate": "{n}개월 달성률", + + // AI summaries + "AI summaries": "AI 요약", + "AI summary": "AI 요약", + "Show an AI-generated summary with feedback and advice on the stats page tabs. Uses an OpenAI-compatible service you configure below; your habit stats are sent to it only when you press the generate button.": + "통계 페이지 탭에 피드백과 조언이 담긴 AI 생성 요약을 표시합니다. 아래에서 설정한 OpenAI 호환 서비스를 사용하며, 습관 통계는 생성 버튼을 눌렀을 때만 전송됩니다.", + "AI base URL": "AI 기본 URL", + "Base URL of an OpenAI-compatible API. Works with OpenAI, OpenRouter, or local servers like Ollama (http://localhost:11434/v1).": + "OpenAI 호환 API의 기본 URL입니다. OpenAI, OpenRouter 또는 Ollama(http://localhost:11434/v1) 같은 로컬 서버에서 작동합니다.", + "AI API key": "AI API 키", + "Stored locally in this vault's plugin data. Leave blank for local servers that need no key.": + "이 보관소의 플러그인 데이터에 로컬로 저장됩니다. 키가 필요 없는 로컬 서버라면 비워 두세요.", + "AI model": "AI 모델", + "Model name the service should use.": + "서비스가 사용할 모델 이름입니다.", + "Generate summary": "요약 생성", + Regenerate: "다시 생성", + "Get feedback and advice on your habits for this period. Your stats are sent to the AI service you configured only when you press the button.": + "이 기간의 습관에 대한 피드백과 조언을 받습니다. 통계는 버튼을 눌렀을 때만 설정한 AI 서비스로 전송됩니다.", + "Thinking…": "생각 중…", + "Could not generate a summary: {message}": + "요약을 생성하지 못했습니다: {message}", + "Adds an AI-generated overview with feedback and advice. Your habit stats are sent to your configured AI service.": + "피드백과 조언이 담긴 AI 생성 개요를 추가합니다. 습관 통계가 설정한 AI 서비스로 전송됩니다.", + "Generating AI summary…": "AI 요약 생성 중…", + "The AI summary will be generated when you export.": + "AI 요약은 내보낼 때 생성됩니다.", + + // Custom stats range + Custom: "사용자 지정", + "Start date": "시작일", + "End date": "종료일", + + // Heatmap start markers + "not tracked yet": "아직 기록 없음", + "started tracking on {date}": "{date}에 추적 시작", + + // Stats carousel + "Stats rows per page": "페이지당 통계 행 수", + "How many habits each stats page shows.": + "각 통계 페이지에 표시할 습관 수입니다.", + // Note habits + '"{name}" uses Templater syntax, but the Templater plugin is not installed — the template was copied as plain text.': + '"{name}"에는 Templater 문법이 사용되었지만 Templater 플러그인이 설치되어 있지 않아 서식 없는 텍스트로 복사되었습니다.', + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes. Note is completed by writing in a per-day note.": + "이진은 완료 여부만 기록합니다. 반복은 목표 횟수를 세고, 시간은 분을 기록합니다. 노트는 매일의 노트에 글을 써서 완료합니다.", + "Character count is reached": "글자 수에 도달", + "Character goal": "글자 수 목표", + "Completed when": "완료 조건", + "Every task is checked": "모든 할 일 체크", + "Filename format": "파일명 형식", + "Folder each day's note is created in. Leave blank for a dedicated subfolder named after this habit.": + "매일의 노트가 생성될 폴더입니다. 비워두면 이 습관 이름을 딴 전용 하위 폴더가 사용됩니다.", + "Moment.js format used to name each day's note, e.g. {example}. May include / for date-based subfolders.": + "매일의 노트 이름에 사용할 Moment.js 형식입니다(예: {example}). 날짜별 하위 폴더를 만들려면 /를 포함할 수 있습니다.", + Note: "노트", + "Note habits": "노트 습관", + "Notes folder": "노트 폴더", + "Open this day's note": "이 날의 노트 열기", + "Open today's note": "오늘의 노트 열기", + "Optional template note used when a day's note is created. Expanded through the Templater plugin when it is installed, otherwise copied as plain text.": + "하루의 노트를 만들 때 사용할 선택적 템플릿 노트입니다. Templater 플러그인이 설치되어 있으면 이를 통해 확장되고, 그렇지 않으면 서식 없는 텍스트로 복사됩니다.", + Template: "템플릿", + "Track a habit by writing in a per-day note instead of logging a value by hand. A day is complete once the note reaches a character count or every task in it is checked. Works with the Templater plugin to create each day's note from a template.": + "값을 직접 기록하는 대신 매일의 노트에 글을 써서 습관을 기록합니다. 노트가 글자 수에 도달하거나 모든 할 일에 체크가 되면 그날은 완료로 처리됩니다. Templater 플러그인과 연동해 템플릿으로 매일의 노트를 만들 수 있습니다.", + Write: "쓰기", + "Write this day's note": "이 날의 노트 쓰기", + "Write today's note": "오늘의 노트 쓰기", + "e.g. Journal": "예: Journal", + "e.g. Templates/Journal.md": "예: Templates/Journal.md", + + // Flexible frequency (any day) + "How many times (or, for counted and timed habits, how much in total) this needs to happen somewhere in the period.": + "이 기간 중 언제든 몇 번(횟수·시간 습관의 경우 총량) 발생해야 하는지입니다.", + 'How often this habit is due. Weekly and monthly habits only appear on their due date; the "any day" options appear every day until their quota is met.': + '이 습관의 주기입니다. 주간·월간 습관은 예정일에만 표시되지만, "요일 무관" 옵션은 목표를 채울 때까지 매일 표시됩니다.', + "Monthly (any day)": "월간 (요일 무관)", + "Times per month": "월 횟수", + "Times per week": "주 횟수", + "Weekly (any day)": "주간 (요일 무관)", + "this month": "이번 달", + "this week": "이번 주", + "{completed}/{days} months": "{completed}/{days}개월", + "{completed}/{days} weeks": "{completed}/{days}주", + "{n}× a month · any day": "월 {n}회 · 요일 무관", + "{n}× a week · any day": "주 {n}회 · 요일 무관", + + // Commands + "Insert habits heatmap": "습관 히트맵 삽입", + + // Habit metrics: heatmap tabs + Charts: "차트", + Month: "월", + History: "기록", + "{month} heatmap": "{month} 히트맵", + "Last {n} weeks": "최근 {n}주", + + // Heatmap cell states and tooltips + Upcoming: "예정", + "Not tracked yet": "아직 추적 안 됨", + "Not due": "해당 없음", + "Outside this month": "이번 달 아님", + Complete: "완료", + "Over limit": "한도 초과", + "Not logged": "기록 없음", + + // Whole-vault heatmap block + "Add a habit to see its heatmap here.": "습관을 추가하면 여기에 히트맵이 표시됩니다.", + "No habits in the \"{group}\" group.": '"{group}" 그룹에 습관이 없습니다.', + "No habits due": "예정된 습관 없음", + "Perfect day": "퍼펙트한 날", + "{completed}/{considered} habits · {pct}%": + "습관 {completed}/{considered} · {pct}%", + "This year": "올해", + "Past 6 months": "지난 6개월", + "{year} heatmap": "{year}년 히트맵", + + // Note habits: checklist requirement and fail keyword + "Both are true": "둘 다 충족", + "Checklist requirement is met": "체크리스트 요건 충족", + "Checklist requirement": "체크리스트 요건", + "Require every task to be checked, or just some — useful for a list of alternatives where doing any one of them counts (e.g. \"Cardio\" / \"Weights\" / \"Rest day\").": + '모든 할 일에 체크해야 하는지, 일부만 체크해도 되는지 정할 수 있습니다 — "유산소" / "웨이트" / "휴식일"처럼 그중 하나만 해도 되는 선택지 목록에 유용합니다.', + "At least this many are checked": "최소한 이 개수만큼 체크됨", + "Tasks required": "필요한 할 일 수", + "Fail keyword": "실패 키워드", + "Optional. Checking a task whose text contains this word forces the day to fail, whatever else is checked — e.g. \"Slipped\" as one of several checklist options. Leave blank to turn this off.": + '선택 사항입니다. 텍스트에 이 단어가 포함된 할 일에 체크하면, 다른 항목을 체크했더라도 그날은 강제로 실패 처리됩니다 — 예를 들어 여러 체크리스트 항목 중 하나로 "실패"를 넣어두는 식입니다. 비워 두면 이 기능은 꺼집니다.', + "e.g. Slipped": "예: 실패", + "Reach a character count, meet a checklist requirement, or require both.": + "글자 수 도달, 체크리스트 요건 충족, 또는 둘 다 요구하는 방식 중에서 선택할 수 있습니다.", + + // Tags (cross-plugin compatibility) + Tags: "태그", + "e.g. task": "예: task", + "Optional Obsidian tags for this note, separated by commas or spaces. Useful for making this habit recognisable to another plugin's own tag-based rules — for example TaskNotes' task tag.": + "이 노트에 대한 선택적 Obsidian 태그입니다. 쉼표나 공백으로 구분합니다. 다른 플러그인의 태그 기반 규칙이 이 습관을 인식하게 하는 데 유용합니다 — 예를 들어 TaskNotes의 task 태그입니다.", + + // Advanced settings: frontmatter key remapping + Advanced: "고급", + Apply: "적용", + "Apply key changes": "키 변경 적용", + "Rename the frontmatter properties habit notes use. Useful for avoiding collisions with another plugin's own properties in the same note (for example TaskNotes).": + "습관 노트가 사용하는 프런트매터 속성 이름을 바꿉니다. 같은 노트에서 다른 플러그인(예: TaskNotes) 고유의 속성과 충돌하는 것을 피할 때 유용합니다.", + "\"{a}\" and \"{b}\" can't use the same property key (\"{value}\").": + '"{a}"와 "{b}"는 같은 속성 키("{value}")를 사용할 수 없습니다.', + "Property keys can't be empty.": "속성 키는 비워 둘 수 없습니다.", + "This renames {summary} in every note in your habits folder ({count} habit(s) currently). Existing values are moved, not discarded. Continue?": + "이 작업은 습관 폴더에 있는 모든 노트(현재 {count}개 습관)에서 {summary}의 이름을 바꿉니다. 기존 값은 삭제되지 않고 이동됩니다. 계속할까요?", + "Updated the frontmatter keys in {count} note(s).": + "{count}개 노트에서 프런트매터 키를 업데이트했습니다.", + "Renaming this away from the default also changes how binary habits log a day: instead of {\"2026-08-25\": 1}, a completed day becomes a bare date, like [\"2026-08-25\"] — the shape TaskNotes uses for complete_instances. Repetition and timed habits are unaffected either way; they always need a value, never just a date.": + '이 키를 기본값에서 다른 이름으로 바꾸면 이진 습관이 하루를 기록하는 방식도 달라집니다. {"2026-08-25": 1} 대신, 완료한 날은 ["2026-08-25"]처럼 단순한 날짜가 됩니다 — 이는 TaskNotes가 complete_instances에 사용하는 형식입니다. 반복 및 시간 습관은 어느 경우든 영향을 받지 않습니다. 항상 값이 필요하며, 날짜만으로는 안 됩니다.', + Identity: "식별 정보", + Legacy: "레거시", + Lifecycle: "라이프사이클", + Presentation: "표시", + "Note habit": "노트 습관", + "Habit type key": "습관 유형 키", + "Completion records key": "완료 기록 키", + "Frequency key": "빈도 키", + "Weekday key": "요일 키", + "Month day key": "월중 날짜 키", + "Interval days key": "간격 일수 키", + "Planned time key": "예정 시간 키", + "Goal direction key": "목표 방향 키", + "Target key": "목표 키", + "Unit key": "단위 키", + "Step size key": "증감 단위 키", + "Weekly target key": "주간 목표 키", + "Monthly target key": "월간 목표 키", + "Weekly perfect key": "퍼펙트 주 키", + "Monthly perfect key": "퍼펙트 달 키", + "Start date key": "시작일 키", + "Pauses key": "일시중지 기록 키", + "Stopped key": "중단 상태 키", + "Stop date key": "중단일 키", + "Icon key": "아이콘 키", + "Color key": "색상 키", + "Group key": "그룹 키", + "Use group color key": "그룹 색상 사용 키", + "Note folder key": "노트 폴더 키", + "Note filename format key": "노트 파일명 형식 키", + "Template path key": "템플릿 경로 키", + "Note completion mode key": "노트 완료 모드 키", + "Note checklist requirement key": "노트 체크리스트 요건 키", + "Note checklist minimum key": "노트 체크리스트 최소 개수 키", + "Note fail keyword key": "노트 실패 키워드 키", + "Legacy comments key": "이전 코멘트 키", + + // PDF export (read via docT() in export-modal.ts, which falls back to English for zh — jsPDF's built-in fonts can't render CJK) + "Completion trend": "달성률 추이", + "(paused)": "(일시정지됨)", + "{rate}% · {total} · streak {current} (best {best})": + "{rate}% · {total} · 연속 {current} (최고 {best})", + "Goal: {completed}/{goal} days met": + "목표: {completed}/{goal}일 달성", + "{range} · exported {date}": "{range} · {date} 내보냄", + "+{n} more": "+{n}개 더", + + // Back-dating a missed day + Back: "뒤로", + + // Rescheduling missed habits (experimental) + "1 missed habit": "놓친 습관 1개", + "Add a notification button to the dashboard and sidebar panel when a habit's been missed, opening a review of missed days you can move onto a different one (never a day that habit is already due, so nothing doubles up).": + "습관을 놓쳤을 때 대시보드와 사이드바 패널에 알림 버튼을 추가합니다. 놓친 날을 검토하고 다른 날로 옮길 수 있습니다(그 습관이 원래 예정된 날로는 옮길 수 없어 중복 기록이 생기지 않습니다).", + "Missed habits": "놓친 습관", + "Move this missed day onto a different one": "이 놓친 날을 다른 날로 옮기기", + "Move to": "옮길 날짜", + "Nothing missed right now.": "지금은 놓친 것이 없습니다.", + "Pick a habit to move it onto a different day.": "다른 날로 옮길 습관을 선택하세요.", + Reschedule: "일정 변경", + "Reschedule missed habits": "놓친 습관 일정 변경", + "Rescheduled \"{name}\" to {date}.": '"{name}"의 일정을 {date}(으)로 변경했습니다.', + "Rescheduled from {date}": "{date}에서 일정 변경됨", + "Reschedules key": "일정 변경 키", + "Failed days key": "실패한 날 키", + "Skipped days key": "건너뛴 날 키", + "Rescheduling \"{name}\" — missed {date}.": + '"{name}" 일정 변경 중 — {date}에 놓쳤습니다.', + "That day no longer works — pick another.": + "그 날짜는 더 이상 사용할 수 없습니다 — 다른 날짜를 선택하세요.", + "That day won't work — it's either already due for this habit or already claimed by another reschedule.": + "그 날짜는 안 됩니다 — 이미 그 습관이 그 날짜에 예정되어 있거나, 다른 일정 변경에서 이미 사용 중입니다.", + "{count} missed habits": "놓친 습관 {count}개", +}; diff --git a/src/integrations/habits/i18n/zh.ts b/src/integrations/habits/i18n/zh.ts new file mode 100644 index 000000000..5d8fe4e3c --- /dev/null +++ b/src/integrations/habits/i18n/zh.ts @@ -0,0 +1,658 @@ +/** Simplified Chinese translations, keyed by the English source string. */ +export const zh: Record = { + "Interval schedule key": "间隔排期方式属性名", + "This note is managed by Task Genius.": "此笔记由 Task Genius 管理。", + // Commands and ribbon + "Create habit": "创建习惯", + "Insert dashboard": "插入习惯面板", + "Insert habit metrics": "插入习惯指标", + "Insert habits table": "插入习惯表格", + "Open panel": "打开侧边栏面板", + "Open habits panel": "打开习惯侧边栏", + Habits: "习惯", + + // Settings + "Habits folder": "习惯文件夹", + "Folder where each habit is stored as its own note. It is created automatically if it does not exist.": + "每个习惯都以独立笔记的形式存放在此文件夹中。如果不存在会自动创建。", + "Follow daily note date": "跟随日记日期", + "When a dashboard is embedded in a daily note (a note whose name contains a date like 2026-07-01), open it on that note's date instead of today.": + "当习惯面板嵌入到日记中(笔记名称包含类似 2026-07-01 的日期)时,面板会显示该笔记日期的记录,而不是今天。", + "Daily note date format": "日记日期格式", + "Moment.js format used to read the date from a daily note's name, such as YYYY-MM-DD or YYYYMMDD.": + "用于从日记名称中读取日期的 Moment.js 格式,例如 YYYY-MM-DD 或 YYYYMMDD。", + + // Sorting + "Sort habits by": "习惯排序方式", + "The base order of habit cards in the dashboard and side panel.": + "仪表盘和侧边面板中习惯卡片的基本顺序。", + "Name (A–Z)": "名称(A–Z)", + Color: "颜色", + "Last logged": "最近记录", + "Planned time": "计划时间", + Manual: "手动", + "Manual order": "手动排序", + "Drag the cards into the order you want. New habits join the end of the list.": + "拖动卡片调整顺序。新习惯会添加到列表末尾。", + "Move completed cards to the end": "将已完成的卡片移到末尾", + "Completed habits drift to the end of the queue and paused ones park behind them. Turn this off to keep every card in its sorted position.": + "已完成的习惯会移到队列末尾,暂停的习惯排在其后。关闭后,所有卡片保持排序位置不变。", + Group: "分组", + Ungrouped: "未分组", + "Optional group used to build dashboard sections — for example an area of responsibility.": + "用于在仪表盘中创建分区的可选分组 — 例如某个职责领域。", + "e.g. Health": "例如:健康", + "Group color": "分组颜色", + "Optional color shared by every habit in this group.": "该分组中所有习惯共享的可选颜色。", + "Group icon": "分组图标", + "Shown in the group lip on cards and in section headers.": + "显示在卡片的分组条和分区标题中。", + "Use group color for this card": "此卡片使用分组颜色", + "Show this card in the group color instead of its own.": + "以分组颜色而非自身颜色显示此卡片。", + General: "常规", + Sorting: "排序", + Groups: "分组", + "How to move through your habit cards: a paged carousel with arrows, a grid that wraps onto new rows, or a fixed-height grid that scrolls vertically. The stats page follows the same choice.": + "浏览习惯卡片的方式:带箭头的分页轮播、自动换行的网格,或固定高度、垂直滚动的网格。统计页面遵循相同设置。", + "Enable groups": "启用分组", + "Show habits in sections by their group, with a group lip on each card.": + "按分组分区显示习惯,并在每张卡片上显示分组条。", + "Group order": "分组顺序", + "Drag the groups into the order you want. Sections follow the same order.": + "拖动分组以调整顺序。分区遵循相同顺序。", + "Completion animations": "完成动画", + "Play the check swoosh, card departure, and perfect-day confetti when habits are completed. Turn off for instant, quiet updates.": + "完成习惯时播放对勾划入、卡片退场和完美一天的彩纸动画。关闭后立即静默更新。", + "Reminders": "提醒", + "Write reminders for due habits": "为当日应做的习惯写入提醒", + "Each day, write one reminder checklist line per planned time of every habit due that day, in the format the Reminder plugin picks up. The lines live in a marked block and refresh as you log habits.": + "每天为当日应做的每个习惯的每个计划时间写入一行提醒清单,格式可被 Reminder 插件识别。这些行位于带标记的块中,并随打卡自动刷新。", + "Where to write reminders": "提醒写入位置", + "The daily note follows the Daily notes core plugin's folder and date format; the block is added once the note exists. A fixed note is created automatically.": + "每日笔记遵循核心“每日笔记”插件的文件夹和日期格式;笔记存在后即会添加该块。固定笔记会自动创建。", + "Today's daily note": "今天的每日笔记", + "A fixed note": "固定笔记", + "Reminder note path": "提醒笔记路径", + "Vault path of the note that holds the reminder block.": "存放提醒块的笔记在库中的路径。", + "Manage groups": "管理分组", + "See every habit by group and drag cards between groups.": + "按分组查看所有习惯,并在分组间拖动卡片。", + Open: "打开", + "New group": "新建分组", + Add: "添加", + "Drag habits between groups to reassign them, or within a group to reorder them.": + "在分组之间拖动习惯以重新分配,或在分组内拖动以调整顺序。", + "No habits": "没有习惯", + "Edit group style": "编辑分组样式", + "Delete group": "删除分组", + 'Delete "{name}"? Its habits are kept and become ungrouped.': + "删除“{name}”?其习惯将保留并变为未分组。", + Delete: "删除", + "Dashboard layout": "仪表盘布局", + Carousel: "轮播", + Grid: "网格", + "Vertical scroll": "垂直滚动", + "Cards per view": "每页卡片数", + "How many habit cards fit side by side on wider screens.": + "宽屏上并排显示多少张习惯卡片。", + "Cards per view on mobile": "移动端每页卡片数", + "How many habit cards fit side by side on phone-sized screens.": + "手机屏幕上并排显示多少张习惯卡片。", + + // Confirm dialog defaults + Cancel: "取消", + Confirm: "确认", + + // Store notices + 'Could not find the note for "{name}".': "找不到“{name}”的笔记。", + "Please enter a valid habit name.": "请输入有效的习惯名称。", + 'A habit called "{name}" already exists.': + "名为“{name}”的习惯已存在。", + 'Created habit "{name}".': "已创建习惯“{name}”。", + 'Updated "{name}".': "已更新“{name}”。", + 'Paused "{name}".': "已暂停“{name}”。", + 'Resumed "{name}".': "已恢复“{name}”。", + 'Stopped tracking "{name}". Its history is kept in the note.': + "已停止跟踪“{name}”。其历史记录保留在笔记中。", + 'Resumed tracking "{name}".': "已恢复跟踪“{name}”。", + 'Removed "{name}".': "已删除“{name}”。", + "Habit added to the dashboard.": "习惯已添加到面板。", + + // Dashboard + "Back to habits": "返回习惯", + "View stats": "查看统计", + "Export stats": "导出统计", + Weekly: "每周", + Monthly: "每月", + "Previous day": "前一天", + "Next day": "后一天", + "Choose a date": "选择日期", + "Add habit": "添加习惯", + "No habits yet. Create your first habit to get started.": + "还没有习惯。创建你的第一个习惯开始吧。", + Previous: "上一页", + Next: "下一页", + "Go to position {n}": "跳到第 {n} 页", + "Right-click or long-press for more options": + "右键或长按查看更多选项", + "Open habit note": "打开习惯笔记", + "Open the note for {name}": "打开 {name} 的笔记", + Paused: "已暂停", + Stopped: "已停止追踪", + "Failed": "已失败", + "Skipped": "已跳过", + "Snoozed": "已暂缓", + "Snoozed until {time}": "暂缓至 {time}", + "Undo fail": "撤销失败", + "Undo skip": "撤销跳过", + "End snooze": "结束暂缓", + "Fail for today": "今天标记为失败", + "Fail this day": "将这一天标记为失败", + "Marked \"{name}\" as failed.": "已将“{name}”标记为失败。", + "Skip for today": "今天跳过", + "Skip this day": "跳过这一天", + "Skipped \"{name}\".": "已跳过“{name}”。", + "Snooze…": "暂缓…", + "Snooze \"{name}\"": "暂缓“{name}”", + "It leaves today's lists and comes back on its own. Snoozing never counts for or against the habit.": "它会离开今天的列表并在到时后自动回来。暂缓不会计入习惯的成功或失败。", + "Snooze for": "暂缓时长", + "30 minutes": "30 分钟", + "1 hour": "1 小时", + "3 hours": "3 小时", + "Snooze until": "暂缓至", + "Snooze": "暂缓", + "Pick a time later today.": "请选择今天稍后的时间。", + "Snoozed \"{name}\" until {time}.": "已将“{name}”暂缓至 {time}。", + "1 hidden for today": "今天隐藏了 1 个", + "{count} hidden for today": "今天隐藏了 {count} 个", + "1 hidden for this day": "这一天隐藏了 1 个", + "{count} hidden for this day": "这一天隐藏了 {count} 个", + "Undo": "撤销", + "Click to undo": "点击撤销", + "Nothing left on this day's list.": "这一天的列表已清空。", + "Nothing left on today's list.": "今天的列表已清空。", + "At least: reach a target for habits you are building, like drinking 1.5 litres of water. At most: stay within a limit for habits you are cutting down, like no more than 2 coffees.": "至少:为正在养成的习惯达成目标,例如喝 1.5 升水。至多:为正在减少的习惯保持在限额内,例如不超过 2 杯咖啡。", + "At least (reach a target)": "至少(达成目标)", + "At most (stay within a limit)": "至多(不超过限额)", + "Step size": "步长", + "How much each + and − press adds or removes. Use a decimal such as 0.25 for amounts like litres.": "每次按 + 或 − 增加或减少的数量。对于升等数量,可使用 0.25 这样的小数。", + "Decrease by {n}": "减少 {n}", + "4 weeks": "4 周", + "12 weeks": "12 周", + "6 months": "6 个月", + "1 year": "1 年", + "Completion rate": "完成率", + "Monthly completion rate": "每月完成率", + "Daily activity": "每日活动", + "Week of {date}": "{date} 当周", + "Since {date} · right-click to resume": + "自 {date} 起 · 右键恢复", + "Paused on this day": "当天已暂停", + "Mark as done": "标记为已完成", + "Mark as not done": "标记为未完成", + Done: "已完成", + "Not done": "未完成", + "Edit value": "编辑数值", + Value: "数值", + "Decrease by 1": "减少 1", + "Compact list": "紧凑列表", + "Choose a carousel, grid, vertical scroll, or compact list for your habits dashboard.": "选择轮播、网格、垂直滚动或紧凑列表作为习惯仪表盘样式。", + "Could not save habit record.": "无法保存习惯记录。", + "Increase by 1": "增加 1", + "Increase by {n}": "增加 {n}", + "Edit habit": "编辑习惯", + "Pause habit": "暂停习惯", + "Resume habit": "恢复习惯", + "Stop tracking": "停止跟踪", + "Remove habit": "删除习惯", + 'Stop tracking "{name}"? It leaves the dashboard and stats, but its note and full history are kept. You can resume tracking any time from the note\'s metrics view.': + "停止跟踪“{name}”?它将从面板和统计中移除,但其笔记和全部历史记录会保留。你随时可以在笔记的指标视图中恢复跟踪。", + 'Remove "{name}"? Its note will be moved to the trash.': + "删除“{name}”?其笔记将被移入回收站。", + Remove: "删除", + "Perfect!": "完美!", + Today: "今天", + Yesterday: "昨天", + Tomorrow: "明天", + "Last 7 days": "最近 7 天", + "Last 30 days": "最近 30 天", + "This week": "本周", + "This month": "本月", + + // Sidebar panel + "Habits completed today": "今日已完成的习惯", + "No habits yet.": "还没有习惯。", + "Click to type a value": "点击输入数值", + "Open note": "打开笔记", + + // Stats view + "No habits to show stats for yet.": "还没有可统计的习惯。", + Completion: "完成率", + "Best streak": "最长连击", + "Perfect days": "完美天数", + Completions: "完成次数", + "Goals met": "达成目标", + "{completed}/{days} days": "{completed}/{days} 天", + "{total} total": "共 {total}", + best: "最佳", + "perfect week": "完美一周", + "perfect month": "完美一月", + "weekly goal": "周目标", + "monthly goal": "月目标", + "{progress}/{goal} days · {label} · {pct}%": + "{progress}/{goal} 天 · {label} · {pct}%", + + // Habit metrics block + 'Place this block inside a habit note, or point it at one with "habit: ".': + "请将此代码块放入习惯笔记中,或用“habit: <名称>”指定一个习惯。", + 'No habit called "{name}" was found.': "找不到名为“{name}”的习惯。", + "No longer tracked since {date}. All history is kept.": + "自 {date} 起已停止跟踪。所有历史记录均已保留。", + "No longer tracked. All history is kept.": + "已停止跟踪。所有历史记录均已保留。", + "Resume tracking": "恢复跟踪", + "Paused since {date}. Paused days don't count against streaks or stats.": + "自 {date} 起暂停。暂停的日子不会影响连击或统计。", + "Paused. Paused days don't count against streaks or stats.": + "已暂停。暂停的日子不会影响连击或统计。", + "Current streak": "当前连击", + "Days completed": "完成天数", + "30-day rate": "30 天完成率", + "Weekly completion rate": "每周完成率", + Logged: "已记录", + Target: "目标", + + // Export modal + Title: "标题", + "Habits report": "习惯报告", + "Date range": "日期范围", + "Custom range": "自定义范围", + From: "从", + To: "到", + "Up to {n} days.": "最多 {n} 天。", + Content: "内容", + "Summary tiles": "摘要卡片", + "Completion trend chart": "完成趋势图", + "Daily grids": "每日网格", + "Goal progress": "目标进度", + Layout: "布局", + Orientation: "方向", + Portrait: "纵向", + Landscape: "横向", + Density: "密度", + Comfortable: "宽松", + Compact: "紧凑", + Monochrome: "黑白", + "Ink-friendly greys instead of accent colours.": + "使用省墨的灰色代替强调色。", + "Export PDF": "导出 PDF", + "No habits to export yet.": "还没有可导出的习惯。", + 'Exported to "{path}" in your vault.': + "已导出到仓库中的“{path}”。", + + // Habit modal + "New habit": "新习惯", + Name: "名称", + Type: "类型", + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes.": + "二元型:完成或未完成。重复型:向目标计数。计时型:记录分钟数。", + Binary: "二元", + Repetition: "重复", + Timed: "计时", + "Daily target (minutes)": "每日目标(分钟)", + "Daily target": "每日目标", + Unit: "单位", + "Optional label shown next to the count.": + "显示在计数旁边的可选标签。", + Icon: "图标", + "Choose a Lucide icon or an emoji to represent this habit.": + "选择一个 Lucide 图标或 emoji 来代表这个习惯。", + Emoji: "表情符号", + "Choose an emoji": "选择表情符号", + "Clear icon": "清除图标", + "Choose icon": "选择图标", + "Save changes": "保存更改", + "Targets (optional)": "目标(可选)", + "Set an optional weekly or monthly goal for how many days you complete this habit. For example, hitting your daily goal on all 7 days is a weekly target of 7. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "设置可选的每周或每月目标,规定完成该习惯的天数。例如,7 天全部达成每日目标即为周目标 7。开启“完美”开关可自动以该周期的每一天为目标,无论周期多长。", + "Perfect week": "完美一周", + "Aim to complete this habit every day of the week.": + "力争一周中的每一天都完成这个习惯。", + "Weekly target": "周目标", + "Optional. Days to complete per week (max 7).": + "可选。每周需完成的天数(最多 7 天)。", + None: "无", + "Perfect month": "完美一月", + "Aim to complete this habit every day of the month.": + "力争一个月中的每一天都完成这个习惯。", + "Monthly target": "月目标", + "Optional. Days to complete per month.": + "可选。每月需完成的天数。", + Colour: "颜色", + "Pick a colour from your theme, or choose a custom one.": + "从主题中选择颜色,或自定义一个。", + "Your habit": "你的习惯", + + // Icon and colour pickers + "Search icons…": "搜索图标…", + "Search emojis…": "搜索表情符号…", + + // Comments + "Comments on cards": "卡片评论", + "Show a comment flap on dashboard cards for jotting a note about any day.": + "在面板卡片上显示评论翻页,可为任意一天记录备注。", + "Add comment": "添加评论", + "Flip back": "翻回正面", + "Edit comment": "编辑评论", + "Move day comments into note bodies": "将每日评论移入笔记正文", + "No comments left to move.": "没有需要移动的评论。", + "Moved comments in 1 note.": "已移动 1 篇笔记中的评论。", + "Moved comments in {n} notes.": "已移动 {n} 篇笔记中的评论。", + "Add a comment for this day…": "为这一天添加评论…", + Comments: "评论", + + // Limit habits (experimental) + Experimental: "实验性功能", + "These features are still being tested and may change before they become permanent. Turning one off only hides it from menus — anything you created with it keeps working.": + "这些功能仍在测试中,在正式发布前可能会有变化。关闭某项功能只会将其从菜单中隐藏——你用它创建的内容会继续正常工作。", + "Break bad habits": "戒除坏习惯", + "Track habits you want to reduce or avoid by staying under a daily limit — for example at most 2 hours of gaming, or no smoking at all.": + "通过保持在每日限额以下来跟踪你想减少或戒除的习惯——例如每天最多玩 2 小时游戏,或完全不吸烟。", + Goal: "目标", + "Reach a target for habits you are building. Stay under a limit for habits you are cutting down or giving up.": + "要养成的习惯选择达成目标。要减少或戒除的习惯选择保持在限额以下。", + "Reach a target": "达成目标", + "Stay under a limit": "保持在限额以下", + "Binary means avoiding it entirely. Repetition counts against a daily limit. Timed tracks minutes against a daily limit.": + "二元表示完全避免。重复按每日限额计数。计时按每日限额记录分钟数。", + "Daily limit": "每日限额", + "Weekly limit": "每周限额", + "Weekly total limit · any day": "每周累计限额 · 任意日期", + "Monthly total limit · any day": "每月累计限额 · 任意日期", + "Monthly limit": "每月限额", + "Limit per due day": "每个计划日的限额", + "Limit in minutes. 0 means none at all.": "限额以分钟计,0 表示完全不允许。", + "Choose the days this limit applies, or a weekly/monthly total limit that can be logged on any day.": "选择限制适用的日期,或选择可在任意日期记录的每周/每月累计限额。", + "Binary means avoiding it entirely. Repetition counts against a limit. Timed tracks minutes against a limit. Frequency determines when the limit applies.": "二元类型表示完全避免;计数和计时类型分别按次数和分钟判断是否超限。频率决定限制适用的日期或周期。", + "Daily limit (minutes)": "每日限额(分钟)", + "0 means none at all.": "0 表示完全不做。", + "Set an optional weekly or monthly goal for how many days you stay within your limit. Turn on a perfect toggle to aim for every day of the period automatically, whatever its length.": + "设置一个可选的每周或每月目标,即有多少天保持在限额以内。打开完美开关即可自动以该时段的每一天为目标,无论其长短。", + Clean: "未破戒", + Slipped: "破戒", + "Mark as clean": "标记为未破戒", + "Mark as slipped": "标记为破戒", + "Days within limit": "限额内天数", + Limit: "限额", + + // Frequencies and per-note metrics + Frequency: "频率", + Daily: "每天", + "Days of week": "星期几", + Habit: "习惯", + Schedule: "计划", + "Time of day": "时间", + "Optional times this habit is planned for — once or several times a day. Shown on the habit's card.": + "此习惯计划进行的时间(可选)——每天一次或多次。显示在习惯卡片上。", + "Add time": "添加时间", + "Remove time": "移除时间", + "Every N days": "每 N 天", + "Repeat every": "重复间隔", + "Day of month": "每月日期", + "The weekdays this habit is due on. Pick as many as you need.": + "此习惯到期的星期几。可选择多个。", + "Number of days between due dates, counted from the habit's start date. Use 2 for an alternate-day schedule.": + "两次到期之间的天数,从习惯的开始日期算起。填 2 表示隔天一次。", + "The day of the month this habit is due. In shorter months it falls due on the last day, so 31 always lands on the final day of the month.": + "此习惯每月的到期日。在较短的月份中落在最后一天,因此 31 总是落在当月最后一天。", + "Every {day}": "每{day}", + "Monthly · day {day}": "每月 · 第 {day} 天", + "Every other day": "隔天一次", + "Every {n} days": "每 {n} 天", + "No habits are due on this day.": "这一天没有到期的习惯。", + "Nothing due today.": "今天没有到期的习惯。", + "Weekly activity": "每周活动", + "Monthly activity": "每月活动", + "Activity on due days": "到期日活动", + "Completion rate over {n} due days": "最近 {n} 个到期日的完成率", + "Weeks completed": "已完成周数", + "Months completed": "已完成月数", + "Recent rate": "近期完成率", + "{n}-week completion rate": "{n} 周完成率", + "{n}-month completion rate": "{n} 个月完成率", + + // AI summaries + "AI summaries": "AI 摘要", + "AI summary": "AI 摘要", + "Show an AI-generated summary with feedback and advice on the stats page tabs. Uses an OpenAI-compatible service you configure below; your habit stats are sent to it only when you press the generate button.": + "在统计页的标签页中显示由 AI 生成的摘要,包含反馈和建议。使用下方配置的 OpenAI 兼容服务;只有按下生成按钮时,习惯统计数据才会发送给它。", + "AI base URL": "AI 基础 URL", + "Base URL of an OpenAI-compatible API. Works with OpenAI, OpenRouter, or local servers like Ollama (http://localhost:11434/v1).": + "OpenAI 兼容 API 的基础 URL。适用于 OpenAI、OpenRouter 或本地服务器(如 Ollama:http://localhost:11434/v1)。", + "AI API key": "AI API 密钥", + "Stored locally in this vault's plugin data. Leave blank for local servers that need no key.": + "保存在此仓库的插件数据中(仅限本地)。本地服务器无需密钥时可留空。", + "AI model": "AI 模型", + "Model name the service should use.": "服务应使用的模型名称。", + "Generate summary": "生成摘要", + Regenerate: "重新生成", + "Get feedback and advice on your habits for this period. Your stats are sent to the AI service you configured only when you press the button.": + "获取本时段习惯的反馈和建议。只有按下按钮时,统计数据才会发送到所配置的 AI 服务。", + "Thinking…": "思考中…", + "Could not generate a summary: {message}": "无法生成摘要:{message}", + "Adds an AI-generated overview with feedback and advice. Your habit stats are sent to your configured AI service.": + "添加由 AI 生成的概览,包含反馈和建议。习惯统计数据会发送到所配置的 AI 服务。", + "Generating AI summary…": "正在生成 AI 摘要…", + "The AI summary will be generated when you export.": + "导出时将生成 AI 摘要。", + + // Custom stats range + Custom: "自定义", + "Start date": "开始日期", + "End date": "结束日期", + + // Heatmap start markers + "not tracked yet": "尚未跟踪", + "started tracking on {date}": "自 {date} 开始跟踪", + + // Stats carousel + "Stats rows per page": "每页统计行数", + "How many habits each stats page shows.": "每页统计显示多少个习惯。", + // Note habits + '"{name}" uses Templater syntax, but the Templater plugin is not installed — the template was copied as plain text.': + '"{name}" 使用了 Templater 语法,但未安装 Templater 插件——模板已作为纯文本复制。', + "Binary is done or not done. Repetition counts towards a target. Timed tracks minutes. Note is completed by writing in a per-day note.": + "二元型:完成或未完成。重复型:向目标计数。计时型:记录分钟数。笔记型:通过在每日笔记中写作来完成。", + "Character count is reached": "达到字数", + "Character goal": "字数目标", + "Completed when": "完成条件", + "Every task is checked": "勾选所有任务", + "Filename format": "文件名格式", + "Folder each day's note is created in. Leave blank for a dedicated subfolder named after this habit.": + "每日笔记的创建文件夹。留空则使用以此习惯命名的专用子文件夹。", + "Moment.js format used to name each day's note, e.g. {example}. May include / for date-based subfolders.": + "用于命名每日笔记的 Moment.js 格式,例如 {example}。可包含 / 以创建按日期划分的子文件夹。", + Note: "笔记", + "Note habits": "笔记习惯", + "Notes folder": "笔记文件夹", + "Open this day's note": "打开这一天的笔记", + "Open today's note": "打开今天的笔记", + "Optional template note used when a day's note is created. Expanded through the Templater plugin when it is installed, otherwise copied as plain text.": + "创建每日笔记时使用的可选模板笔记。安装 Templater 插件后会展开其语法,否则将作为纯文本复制。", + Template: "模板", + "Track a habit by writing in a per-day note instead of logging a value by hand. A day is complete once the note reaches a character count or every task in it is checked. Works with the Templater plugin to create each day's note from a template.": + "通过在每日笔记中写作来追踪习惯,而不是手动记录数值。当笔记达到字数或其中所有任务都被勾选时,这一天即算完成。可与 Templater 插件配合,从模板创建每日笔记。", + Write: "写作", + "Write this day's note": "写这一天的笔记", + "Write today's note": "写今天的笔记", + "e.g. Journal": "例如:日记", + "e.g. Templates/Journal.md": "例如:Templates/Journal.md", + + // Flexible frequency (any day) + "How many times (or, for counted and timed habits, how much in total) this needs to happen somewhere in the period.": + "需要在该周期内的某个时刻发生多少次(对于计数型或计时型习惯,则是总量)。", + 'How often this habit is due. Weekly and monthly habits only appear on their due date; the "any day" options appear every day until their quota is met.': + '此习惯的到期频率。每周和每月习惯只在到期日显示;"任意日"选项每天都会显示,直到达到配额。', + "Monthly (any day)": "每月(任意日)", + "Times per month": "每月次数", + "Times per week": "每周次数", + "Weekly (any day)": "每周(任意日)", + "this month": "本月", + "this week": "本周", + "{completed}/{days} months": "{completed}/{days} 个月", + "{completed}/{days} weeks": "{completed}/{days} 周", + "{n}× a month · any day": "每月 {n} 次 · 任意日", + "{n}× a week · any day": "每周 {n} 次 · 任意日", + + // Commands + "Insert habits heatmap": "插入习惯热力图", + + // Habit metrics: heatmap tabs + Charts: "图表", + Month: "月", + History: "历史", + "{month} heatmap": "{month}热力图", + "Last {n} weeks": "最近 {n} 周", + + // Heatmap cell states and tooltips + Upcoming: "未到", + "Not tracked yet": "尚未开始记录", + "Not due": "不适用", + "Outside this month": "不在本月内", + Complete: "已完成", + "Over limit": "超出限制", + "Not logged": "未记录", + + // Whole-vault heatmap block + "Add a habit to see its heatmap here.": "添加一个习惯即可在此查看其热力图。", + "No habits in the \"{group}\" group.": "“{group}”分组中没有习惯。", + "No habits due": "当天没有到期习惯", + "Perfect day": "完美的一天", + "{completed}/{considered} habits · {pct}%": + "{completed}/{considered} 个习惯 · {pct}%", + "This year": "今年", + "Past 6 months": "过去 6 个月", + "{year} heatmap": "{year} 年热力图", + + // Note habits: checklist requirement and fail keyword + "Both are true": "两者均满足", + "Checklist requirement is met": "满足清单要求", + "Checklist requirement": "清单要求", + "Require every task to be checked, or just some — useful for a list of alternatives where doing any one of them counts (e.g. \"Cardio\" / \"Weights\" / \"Rest day\").": + "要求勾选所有任务,或只需勾选其中一部分——适用于一组可任选其一即可的备选项(例如“有氧”/“力量训练”/“休息日”)。", + "At least this many are checked": "至少勾选这么多项", + "Tasks required": "所需任务数", + "Fail keyword": "失败关键词", + "Optional. Checking a task whose text contains this word forces the day to fail, whatever else is checked — e.g. \"Slipped\" as one of several checklist options. Leave blank to turn this off.": + "可选。勾选文本中包含该词的任务,会强制当天判定为失败,无论其他项是否勾选——例如把“破功”设为清单中的一个选项。留空可关闭此功能。", + "e.g. Slipped": "例如:破功", + "Reach a character count, meet a checklist requirement, or require both.": + "达到字数目标、满足清单要求,或两者都要求。", + + // Tags (cross-plugin compatibility) + Tags: "标签", + "e.g. task": "例如:task", + "Optional Obsidian tags for this note, separated by commas or spaces. Useful for making this habit recognisable to another plugin's own tag-based rules — for example TaskNotes' task tag.": + "此笔记的可选 Obsidian 标签,用逗号或空格分隔。可用于让其他插件通过自己基于标签的规则识别这个习惯——例如 TaskNotes 的 task 标签。", + + // Advanced settings: frontmatter key remapping + Advanced: "高级", + Apply: "应用", + "Apply key changes": "应用键更改", + "Rename the frontmatter properties habit notes use. Useful for avoiding collisions with another plugin's own properties in the same note (for example TaskNotes).": + "重命名习惯笔记使用的 frontmatter 属性。可用于避免与同一笔记中另一个插件自身属性发生冲突(例如 TaskNotes)。", + "\"{a}\" and \"{b}\" can't use the same property key (\"{value}\").": + "“{a}”和“{b}”不能使用相同的属性键(“{value}”)。", + "Property keys can't be empty.": "属性键不能为空。", + "This renames {summary} in every note in your habits folder ({count} habit(s) currently). Existing values are moved, not discarded. Continue?": + "这将重命名习惯文件夹中每篇笔记的 {summary}(当前共 {count} 个习惯)。已有的值会被迁移,不会丢弃。是否继续?", + "Updated the frontmatter keys in {count} note(s).": + "已在 {count} 篇笔记中更新 frontmatter 键。", + "Renaming this away from the default also changes how binary habits log a day: instead of {\"2026-08-25\": 1}, a completed day becomes a bare date, like [\"2026-08-25\"] — the shape TaskNotes uses for complete_instances. Repetition and timed habits are unaffected either way; they always need a value, never just a date.": + '把这个键改成默认值以外的名称,也会改变二元习惯记录当天的方式:不再是 {"2026-08-25": 1},已完成的一天会变成一个纯日期,如 ["2026-08-25"] —— 这正是 TaskNotes 用于 complete_instances 的格式。计数和计时习惯不受影响,它们始终需要一个数值,而不仅仅是日期。', + Identity: "标识", + Legacy: "遗留", + Lifecycle: "生命周期", + Presentation: "外观", + "Note habit": "笔记习惯", + "Habit type key": "习惯类型键", + "Completion records key": "完成记录键", + "Frequency key": "频率键", + "Weekday key": "星期键", + "Month day key": "月内日期键", + "Interval days key": "间隔天数键", + "Planned time key": "计划时间键", + "Goal direction key": "目标方向键", + "Target key": "目标键", + "Unit key": "单位键", + "Step size key": "步长键", + "Weekly target key": "周目标键", + "Monthly target key": "月目标键", + "Weekly perfect key": "完美一周键", + "Monthly perfect key": "完美一月键", + "Start date key": "开始日期键", + "Pauses key": "暂停记录键", + "Stopped key": "停止状态键", + "Stop date key": "停止日期键", + "Icon key": "图标键", + "Color key": "颜色键", + "Group key": "分组键", + "Use group color key": "使用分组颜色键", + "Note folder key": "笔记文件夹键", + "Note filename format key": "笔记文件名格式键", + "Template path key": "模板路径键", + "Note completion mode key": "笔记完成模式键", + "Note checklist requirement key": "笔记清单要求键", + "Note checklist minimum key": "笔记清单最少数量键", + "Note fail keyword key": "笔记失败关键词键", + "Legacy comments key": "旧版评论键", + + // PDF export (read via docT() in export-modal.ts, which falls back to English for zh — jsPDF's built-in fonts can't render CJK) + "Completion trend": "完成趋势", + "(paused)": "(已暂停)", + "{rate}% · {total} · streak {current} (best {best})": + "{rate}% · {total} · 连击 {current}(最佳 {best})", + "Goal: {completed}/{goal} days met": + "目标:已达成 {completed}/{goal} 天", + "{range} · exported {date}": "{range} · 导出于 {date}", + "+{n} more": "还有 {n} 条", + + // Back-dating a missed day + Back: "返回", + + // Rescheduling missed habits (experimental) + "1 missed habit": "1 个错过的习惯", + "Add a notification button to the dashboard and sidebar panel when a habit's been missed, opening a review of missed days you can move onto a different one (never a day that habit is already due, so nothing doubles up).": + "当习惯被错过时,在仪表盘和侧边栏面板上添加一个通知按钮,点击可查看错过的日子,并将其移到另一天(绝不会是该习惯本来就到期的日子,避免重复记录)。", + "Missed habits": "错过的习惯", + "Move this missed day onto a different one": "将这个错过的日子移到另一天", + "Move to": "移到", + "Nothing missed right now.": "目前没有错过任何内容。", + "Pick a habit to move it onto a different day.": "选择一个习惯,将其移到另一天。", + Reschedule: "改期", + "Reschedule missed habits": "重新安排错过的习惯", + "Rescheduled \"{name}\" to {date}.": '已将"{name}"改期到 {date}。', + "Rescheduled from {date}": "从 {date} 改期而来", + "Reschedules key": "改期记录键", + "Failed days key": "失败日期键", + "Skipped days key": "跳过日期键", + "Rescheduling \"{name}\" — missed {date}.": '正在为"{name}"改期——错过了 {date}。', + "That day no longer works — pick another.": "那一天已经不可用了——请选择另一天。", + "That day won't work — it's either already due for this habit or already claimed by another reschedule.": + "那一天不行——要么这个习惯当天本来就到期,要么已经被另一次改期占用。", + "{count} missed habits": "{count} 个错过的习惯", + "The standalone Habits plugin is enabled. Task Genius shares its notes; automatic reminders and note syncing are handled by Habits to avoid duplicate writes.": "独立 Habits 插件仍在启用。Task Genius 共用其笔记;自动提醒和笔记同步由 Habits 处理,避免重复写入。", + "Interval schedule": "间隔排期方式", + "Fixed schedules follow the start date. Completion schedules stay due when missed and restart the interval after you complete the habit. Maximum limits keep a fixed schedule.": "固定排期从开始日期计算。按完成日期排期时,漏做的习惯会一直待办,完成后重新计算间隔。上限目标仍使用固定排期。", + "From start date": "从开始日期计算", + "From actual completion": "从实际完成日期计算", + "Existing Task Genius habits": "原有 Task Genius 习惯", + "Original daily-note records remain available below. Import creates habit notes with a complete source snapshot and never changes the original records.": "下方保留原有日记记录。导入会创建独立习惯笔记,并保存完整来源快照,不修改原始记录。", + "Import existing records": "导入原有记录", + "No records available to import.": "暂无可导入的记录。", + "Create {n} habit notes in {folder}? Existing notes and daily records will be preserved.": "将在 {folder} 中创建 {n} 个习惯笔记。现有笔记和日记记录都会保留,是否继续?", + "Imported {created} habits; skipped {skipped} existing imports.": "已导入 {created} 个习惯,跳过 {skipped} 个已导入习惯。", + "Habit import failed. Existing files have been preserved.": "习惯导入失败。现有文件已保留,可重试以继续导入。", + "Unable to load habits. Check the console for details.": "无法加载习惯,详细信息请查看控制台。", +}; diff --git a/src/integrations/habits/legacy-import.ts b/src/integrations/habits/legacy-import.ts new file mode 100644 index 000000000..3d4b44536 --- /dev/null +++ b/src/integrations/habits/legacy-import.ts @@ -0,0 +1,96 @@ +import { normalizePath, parseYaml, stringifyYaml, type App } from "obsidian"; +import type { HabitProps } from "@/types/habit-card"; +import { DEFAULT_FRONTMATTER_KEYS, type HabitsPluginSettings } from "./settings"; +import { sanitizeFileName } from "./utils"; + +export interface LegacyHabitPlan { + identity: string; + name: string; + type: "binary" | "repetition"; + target: number; + unit: string; + records: Record; + source: HabitProps; +} + +/** Pure conversion: retain the complete original record beside numeric statistics. */ +export function planLegacyHabits(habits: HabitProps[]): LegacyHabitPlan[] { + return habits.flatMap(habit => { + const events = habit.type === "scheduled" ? habit.events.map(event => event.name) : [""]; + return events.map(event => { + const records: Record = {}; + for (const [date, value] of Object.entries(habit.completions ?? {})) { + if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) continue; + if (habit.type === "scheduled") { + // A scheduled event is completed by presence, even with an empty detail. + if (value && typeof value === "object" && Object.prototype.hasOwnProperty.call(value, event)) records[date] = 1; + } else if (habit.type === "daily") { + if (value !== null && value !== false && value !== "" && value !== undefined && value !== 0) records[date] = 1; + } else if (typeof value === "number" && Number.isFinite(value)) records[date] = value; + } + return { + identity: JSON.stringify([habit.id, event]), + name: event ? `${habit.name} — ${event}` : habit.name, + type: habit.type === "count" || habit.type === "mapping" ? "repetition" as const : "binary" as const, + target: habit.type === "count" ? Math.max(0, habit.min ?? 1) : 1, + unit: habit.type === "count" ? habit.countUnit ?? "" : "", + records, + source: JSON.parse(JSON.stringify(habit)), + }; + }); + }); +} + +function suffix(identity: string): string { + let hash = 2166136261; + for (let i = 0; i < identity.length; i++) hash = Math.imul(hash ^ identity.charCodeAt(i), 16777619); + return (hash >>> 0).toString(16); +} + +/** Create-only import through Obsidian's vault API; never overwrite any existing file. */ +export async function importLegacyHabits(app: App, settings: HabitsPluginSettings, plans: LegacyHabitPlan[]): Promise<{created: number; skipped: number}> { + const folder = normalizePath(settings.habitsFolder.trim()); + if (!folder || folder === "." || folder.split("/").some(part => part === "..")) throw new Error("Invalid habits folder"); + let path = ""; + for (const part of folder.split("/")) { + path = path ? `${path}/${part}` : part; + if (!app.vault.getAbstractFileByPath(path)) await app.vault.createFolder(path); + } + const k = {...DEFAULT_FRONTMATTER_KEYS, ...settings.frontmatterKeys}; + const imported = new Set(); + // Read actual content so a renamed import remains idempotent, without relying + // on a metadata event arriving before a second import starts. + for (const file of app.vault.getMarkdownFiles()) { + if (!file.path.startsWith(`${folder}/`)) continue; + const text = await app.vault.read(file); + const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text); + if (!match) continue; + try { + const identity = parseYaml(match[1])?.taskGeniusLegacy?.identity; + if (typeof identity === "string") imported.add(identity); + } catch { /* Unrelated notes with malformed YAML are not modified. */ } + } + let created = 0, skipped = 0; + for (const plan of plans) { + if (imported.has(plan.identity)) { skipped++; continue; } + const name = sanitizeFileName(plan.name).slice(0, 100) || "Habit"; + const filePath = normalizePath(`${folder}/${name} (TG-${suffix(plan.identity)}).md`); + if (await app.vault.adapter.exists(filePath)) { + const text = await app.vault.adapter.read(filePath); + const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text); + if (!match || parseYaml(match[1])?.taskGeniusLegacy?.identity !== plan.identity) throw new Error(`Import conflict: ${filePath}`); + skipped++; + continue; + } + const fm = { + habit: true, [k.type]: plan.type, [k.frequency]: "daily", [k.target]: plan.target, + [k.unit]: plan.unit, [k.icon]: plan.source.icon, [k.records]: plan.records, + [k.startDate]: Object.keys(plan.records).sort()[0] ?? "", + taskGeniusLegacy: {identity: plan.identity, importedAt: new Date().toISOString(), source: plan.source}, + }; + await app.vault.create(filePath, `---\n${stringifyYaml(fm)}---\n\n# ${plan.name.replace(/[\r\n]/g, " ")}\n\n\`\`\`tg-habit-metrics\n\`\`\`\n`); + imported.add(plan.identity); + created++; + } + return {created, skipped}; +} diff --git a/src/integrations/habits/main.ts b/src/integrations/habits/main.ts new file mode 100644 index 000000000..381b5a894 --- /dev/null +++ b/src/integrations/habits/main.ts @@ -0,0 +1,458 @@ +import { + debounce, + Editor, + Events, + Notice, + normalizePath, + Plugin, + TFile, + type TAbstractFile, + type WorkspaceLeaf, +} from "obsidian"; +import { t } from "./i18n"; +import { HabitStore } from "./habit-store"; +import { ReminderSync } from "./reminders"; +import { NoteHabitSync } from "./note-habit"; +import { + DEFAULT_AI_SUMMARY, + DEFAULT_EXPERIMENTAL, + DEFAULT_FRONTMATTER_KEYS, + DEFAULT_REMINDERS, + DEFAULT_SETTINGS, + HabitsSettingTab, + type HabitsPluginSettings, +} from "./settings"; +import { HabitsBlock } from "./ui/habits-block"; +import { HabitMetrics } from "./ui/habit-metrics"; +import { HabitsHeatmap } from "./ui/habits-heatmap"; +import { HabitsTable } from "./ui/habits-table"; +import { HabitModal } from "./ui/habit-modal"; +import { HabitMetricsSuggest } from "./ui/metrics-suggest"; +import { + HABITS_PANEL_VIEW_TYPE, + HabitsPanelView, +} from "./ui/panel-view"; + +export default class HabitsPlugin extends Plugin { + settings: HabitsPluginSettings = DEFAULT_SETTINGS; + /** Plugin-internal event bus (e.g. "settings-changed"). */ + readonly events = new Events(); + /** Public so the settings tab can list habits for the order editor. */ + store!: HabitStore; + + async onload(): Promise { + await this.loadSettings(); + if (!this.integrationActive()) return; + this.store = new HabitStore( + this.app, + () => this.settings, + () => this.saveSettings(), + ); + + this.addSettingTab(new HabitsSettingTab(this.app, this)); + + // Lets Core Plugins → Page preview offer hover previews for the + // [[links]] users write in day comments. + this.registerHoverLinkSource("tg-habits", { + display: t("Habits"), + defaultMod: true, + }); + + this.registerMarkdownCodeBlockProcessor("habits", (_source, el, ctx) => { + const dashboard = new HabitsBlock( + this.app, + this.store, + () => this.settings, + this.events, + ctx.sourcePath, + el, + ); + ctx.addChild(dashboard); + }); + + this.registerMarkdownCodeBlockProcessor( + "habit-metrics", + (source, el, ctx) => { + ctx.addChild( + new HabitMetrics( + this.app, + this.store, + ctx.sourcePath, + source, + el, + ctx, + ), + ); + }, + ); + + this.registerMarkdownCodeBlockProcessor( + "habits-table", + (_source, el, ctx) => { + ctx.addChild( + new HabitsTable( + this.app, + this.store, + () => this.settings, + this.events, + el, + ), + ); + }, + ); + + this.registerMarkdownCodeBlockProcessor( + "habits-heatmap", + (source, el, ctx) => { + ctx.addChild( + new HabitsHeatmap( + this.app, + this.store, + this.events, + ctx.sourcePath, + source, + el, + ctx, + ), + ); + }, + ); + + this.registerEditorSuggest( + new HabitMetricsSuggest(this.app, this.store), + ); + + this.registerView( + HABITS_PANEL_VIEW_TYPE, + (leaf) => + new HabitsPanelView( + leaf, + this.store, + () => this.settings, + this.events, + ), + ); + + this.addRibbonIcon("list-checks", t("Open habits panel"), () => { + void this.activatePanel(); + }); + + this.addCommand({ + id: "open-panel", + name: t("Open panel"), + callback: () => { + void this.activatePanel(); + }, + }); + + this.addCommand({ + id: "create-habit", + name: t("Create habit"), + callback: () => { + new HabitModal( + this.app, + this.store, + () => { + // The dashboard reloads itself when reopened. + }, + null, + this.settings.experimental.noteHabits, + ).open(); + }, + }); + + // Keep the manual sort order pointing at the right notes when a + // habit is renamed or moved. + this.registerEvent( + this.app.vault.on("rename", (file, oldPath) => { + const index = this.settings.manualOrder.indexOf(oldPath); + if (index >= 0) { + this.settings.manualOrder[index] = file.path; + void this.saveData(this.settings); + } + }), + ); + + this.watchComments(); + + this.addCommand({ + id: "migrate-comments", + name: t("Move day comments into note bodies"), + callback: () => { + void this.migrateComments(); + }, + }); + + this.addCommand({ + id: "insert-dashboard", + name: t("Insert dashboard"), + editorCallback: (editor: Editor) => { + editor.replaceSelection("```tg-habits\n```\n"); + }, + }); + + this.addCommand({ + id: "insert-habit-metrics", + name: t("Insert habit metrics"), + editorCallback: (editor: Editor) => { + // Every field is written out so it's clear what can be set: + // `habits:` names one habit, or several (comma-separated) to + // compare them; left empty, the block shows its own note's + // habit. `view:` picks the opening tab (charts/month/history); + // `range:` is the timeframe when comparing several habits. + const start = editor.getCursor("from"); + editor.replaceSelection( + "```tg-habit-metrics\nhabits: \nview: charts\nrange: 12w\n```\n", + ); + editor.setCursor({ line: start.line + 1, ch: "habits: ".length }); + }, + }); + + this.addCommand({ + id: "insert-table", + name: t("Insert habits table"), + editorCallback: (editor: Editor) => { + editor.replaceSelection("```tg-habits-table\n```\n"); + }, + }); + + this.addCommand({ + id: "insert-heatmap", + name: t("Insert habits heatmap"), + editorCallback: (editor: Editor) => { + editor.replaceSelection("```tg-habits-heatmap\n```\n"); + }, + }); + + this.registerReminderSync(); + this.registerNoteHabitSync(); + } + + /** + * Keeps note habits' records in step with their day-notes: primes every + * note habit's folder once the vault is ready, then watches for edits so + * writing (or deleting) a day-note updates its habit's completion live. + */ + protected integrationActive(): boolean { return true; } + protected backgroundSyncAllowed(): boolean { return this.integrationActive(); } + + private registerNoteHabitSync(): void { + const sync = new NoteHabitSync(this.app, this.store); + const prime = () => { if (this.backgroundSyncAllowed()) void sync.primeAll(); }; + this.registerEvent(this.events.on("settings-changed", prime)); + + this.app.workspace.onLayoutReady(() => prime()); + this.registerEvent( + this.app.vault.on("modify", (file) => { + if (file instanceof TFile && this.backgroundSyncAllowed()) { + void sync.syncFile(file); + } + }), + ); + this.registerEvent( + this.app.vault.on("create", (file) => { + if (file instanceof TFile && this.backgroundSyncAllowed()) { + void sync.syncFile(file); + } + }), + ); + this.registerEvent( + this.app.vault.on("delete", (file) => { + if (this.backgroundSyncAllowed()) void sync.handleDelete(file.path); + }), + ); + this.registerEvent( + this.app.vault.on("rename", (file, oldPath) => { + if (this.backgroundSyncAllowed()) void sync.handleDelete(oldPath); + if (file instanceof TFile && this.backgroundSyncAllowed()) { + void sync.syncFile(file); + } + }), + ); + } + + /** + * Keep the reminder block in step with the habits: regenerate it when + * the plugin loads, when a habit note changes, when settings change, + * when the target daily note is created, and when the day rolls over + * (so the new day's note gets its block without a restart). + */ + private registerReminderSync(): void { + const sync = new ReminderSync(this.app, this.store, () => this.settings); + const requestUpdate = debounce(() => { if (this.backgroundSyncAllowed()) void sync.update(); }, 1000, true); + + const isHabitFile = (path: string): boolean => { + const folder = normalizePath(this.settings.habitsFolder); + return path === folder || path.startsWith(`${folder}/`); + }; + + this.app.workspace.onLayoutReady(() => requestUpdate()); + this.registerEvent( + this.app.metadataCache.on("changed", (file) => { + // The target note matters too: ticking a reminder line + // there (by hand or from a notification) logs the habit. + if ( + isHabitFile(file.path) || + file.path === sync.targetPath(new Date()) + ) { + requestUpdate(); + } + }), + ); + this.registerEvent( + this.app.vault.on("create", (file) => { + // A new habit, or the target note appearing (e.g. today's + // daily note being created after the plugin loaded). + if ( + isHabitFile(file.path) || + file.path === sync.targetPath(new Date()) + ) { + requestUpdate(); + } + }), + ); + this.registerEvent( + this.app.vault.on("delete", (file) => { + if (isHabitFile(file.path)) { + requestUpdate(); + } + }), + ); + this.registerEvent( + this.app.vault.on("rename", (file, oldPath) => { + if (isHabitFile(file.path) || isHabitFile(oldPath)) { + requestUpdate(); + } + }), + ); + this.registerEvent( + this.events.on("settings-changed", () => requestUpdate()), + ); + + // Day rollover: a minute-level check is cheap and avoids the drift + // and DST pitfalls of scheduling one long timeout for midnight. + let currentDay = new Date().toDateString(); + this.registerInterval( + window.setInterval(() => { + const day = new Date().toDateString(); + if (day !== currentDay) { + currentDay = day; + requestUpdate(); + } + }, 60_000), + ); + } + + /** + * Day comments live in the note body, which can only be read + * asynchronously, so the store caches them. Prime that cache once the + * vault is ready and keep it in step with edits from any source — + * including the user typing straight into a habit note. + */ + private watchComments(): void { + const notify = debounce( + () => this.events.trigger("comments-changed"), + 150, + true, + ); + const refresh = async (file: TAbstractFile): Promise => { + if (!(file instanceof TFile) || !this.store.isHabitFile(file.path)) { + return; + } + if (await this.store.refreshComments(file)) { + notify(); + } + }; + + this.app.workspace.onLayoutReady(() => { + void this.store.primeComments().then((changed) => { + if (changed) { + notify(); + } + }); + }); + this.registerEvent( + this.app.vault.on("modify", (file) => void refresh(file)), + ); + this.registerEvent( + this.app.vault.on("create", (file) => void refresh(file)), + ); + this.registerEvent( + this.app.vault.on("delete", (file) => { + this.store.forgetComments(file.path); + }), + ); + this.registerEvent( + this.app.vault.on("rename", (file, oldPath) => { + this.store.forgetComments(oldPath); + void refresh(file); + }), + ); + } + + /** Bulk-migrate notes still keeping their comments in frontmatter. */ + private async migrateComments(): Promise { + if (!this.store.hasLegacyComments()) { + new Notice(t("No comments left to move.")); + return; + } + const count = await this.store.migrateComments(); + this.events.trigger("comments-changed"); + new Notice( + count === 1 + ? t("Moved comments in 1 note.") + : t("Moved comments in {n} notes.", { n: count }), + ); + } + + /** Open (or reveal) the habits panel in the right sidebar. */ + private async activatePanel(): Promise { + const existing = this.app.workspace.getLeavesOfType( + HABITS_PANEL_VIEW_TYPE, + ); + let leaf: WorkspaceLeaf | null = existing[0] ?? null; + if (!leaf) { + leaf = this.app.workspace.getRightLeaf(false); + if (!leaf) { + return; + } + await leaf.setViewState({ + type: HABITS_PANEL_VIEW_TYPE, + active: true, + }); + } + await this.app.workspace.revealLeaf(leaf); + } + + async loadSettings(): Promise { + const data = (await this.loadData()) as + | Partial + | null; + this.settings = Object.assign(JSON.parse(JSON.stringify(DEFAULT_SETTINGS)), data ?? {}); + // Merge nested experimental flags so a data.json saved before a new + // flag existed still picks up that flag's default. + this.settings.experimental = { + ...DEFAULT_EXPERIMENTAL, + ...(data?.experimental ?? {}), + }; + this.settings.aiSummary = { + ...DEFAULT_AI_SUMMARY, + ...(data?.aiSummary ?? {}), + }; + this.settings.reminders = { + ...DEFAULT_REMINDERS, + ...(data?.reminders ?? {}), + }; + this.settings.frontmatterKeys = { + ...DEFAULT_FRONTMATTER_KEYS, + ...(data?.frontmatterKeys ?? {}), + }; + this.settings.groups = { ...(data?.groups ?? {}) }; + this.settings.snoozes = { ...(data?.snoozes ?? {}) }; + } + + async saveSettings(): Promise { + await this.saveData(this.settings); + this.events.trigger("settings-changed"); + } +} diff --git a/src/integrations/habits/note-habit.ts b/src/integrations/habits/note-habit.ts new file mode 100644 index 000000000..8b6ddbeb0 --- /dev/null +++ b/src/integrations/habits/note-habit.ts @@ -0,0 +1,375 @@ +import { App, moment, normalizePath, Notice, TFile, TFolder } from "obsidian"; +import type { HabitStore } from "./habit-store"; +import type { HabitDefinition } from "./types"; +import { fromDateKey, parseNoteDate, toDateKey } from "./utils"; +import { t } from "./i18n"; + +/** Default filename format for a note habit's day-notes. */ +export const DEFAULT_NOTE_FILENAME_FORMAT = "YYYY-MM-DD"; + +/** The slice of Moment.js formatting this module needs, typed by hand. */ +interface FormattableMoment { + format(format: string): string; +} +const toMoment = moment as unknown as (input: Date) => FormattableMoment; + +/** The note habit's filename format, defaulting when blank. */ +function filenameFormat(habit: HabitDefinition): string { + return habit.noteFilenameFormat.trim() || DEFAULT_NOTE_FILENAME_FORMAT; +} + +/** + * Vault path of the note a `note` habit's day should live at. May include + * subfolders when the filename format contains `/` (e.g. `YYYY/MM-DD`), + * mirroring how the Daily notes plugin supports year subfolders. + */ +export function notePathForDate( + habit: HabitDefinition, + dateKey: string, +): string { + const date = fromDateKey(dateKey) ?? new Date(); + const relative = toMoment(date).format(filenameFormat(habit)); + const folder = normalizePath(habit.noteFolder.trim()); + return normalizePath( + folder && folder !== "/" ? `${folder}/${relative}.md` : `${relative}.md`, + ); +} + +/** + * Reverse-match a vault path back to the day it belongs to for a note habit + * (folder containment plus a strict Moment parse of the remaining path + * against the habit's filename format). Returns `null` when the path is not + * one of this habit's day-notes. + */ +export function matchNoteDate( + habit: HabitDefinition, + path: string, +): string | null { + if (!path.endsWith(".md")) { + return null; + } + const folder = normalizePath(habit.noteFolder.trim()); + let relative: string; + if (folder === "" || folder === "/") { + relative = path; + } else if (path === folder || !path.startsWith(`${folder}/`)) { + return null; + } else { + relative = path.slice(folder.length + 1); + } + relative = relative.slice(0, -3); // drop ".md" + const date = parseNoteDate(relative, filenameFormat(habit)); + return date ? toDateKey(date) : null; +} + +/** Strip a leading `---`…`---` frontmatter block, if any. */ +export function stripFrontmatter(content: string): string { + const lines = content.split("\n"); + if (lines[0]?.trim() !== "---") { + return content; + } + const end = lines.findIndex( + (line, i) => i > 0 && line.trim() === "---", + ); + if (end === -1) { + return content; + } + return lines.slice(end + 1).join("\n"); +} + +/** Character count of a note's body, frontmatter stripped and trimmed. */ +export function countChars(content: string): number { + return stripFrontmatter(content).trim().length; +} + +/** One task-list item: whether it's checked, and its label text. */ +export interface ChecklistItem { + checked: boolean; + text: string; +} + +/** Every task-list item in a note's body, in document order. */ +export function checklistItems(content: string): ChecklistItem[] { + const body = stripFrontmatter(content); + const items: ChecklistItem[] = []; + for (const match of body.matchAll(/^[ \t]*[-*+] \[(.)\][ \t]?(.*)$/gm)) { + items.push({ + checked: match[1].toLowerCase() === "x", + text: match[2].trim(), + }); + } + return items; +} + +/** Total task-list items in a note's body, and how many are checked. */ +export function checklistProgress(content: string): { + checked: number; + total: number; +} { + const items = checklistItems(content); + return { + total: items.length, + checked: items.filter((item) => item.checked).length, + }; +} + +/** + * True when a checked item's label contains the habit's configured fail + * keyword (case-insensitive), e.g. a "Slipped" item ticked on a day the + * user missed every option on an otherwise flexible checklist. An empty + * keyword disables the feature. + */ +export function hasFailedChecklistItem( + habit: HabitDefinition, + content: string, +): boolean { + const keyword = habit.noteFailKeyword.trim().toLowerCase(); + if (!keyword) { + return false; + } + return checklistItems(content).some( + (item) => item.checked && item.text.toLowerCase().includes(keyword), + ); +} + +/** + * Fraction (0–1) of a habit's checklist requirement satisfied by + * `checked`/`total` items: every item checked in `all` mode, or at least + * `noteChecklistMin` of them (any of them) checked in `count` mode. + */ +function checklistFraction( + habit: HabitDefinition, + checked: number, + total: number, +): number { + if (habit.noteChecklistRequirement === "count") { + return Math.min(1, checked / Math.max(1, habit.noteChecklistMin)); + } + return total > 0 ? checked / total : 0; +} + +/** + * Reduce a day-note's content to the single number stored in `records`, + * keeping the plugin's existing numeric completion, streak, and stats + * machinery unchanged: + * + * - `chars`: the raw character count. + * - `checklist`, `all` requirement: a 0–100 checked percentage (against a + * fixed `target` of 100), since the number of tasks varies day to day. + * - `checklist`, `count` requirement: the raw checked count (against + * `target` = `noteChecklistMin`). + * - `both`: the lower of the char and checklist fractions, scaled to + * `target` (the character goal) — `value >= target` then only holds once + * neither is the bottleneck. + * + * Regardless of mode, a checked item matching `noteFailKeyword` forces the + * value to `0`, an automatic fail that overrides everything else. + */ +export function computeNoteValue( + habit: HabitDefinition, + content: string, +): number { + if (hasFailedChecklistItem(habit, content)) { + return 0; + } + + if (habit.noteCompletionMode === "chars") { + return countChars(content); + } + + // Both scaled fractions below use floor rather than round: on a large + // enough checklist, rounding a not-quite-1 fraction (e.g. 199/200) can + // land exactly on the target and read as complete one tick early. + // Flooring can't overshoot the true threshold, and still lands exactly + // on it — floor(1 * n) === n — when the requirement is genuinely met. + const { checked, total } = checklistProgress(content); + if (habit.noteCompletionMode === "checklist") { + return habit.noteChecklistRequirement === "count" + ? checked + : Math.floor(checklistFraction(habit, checked, total) * 100); + } + + // "both": target doubles as the character goal in this mode (see + // habit-modal.ts), so scaling the combined fraction to it is what makes + // the generic `value >= target` completion check land at "both met". + const charGoal = habit.target > 0 ? habit.target : 1; + const charsFraction = Math.min(1, countChars(content) / charGoal); + const combined = Math.min( + charsFraction, + checklistFraction(habit, checked, total), + ); + return Math.floor(combined * charGoal); +} + +/** The subset of the Templater plugin's API this module calls into. */ +interface TemplaterApi { + create_new_note_from_template( + template: TFile, + folder?: TFolder, + filename?: string, + openNewNote?: boolean, + ): Promise; +} + +/** The Templater plugin's exposed API, if the plugin is installed and enabled. */ +function findTemplater(app: App): TemplaterApi | null { + const plugins = ( + app as unknown as { + plugins?: { plugins?: Record }; + } + ).plugins?.plugins; + const candidate = plugins?.["templater-obsidian"] as + | { templater?: TemplaterApi } + | undefined; + return candidate?.templater ?? null; +} + +/** True once, per template, so the missing-Templater hint isn't repeated. */ +const warnedMissingTemplater = new Set(); + +/** + * Create (or return the existing) day-note for a note habit. With a template + * and Templater installed, the template is expanded through Templater's own + * API; with a template but no Templater, its raw text is copied verbatim + * (and a one-time Notice suggests installing Templater if the text looks + * like it uses Templater syntax); with no template, an empty note is + * created. + */ +export async function createNoteHabitEntry( + app: App, + habit: HabitDefinition, + dateKey: string, +): Promise { + const path = notePathForDate(habit, dateKey); + const existing = app.vault.getAbstractFileByPath(path); + if (existing instanceof TFile) { + return existing; + } + + const slash = path.lastIndexOf("/"); + const folderPath = slash >= 0 ? path.slice(0, slash) : ""; + const filename = (slash >= 0 ? path.slice(slash + 1) : path).replace( + /\.md$/, + "", + ); + if (folderPath) { + const folder = app.vault.getAbstractFileByPath(folderPath); + if (!(folder instanceof TFolder)) { + await app.vault.createFolder(folderPath); + } + } + + const templatePath = normalizePath(habit.templatePath.trim()); + const templateFile = templatePath + ? app.vault.getAbstractFileByPath(templatePath) + : null; + if (templateFile instanceof TFile) { + const templater = findTemplater(app); + if (templater) { + const folder = folderPath + ? app.vault.getAbstractFileByPath(folderPath) + : app.vault.getRoot(); + if (folder instanceof TFolder) { + const created = await templater.create_new_note_from_template( + templateFile, + folder, + filename, + false, + ); + if (created instanceof TFile) { + return created; + } + } + } + const content = await app.vault.cachedRead(templateFile); + const looksLikeTemplater = !templater && content.includes("<%"); + if (looksLikeTemplater && !warnedMissingTemplater.has(templatePath)) { + warnedMissingTemplater.add(templatePath); + new Notice( + t( + '"{name}" uses Templater syntax, but the Templater plugin is not installed — the template was copied as plain text.', + { name: templateFile.basename }, + ), + ); + } + return await app.vault.create(path, content); + } + + return await app.vault.create(path, ""); +} + +/** + * Keeps note habits' `records` in step with their day-notes: watches the + * vault for edits to any file that matches a note habit's folder and + * filename format, and writes the derived character count or checked + * percentage back through {@link HabitStore.setRecord} — the same numeric + * record every other habit type uses, so streaks and stats need no changes + * of their own. + */ +export class NoteHabitSync { + constructor( + private app: App, + private store: HabitStore, + ) {} + + private noteHabits(): HabitDefinition[] { + return this.store + .getHabits() + .filter((habit) => habit.type === "note" && !habit.stopped); + } + + private async syncOne(habit: HabitDefinition, file: TFile): Promise { + const dateKey = matchNoteDate(habit, file.path); + if (!dateKey) { + return; + } + const content = await this.app.vault.cachedRead(file); + const value = computeNoteValue(habit, content); + if ((habit.records[dateKey] ?? 0) !== value) { + await this.store.setRecord(habit, dateKey, value); + } + } + + /** Recompute every note habit whose day-note this file might be. */ + async syncFile(file: TFile): Promise { + if (file.extension !== "md") { + return; + } + for (const habit of this.noteHabits()) { + await this.syncOne(habit, file); + } + } + + /** A day-note was deleted or moved away: clear its record, if any. */ + async handleDelete(path: string): Promise { + for (const habit of this.noteHabits()) { + const dateKey = matchNoteDate(habit, path); + if (dateKey && (habit.records[dateKey] ?? 0) !== 0) { + await this.store.setRecord(habit, dateKey, 0); + } + } + } + + /** + * One-time backfill over every note habit's folder, so day-notes that + * already existed before the plugin loaded (or before a habit's folder + * was pointed at them) are picked up without needing an edit first. + */ + async primeAll(): Promise { + for (const habit of this.noteHabits()) { + const folder = normalizePath(habit.noteFolder.trim()); + const files = this.app.vault + .getMarkdownFiles() + .filter( + (file) => + folder === "" || + folder === "/" || + file.path === folder || + file.path.startsWith(`${folder}/`), + ); + for (const file of files) { + await this.syncOne(habit, file); + } + } + } +} diff --git a/src/integrations/habits/reminders.ts b/src/integrations/habits/reminders.ts new file mode 100644 index 000000000..53bd6d441 --- /dev/null +++ b/src/integrations/habits/reminders.ts @@ -0,0 +1,475 @@ +import { App, TFile, moment, normalizePath } from "obsidian"; +import type { HabitStore } from "./habit-store"; +import type { HabitsPluginSettings } from "./settings"; +import type { HabitDefinition } from "./types"; +import { isDue, isFailedOn, isPausedOn } from "./stats"; +import { toDateKey } from "./utils"; + +/** + * Obsidian's bundled Moment.js, typed by hand — its own type definitions + * are not always resolvable in stricter lint setups, which would otherwise + * make every call through `moment` unsafely typed (mirrors the same cast + * in utils.ts and note-habit.ts). + */ +const formatDate = moment as unknown as ( + input: Date, +) => { format(format: string): string }; + +/** + * Markers around the plugin-managed reminder block. Obsidian `%%` comments, + * so they stay invisible in reading view while the checklist lines between + * them render (and get scanned by the Reminder plugin) normally. + */ +export const REMINDERS_START = "%% habits-reminders start %%"; +export const REMINDERS_END = "%% habits-reminders end %%"; + +/** One reminder checklist line in the Reminder plugin's default format. */ +export function reminderLine( + name: string, + dateKey: string, + time: string, + checked: boolean, +): string { + return `- [${checked ? "x" : " "}] ${name} (@${dateKey} ${time})`; +} + +/** The managed block inside `content`, or null when the markers are absent. */ +function findBlock( + content: string, +): { start: number; end: number; body: string } | null { + const start = content.indexOf(REMINDERS_START); + if (start < 0) { + return null; + } + const bodyStart = start + REMINDERS_START.length; + const end = content.indexOf(REMINDERS_END, bodyStart); + if (end < 0) { + return null; + } + return { + start, + end: end + REMINDERS_END.length, + body: content.slice(bodyStart, end), + }; +} + +/** One parsed checklist line of the managed block. */ +export interface ReminderBlockLine { + checked: boolean; + name: string; + date: string; + time: string; +} + +/** Parse every reminder line inside the managed block. */ +export function parseReminderLines(content: string): ReminderBlockLine[] { + const block = findBlock(content); + if (!block) { + return []; + } + const line = + /^- \[([ xX])\] (.+) \(@(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2})\)$/gm; + return [...block.body.matchAll(line)].map((match) => ({ + checked: match[1] !== " ", + name: match[2], + date: match[3], + time: match[4], + })); +} + +/** + * The `name|time` keys of lines ticked off inside the managed block. + * Regeneration keeps these checked even when the habit's record does not + * account for them — a partially ticked binary habit (one of two times + * done) would otherwise lose its tick on every refresh, since a binary + * record has no way to express half a day. + */ +export function checkedKeys(content: string): Set { + const keys = new Set(); + for (const line of parseReminderLines(content)) { + if (line.checked) { + keys.add(`${line.name}|${line.time}`); + } + } + return keys; +} + +/** + * The day's goal for a counted or timed habit — the target, floored at 1 + * so a habit saved without one still logs something when ticked. + */ +function goalOf(habit: HabitDefinition): number { + return Math.max(habit.target, 1); +} + +/** + * True when the habit's record can express a partly ticked day. + * + * That needs every planned time to own at least one whole unit of the + * goal. A binary record never can — 0 or 1 has no way to say "one session + * of two" — and neither can a goal smaller than its number of times, such + * as a single tablet reminded for twice. Those habits are all-or-nothing, + * and their partial ticks are kept visually instead. + */ +function splitsEvenly(habit: HabitDefinition): boolean { + return habit.type !== "binary" && goalOf(habit) >= habit.times.length; +} + +/** The value that marks a whole day done. */ +function doneValue(habit: HabitDefinition): number { + return habit.type === "binary" ? 1 : goalOf(habit); +} + +/** + * The record value today's tick state calls for. Ticking is logging. + * + * A binary habit is done once *all* its lines are ticked, and un-done + * when one is unticked again. Counted and timed habits log the share of + * the day's goal that the ticked lines represent, so a single tick on a + * habit with one planned time records the whole target: ticking off + * "Meditate" writes its 15 minutes, not a bare 1. With several times the + * goal is split across them — two of four ticks on a 30-minute habit + * records 15. + * + * A larger value logged in the dashboard survives while every line stays + * ticked, so reading for 40 minutes against a 20-minute target is not + * quietly rounded back down by a regeneration. + */ +export function desiredRecord( + habit: HabitDefinition, + checked: number, + total: number, + current: number, +): number { + const goal = goalOf(habit); + if (checked === total && current >= goal && habit.type !== "binary") { + return current; + } + if (!splitsEvenly(habit)) { + return checked === total ? doneValue(habit) : 0; + } + // Rounded *up*, because this has to be the exact inverse of the floor + // in coveredTimes: the smallest value that still reads back as this + // many covered lines. Rounding to nearest instead would let a middle + // tick write a value that regenerates as one tick fewer, and the block + // would undo the tick the user had just made. + return total > 0 ? Math.ceil((goal * checked) / total) : 0; +} + +/** Snapshot key for one line's tick state. */ +function tickKey(line: ReminderBlockLine): string { + return `${line.date}|${line.name}|${line.time}`; +} + +/** + * The habits whose tick state differs from the snapshot taken after our + * last regeneration — the actual user edits. Only these may write records: + * a line can be stale the *other* way round (the record just changed in + * the dashboard and the block has not been regenerated yet), and mirroring + * such a line back would silently revert the fresh record. A line the + * snapshot has never seen counts as an edit only when it is ticked, so + * ticks made while the plugin was not watching are still honoured. + */ +export function changedHabitNames( + lines: ReminderBlockLine[], + snapshot: ReadonlyMap | null, +): Set { + const changed = new Set(); + for (const line of lines) { + const before = snapshot?.get(tickKey(line)); + if (before === undefined ? line.checked : before !== line.checked) { + changed.add(line.name); + } + } + return changed; +} + +/** + * How many of the habit's planned times today's record already covers. + * + * This is the exact inverse of {@link desiredRecord}: a counted or timed + * habit covers a line for each whole share of the goal its value reaches, + * so writing the value a tick asks for and reading it back produces the + * same ticks. The two must agree, or every regeneration would disturb the + * ticks it had just written. Binary values stay all-or-nothing. + */ +function coveredTimes(habit: HabitDefinition, value: number): number { + const total = habit.times.length; + if (!splitsEvenly(habit)) { + return value >= doneValue(habit) ? total : 0; + } + const covered = Math.floor((value * total) / goalOf(habit)); + return Math.max(0, Math.min(total, covered)); +} + +/** + * Today's reminder lines: one per planned time of every habit that is due + * today, in time order. Lines start checked when today's record already + * covers that time or when the user ticked them off in the previous block. + * Habits with no planned times, paused habits, and limit habits (reminding + * to *not* do something is unhelpful) produce no lines. + */ +export function reminderLines( + habits: HabitDefinition[], + today: Date, + previouslyChecked: Set, +): string[] { + const dateKey = toDateKey(today); + const entries: { time: string; line: string }[] = []; + for (const habit of habits) { + if ( + habit.stopped || + habit.goalDirection === "max" || + habit.times.length === 0 || + isPausedOn(habit, dateKey) || + isFailedOn(habit, dateKey) || + !isDue(habit, today) + ) { + continue; + } + const covered = coveredTimes(habit, habit.records[dateKey] ?? 0); + habit.times.forEach((time, index) => { + // Habits whose record can express a partial day mirror it + // exactly — ticking is logging, so the record is the whole + // truth. The all-or-nothing ones need their ticks remembered + // instead, or a partial tick would be lost on every refresh. + const checked = + index < covered || + (!splitsEvenly(habit) && + previouslyChecked.has(`${habit.name}|${time}`)); + entries.push({ + time, + line: reminderLine(habit.name, dateKey, time, checked), + }); + }); + } + entries.sort((a, b) => a.time.localeCompare(b.time)); + return entries.map((entry) => entry.line); +} + +/** + * Return `content` with the managed block replaced by `lines`. With lines + * to write, a missing block is appended at the end of the note; with none, + * an existing block is emptied but its markers stay — they may have been + * planted by a daily-note template to pick the block's position, and + * keeping them means the next refill lands in that same spot. A note + * without markers is left untouched on an empty day. + */ +export function applyReminderLines( + content: string, + lines: string[], +): string { + const existing = findBlock(content); + if (lines.length === 0 && !existing) { + return content; + } + const body = lines.length > 0 ? `${lines.join("\n")}\n` : ""; + const block = `${REMINDERS_START}\n${body}${REMINDERS_END}`; + if (existing) { + return ( + content.slice(0, existing.start) + + block + + content.slice(existing.end) + ); + } + const separator = content.endsWith("\n\n") + ? "" + : content.endsWith("\n") + ? "\n" + : "\n\n"; + return content + separator + block + "\n"; +} + +/** The subset of the core Daily notes plugin's options we read. */ +interface DailyNotesOptions { + folder?: string; + format?: string; +} + +/** Folder and name format configured in the core Daily notes plugin. */ +function dailyNoteOptions(app: App): DailyNotesOptions { + const withInternals = app as unknown as { + internalPlugins?: { + getPluginById?: (id: string) => { + instance?: { options?: DailyNotesOptions }; + } | null; + }; + }; + return ( + withInternals.internalPlugins?.getPluginById?.("daily-notes")?.instance + ?.options ?? {} + ); +} + +/** + * Keeps a managed block of reminder lines in sync with today's due habits, + * in the checklist format the Reminder plugin scans — the bridge that turns + * habit schedules into actual notifications. Writing markdown is the whole + * integration: the Reminder plugin has no API, its input surface is notes. + */ +export class ReminderSync { + /** + * Tick state of the block as of our last regeneration (or first read), + * keyed per line. Diffing against it separates user edits from lines + * that are merely stale because a record changed elsewhere first. + */ + private lastTicks: Map | null = null; + + constructor( + private app: App, + private store: HabitStore, + private getSettings: () => HabitsPluginSettings, + ) {} + + /** Refresh the tick snapshot from the note content just written/read. */ + private rememberTicks(content: string): void { + this.lastTicks = new Map( + parseReminderLines(content).map((line) => [ + tickKey(line), + line.checked, + ]), + ); + } + + /** Vault path the block should live in today, or null when unknown. */ + targetPath(today: Date): string | null { + const settings = this.getSettings().reminders; + if (settings.target === "fixed-note") { + const path = settings.notePath.trim(); + return path ? normalizePath(path) : null; + } + const options = dailyNoteOptions(this.app); + const name = formatDate(today).format(options.format || "YYYY-MM-DD"); + const folder = options.folder?.trim() ?? ""; + return normalizePath(folder ? `${folder}/${name}.md` : `${name}.md`); + } + + /** + * Regenerate the block for `today`. The daily note is never created by + * the plugin — the block is added once the note exists (the caller + * re-runs on file creation); a fixed note is created on demand. The + * file is only written when the block actually changed. + */ + async update(today = new Date()): Promise { + const settings = this.getSettings().reminders; + if (!settings.enabled) { + return; + } + const path = this.targetPath(today); + if (!path) { + return; + } + const file = this.app.vault.getAbstractFileByPath(path); + if (!(file instanceof TFile)) { + if (file || settings.target !== "fixed-note") { + return; + } + const lines = reminderLines( + this.store.getHabits(), + today, + new Set(), + ); + if (lines.length > 0) { + await this.ensureParentFolder(path); + const created = applyReminderLines("", lines); + await this.app.vault.create(path, created); + this.rememberTicks(created); + } + return; + } + const content = await this.app.vault.cachedRead(file); + await this.syncRecords(content, today); + const next = applyReminderLines( + content, + reminderLines( + this.store.getHabits(), + today, + checkedKeys(content), + ), + ); + if (next === content) { + this.rememberTicks(content); + return; + } + let written = next; + await this.app.vault.process(file, (current) => { + written = applyReminderLines( + current, + reminderLines( + this.store.getHabits(), + today, + checkedKeys(current), + ), + ); + return written; + }); + this.rememberTicks(written); + } + + /** + * Ticking is logging: carry the block's *edited* tick state into the + * habit records (per {@link desiredRecord}) before the block is + * regenerated from those records. Only habits whose ticks changed + * since our last regeneration count as edited — a record logged in + * the dashboard a moment ago leaves the block momentarily stale, and + * mirroring those untouched lines back would revert the fresh record. + * Changed records are mirrored into the in-memory habit immediately, + * so the regeneration that follows sees them before the note write + * round-trips through the cache. + */ + private async syncRecords(content: string, today: Date): Promise { + const dateKey = toDateKey(today); + const todayLines = parseReminderLines(content).filter( + (line) => line.date === dateKey, + ); + const edited = changedHabitNames(todayLines, this.lastTicks); + if (edited.size === 0) { + return; + } + const ticks = new Map(); + for (const line of todayLines) { + const tally = ticks.get(line.name) ?? { checked: 0, total: 0 }; + tally.total += 1; + tally.checked += line.checked ? 1 : 0; + ticks.set(line.name, tally); + } + for (const habit of this.store.getHabits()) { + const tally = ticks.get(habit.name); + if ( + !tally || + !edited.has(habit.name) || + habit.stopped || + habit.goalDirection === "max" || + isPausedOn(habit, dateKey) || + isFailedOn(habit, dateKey) || + !isDue(habit, today) + ) { + continue; + } + const current = habit.records[dateKey] ?? 0; + const desired = desiredRecord( + habit, + tally.checked, + tally.total, + current, + ); + if (desired === current) { + continue; + } + if (desired > 0) { + habit.records[dateKey] = desired; + } else { + delete habit.records[dateKey]; + } + await this.store.setRecord(habit, dateKey, desired); + } + } + + /** Create the folders leading up to `path` when they are missing. */ + private async ensureParentFolder(path: string): Promise { + const parent = path.split("/").slice(0, -1).join("/"); + if (parent && !this.app.vault.getAbstractFileByPath(parent)) { + await this.app.vault.createFolder(parent); + } + } +} diff --git a/src/integrations/habits/scoped.css b/src/integrations/habits/scoped.css new file mode 100644 index 000000000..b3bcfe6c7 --- /dev/null +++ b/src/integrations/habits/scoped.css @@ -0,0 +1,3226 @@ +/* Generated by scripts/scope-habits-css.mjs; upstream MIT licensed. */ +/* Habits plugin — dashboard styles. + Colours use Obsidian theme variables so the plugin adapts to light/dark and + custom themes. Each card exposes an optional --habits-accent override. */ + +.habits-dashboard:where(.tg-habits-surface, .tg-habits-surface *) { + --habits-accent: var(--interactive-accent); + position: relative; + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); + padding: 0.75rem; + background: var(--background-secondary); +} + +.habits-header:where(.tg-habits-surface, .tg-habits-surface *) { + display: grid; + grid-template-columns: 1fr auto 1fr; + align-items: center; + gap: 0.5rem; + margin-bottom: 0.75rem; +} + +.habits-date-nav:where(.tg-habits-surface, .tg-habits-surface *) { + grid-column: 2; + justify-self: center; +} + +.habits-header-left:where(.tg-habits-surface, .tg-habits-surface *) { + grid-column: 1; + justify-self: start; +} + +.habits-header-right:where(.tg-habits-surface, .tg-habits-surface *) { + grid-column: 3; + justify-self: end; +} + +.habits-stats-tabs:where(.tg-habits-surface, .tg-habits-surface *) { + grid-column: 2; + justify-self: center; + display: flex; + gap: 0.25rem; +} + +.habits-date-nav:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.5rem; +} + +.habits-date-display:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; + display: inline-flex; +} + +.habits-dashboard .habits-date-label:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + justify-content: center; + padding: 0.25rem 0.6rem; + font-weight: var(--font-semibold); + color: var(--text-normal); + background: transparent; + border: none; + border-radius: var(--radius-s); + cursor: pointer; + box-shadow: none; +} + +.habits-dashboard .habits-date-label:hover:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--background-modifier-hover); +} + +.habits-dashboard .habits-date-input:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + left: 0; + bottom: 0; + width: 1px; + height: 1px; + margin: 0; + padding: 0; + border: 0; + opacity: 0; + pointer-events: none; +} + +.habits-icon-button:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 0.25rem; + padding: 0.35rem; + border-radius: var(--radius-s); + background: transparent; + color: var(--text-normal); + cursor: pointer; + box-shadow: none; +} + +.habits-icon-button:hover:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--background-modifier-hover); +} + +.habits-empty:where(.tg-habits-surface, .tg-habits-surface *) { + text-align: center; + padding: 1.5rem 0.5rem; + color: var(--text-muted); +} + +/* Vertical slack (padding + negative margin) so hovered cards can lift + and cast a shadow without being clipped by the carousel. */ +.habits-carousel-viewport:where(.tg-habits-surface, .tg-habits-surface *) { + overflow: hidden; + padding: 8px 0; + margin: -8px 0; +} + +.habits-carousel-track:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + transform: translateX(var(--habits-translate, 0)); + transition: transform 0.25s ease; +} + +/* Grid and vertical-scroll layouts: rows of cards instead of a paged + track, gathered into one or more sections (one per group when + grouping is on). The slack padding + negative margin mirror the + carousel viewport so hovered cards can lift without being clipped. */ +.habits-grid-wrap:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 0.75rem; + padding: 8px 4px; + margin: -8px -4px; +} + +.habits-grid:where(.tg-habits-surface, .tg-habits-surface *) { + display: grid; + grid-template-columns: repeat(var(--habits-per-row, 4), minmax(0, 1fr)); + gap: 0.6rem; +} + +/* The vertical variant caps its height (set from JS at about a row and + a half, so a partial row peeks out below as the "there is more" cue) + and scrolls the cards inside the widget. Wheel and touch-drag both + work natively; `overscroll-behavior` keeps the note from scrolling + along once the cards run out, and proximity snapping settles rows + cleanly after a flick without fighting free scrolling. */ +.habits-grid-wrap.is-vertical:where(.tg-habits-surface, .tg-habits-surface *) { + /* The fallback cap keeps vertical mode scrollable even before the + exact height (1.55 card heights) has been measured. */ + max-height: var(--habits-vertical-max, min(60vh, 480px)); + overflow-y: auto; + overflow-x: hidden; + overscroll-behavior: contain; + scroll-snap-type: y proximity; + -webkit-overflow-scrolling: touch; +} + +.habits-grid-wrap.is-vertical .habits-card:where(.tg-habits-surface, .tg-habits-surface *) { + scroll-snap-align: start; + scroll-margin-top: 8px; +} + +/* Section headers shown when grouping is on: a small muted label, with + a colour swatch in colour mode. */ +.habits-group-header:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.4rem; + margin-bottom: -0.35rem; + font-size: var(--font-ui-small); + font-weight: 600; + color: var(--text-muted); +} + +.habits-group-swatch:where(.tg-habits-surface, .tg-habits-surface *) { + width: 10px; + height: 10px; + border-radius: 3px; + flex-shrink: 0; + background: var(--habits-accent); +} + +.habits-group-swatch.is-none:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--background-modifier-border); +} + +.habits-group-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + color: var(--habits-accent, var(--text-muted)); + flex-shrink: 0; +} + +.habits-group-icon svg:where(.tg-habits-surface, .tg-habits-surface *) { + width: 14px; + height: 14px; +} + +/* Lip along the top edge of a card naming its group, tinted with the + group colour when one is set. Sits flush against the card edges by + cancelling the card's padding. */ +.habits-card-group-lip:where(.tg-habits-surface, .tg-habits-surface *) { + align-self: stretch; + display: flex; + align-items: center; + justify-content: center; + gap: 0.3rem; + margin: -1.1rem -0.65rem 0; + padding: 0.3rem 0.6rem; + border-radius: var(--radius-m) var(--radius-m) 0 0; + background: color-mix( + in srgb, + var(--habits-group-color, var(--habits-accent, var(--text-muted))) + 14%, + transparent + ); + color: var(--text-muted); + font-size: var(--font-ui-smaller); + font-weight: 600; + min-width: 0; +} + +.habits-card-group-lip .habits-card-group-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + color: var(--habits-group-color, var(--habits-accent, var(--text-muted))); + flex-shrink: 0; +} + +.habits-card-group-lip .habits-card-group-icon svg:where(.tg-habits-surface, .tg-habits-surface *) { + width: 13px; + height: 13px; +} + +.habits-card-group-name:where(.tg-habits-surface, .tg-habits-surface *) { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +/* Group lip on stats rows: the card lip re-margined to sit flush with + the stats row's own padding. */ +.habits-stats-group-lip:where(.tg-habits-surface, .tg-habits-surface *) { + margin: -0.7rem -0.8rem 0; +} + +/* Vertical layout: the stats list caps its height and scrolls in + place — shorter than the dashboard's cap, so the stats block stays + compact inside a note. */ +.habits-stats-list.is-scrollable:where(.tg-habits-surface, .tg-habits-surface *) { + max-height: min(45vh, 340px); + overflow-y: auto; + overflow-x: hidden; + overscroll-behavior: contain; + padding-right: 4px; +} + +/* Groups manager modal: one dashed container per group, habits as + draggable chips. The container under the pointer highlights while a + chip is being dragged. */ +.habits-groups-hint:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + font-size: var(--font-ui-small); + margin: 0 0 0.5rem; +} + +.habits-groups-board:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 0.6rem; + margin-top: 0.75rem; +} + +.habits-groups-section:where(.tg-habits-surface, .tg-habits-surface *) { + border: 1px dashed var(--background-modifier-border); + border-radius: var(--radius-m); + padding: 0.6rem; +} + +.habits-groups-section.is-drop-target:where(.tg-habits-surface, .tg-habits-surface *) { + border-color: var(--interactive-accent); + background: color-mix( + in srgb, + var(--interactive-accent) 8%, + transparent + ); +} + +.habits-groups-actions:where(.tg-habits-surface, .tg-habits-surface *) { + margin-left: auto; + display: flex; + gap: 2px; +} + +.habits-groups-actions .habits-icon-button.is-active:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--interactive-accent); +} + +/* Inline group style editor (colour + icon) inside a section. */ +.habits-groups-style:where(.tg-habits-surface, .tg-habits-surface *) { + margin-top: 0.4rem; + border-top: 1px solid var(--background-modifier-border); +} + +.habits-groups-style .setting-item:where(.tg-habits-surface, .tg-habits-surface *) { + border: none; + padding: 0.45rem 0; +} + +.habits-groups-chips:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-wrap: wrap; + gap: 0.4rem; + margin-top: 0.45rem; +} + +.habits-groups-chip:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + gap: 0.35rem; + padding: 0.25rem 0.6rem; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-left: 3px solid + var(--habits-accent, var(--background-modifier-border)); + border-radius: var(--radius-s); + cursor: grab; + touch-action: none; + -webkit-user-select: none; + user-select: none; +} + +.habits-groups-chip.is-dragging:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0.6; + cursor: grabbing; +} + +.habits-groups-chip-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; +} + +.habits-groups-empty:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-faint); + font-size: var(--font-ui-smaller); +} + +.habits-panel-group:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.4rem; + margin: 0.6rem 0 0.15rem; + font-size: var(--font-ui-smaller); + font-weight: 600; + color: var(--text-muted); +} + +.habits-panel-group:first-child:where(.tg-habits-surface, .tg-habits-surface *) { + margin-top: 0; +} + +/* Manual sort order editor in settings: one slim draggable row per + habit, mirroring the card's accent stripe and icon. `touch-action: + none` lets pointer events drive the drag on touchscreens too. */ +.habits-order-setting:where(.tg-habits-surface, .tg-habits-surface *) { + display: block; +} + +.habits-order-list:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 4px; + margin-top: 0.75rem; +} + +.habits-order-row:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 6px 10px; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-left: 3px solid + var(--habits-accent, var(--background-modifier-border)); + border-radius: var(--radius-s); + cursor: grab; + touch-action: none; + -webkit-user-select: none; + user-select: none; +} + +.habits-order-row.is-dragging:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0.85; + cursor: grabbing; + box-shadow: var(--shadow-s); + z-index: 2; + position: relative; +} + +.habits-order-grip:where(.tg-habits-surface, .tg-habits-surface *), +.habits-order-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + color: var(--text-muted); +} + +.habits-order-name:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.habits-card:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; + overflow: hidden; + min-width: 0; + perspective: 1000px; + -webkit-user-select: none; + user-select: none; + -webkit-touch-callout: none; + flex: 0 0 calc(100% / var(--habits-per-view, 1)); + box-sizing: border-box; + display: flex; + flex-direction: column; + align-items: center; + gap: 0.85rem; + padding: 1.1rem 0.65rem; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-left: 3px solid var(--habits-accent); + border-radius: var(--radius-m); + box-shadow: var(--shadow-s); +} + +/* Comment flip: the card body lives in a 3D inner wrapper with a front + and back face; the lip along the bottom edge flips between them. */ + +.habits-card-inner:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; + width: 100%; + flex: 1 1 auto; + transform-style: preserve-3d; + transition: transform 0.45s cubic-bezier(0.4, 0.2, 0.2, 1); +} + +.habits-card.is-flipped .habits-card-inner:where(.tg-habits-surface, .tg-habits-surface *) { + transform: rotateY(180deg); +} + +.habits-card-front:where(.tg-habits-surface, .tg-habits-surface *), +.habits-card-back:where(.tg-habits-surface, .tg-habits-surface *) { + -webkit-backface-visibility: hidden; + backface-visibility: hidden; +} + +.habits-card-front:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + align-items: center; + gap: 0.85rem; +} + +.habits-card-back:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + inset: 0; + display: flex; + flex-direction: column; + gap: 0.4rem; + transform: rotateY(180deg); +} + +.habits-card-back-title:where(.tg-habits-surface, .tg-habits-surface *) { + text-align: center; + font-size: var(--font-ui-smaller); + font-weight: var(--font-semibold); + color: var(--text-muted); +} + +/* Holds the two faces of the comment area: the rendered read view and + the textarea that replaces it while editing. */ +.habits-comment-stage:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; + flex: 1; + min-height: 0; + display: flex; +} + +.habits-card .habits-comment-input:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1; + width: 100%; + min-height: 0; + resize: none; + padding: 0.4rem 0.5rem; + font-size: var(--font-ui-small); + font-family: inherit; + color: var(--text-normal); + background: var(--background-modifier-form-field); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-s); + -webkit-user-select: text; + user-select: text; +} + +/* Only one face is shown at a time. */ +.habits-comment-stage:not(.is-editing) .habits-comment-input:where(.tg-habits-surface, .tg-habits-surface *), +.habits-comment-stage.is-editing .habits-comment-read:where(.tg-habits-surface, .tg-habits-surface *) { + display: none; +} + +.habits-comment-read:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1; + min-height: 0; + overflow-y: auto; + padding: 0.4rem 0.5rem; + font-size: var(--font-ui-small); + line-height: 1.45; + white-space: pre-wrap; + overflow-wrap: anywhere; + color: var(--text-normal); + background: var(--background-modifier-form-field); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-s); + cursor: text; + -webkit-user-select: text; + user-select: text; +} + +.habits-comment-read:focus-visible:where(.tg-habits-surface, .tg-habits-surface *) { + outline: 2px solid var(--background-modifier-border-focus); + outline-offset: -2px; +} + +/* Placeholder styling when the day has no comment yet. */ +.habits-comment-read.is-empty:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-faint); + font-style: italic; +} + +/* Tags render as compact accent-tinted chips. */ +.habits-comment-read a.habits-comment-tag:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline; + padding: 0.05em 0.35em; + margin: 0 0.05em; + font-size: 0.85em; + font-weight: var(--font-medium); + line-height: 1.4; + text-decoration: none; + color: var(--habits-accent); + background: color-mix(in srgb, var(--habits-accent) 14%, transparent); + border-radius: var(--radius-s); + cursor: pointer; +} + +.habits-comment-read a.habits-comment-tag:hover:where(.tg-habits-surface, .tg-habits-surface *) { + background: color-mix(in srgb, var(--habits-accent) 26%, transparent); +} + +.habits-comment-read a.habits-comment-link:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--link-color); + text-decoration: none; + cursor: pointer; +} + +.habits-comment-read a.habits-comment-link:hover:where(.tg-habits-surface, .tg-habits-surface *) { + text-decoration: underline; +} + +/* Links whose target note does not exist yet, matching Obsidian. */ +.habits-comment-read a.habits-comment-link.is-unresolved:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--link-unresolved-color, var(--text-accent)); + opacity: var(--link-unresolved-opacity, 0.7); +} + +/* Autocomplete popup for # and [[ inside the comment textarea. It is + appended to the body so the card's 3D transform cannot clip it. */ +.habits-comment-suggest:where(.tg-habits-surface, .tg-habits-surface *) { + position: fixed; + z-index: var(--layer-menu); + top: var(--habits-suggest-top); + left: var(--habits-suggest-left); + width: var(--habits-suggest-width); + max-height: 15rem; + overflow-y: auto; + padding: 0.25rem; + background: var(--background-secondary); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); + box-shadow: var(--shadow-s); +} + +.habits-comment-suggest-item:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 0.3rem 0.45rem; + border-radius: var(--radius-s); + cursor: pointer; +} + +.habits-comment-suggest-item.is-selected:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--background-modifier-hover); +} + +.habits-comment-suggest-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + flex: 0 0 auto; + color: var(--text-muted); +} + +.habits-comment-suggest-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.9rem; + height: 0.9rem; +} + +.habits-comment-suggest-body:where(.tg-habits-surface, .tg-habits-surface *) { + min-width: 0; +} + +.habits-comment-suggest-title:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: var(--font-ui-small); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.habits-comment-suggest-detail:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: var(--font-ui-smaller); + color: var(--text-faint); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +/* The comment lip along the bottom edge of the card. */ +.habits-dashboard button.habits-card-lip:where(.tg-habits-surface, .tg-habits-surface *) { + width: 100%; + margin-top: auto; + display: flex; + align-items: center; + justify-content: center; + padding: 0.2rem 0; + background: transparent; + border: none; + border-top: 1px solid var(--background-modifier-border); + border-radius: 0; + box-shadow: none; + color: var(--text-faint); + cursor: pointer; +} + +.habits-dashboard button.habits-card-lip:hover:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--habits-accent); + background: var(--background-modifier-hover); +} + +/* Days with a comment: accent-tinted, lightly filled speech bubble. */ +.habits-dashboard button.habits-card-lip.has-comment:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--habits-accent); +} + +.habits-dashboard button.habits-card-lip.has-comment .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + fill: color-mix(in srgb, var(--habits-accent) 30%, transparent); +} + +.habits-card-lip-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; +} + +.habits-card-lip-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.95rem; + height: 0.95rem; +} + +/* Hover: a gentle lift with a deeper shadow and an accent-tinted border. + Departing cards are excluded so the exit animation owns the transform. */ +.habits-card:not(.is-departing):where(.tg-habits-surface, .tg-habits-surface *) { + transition: + transform 0.18s ease, + box-shadow 0.18s ease, + border-color 0.18s ease; +} + +/* Only lift on devices with a real pointer, so the effect can't get + "stuck" after a tap on touchscreens. */ +@media (hover: hover) { + .habits-card:not(.is-departing):hover:where(.tg-habits-surface, .tg-habits-surface *) { + transform: translateY(-3px) scale(1.015); + box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22); + border-color: var(--habits-accent); + z-index: 2; + } +} + +.habits-card-title:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + justify-content: center; + gap: 0.3rem; + width: 100%; + min-width: 0; + font-size: calc(var(--font-ui-medium) + 2px); + font-weight: var(--font-semibold); + text-align: center; +} + +.habits-card-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + color: var(--habits-accent); +} + +/* The card name is a button that opens the habit's note. Names stay on + a single line and ellipsize when the card runs out of room; the + tooltip always shows the full name. */ +.habits-dashboard button.habits-card-name:where(.tg-habits-surface, .tg-habits-surface *) { + max-width: 100%; + min-width: 0; + padding: 0; + font-size: inherit; + font-weight: inherit; + line-height: 1.3; + color: var(--text-normal); + background: transparent; + border: none; + border-radius: var(--radius-s); + cursor: pointer; + box-shadow: none; + white-space: normal; + text-align: center; +} + +.habits-card-name-text:where(.tg-habits-surface, .tg-habits-surface *) { + display: block; + max-width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.habits-dashboard button.habits-card-name:hover:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--habits-accent); + text-decoration: underline; +} + +/* "Every Monday" / "Monthly · day 15" caption on weekly and monthly cards. */ +.habits-card-frequency:where(.tg-habits-surface, .tg-habits-surface *) { + width: 100%; + margin-top: 0.15rem; + color: var(--text-muted); + font-size: var(--font-ui-small); + font-weight: var(--font-normal); + text-align: center; +} + +.habits-card-body:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + align-items: center; + gap: 0.75rem; +} + +.habits-binary-toggle:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + align-items: center; + gap: 0.35rem; + padding: 1rem 1.5rem; + border-radius: var(--radius-m); + background: var(--background-primary); + color: var(--text-muted); + cursor: pointer; +} + +.habits-binary-toggle.is-done:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--habits-accent); + color: var(--text-on-accent); +} + +.habits-binary-label:where(.tg-habits-surface, .tg-habits-surface *) { + font-weight: var(--font-semibold); +} + +.habits-readout:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: baseline; + gap: 0.35rem; +} + +.habits-dashboard button.habits-value:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0 0.15rem; + font-size: 1.8rem; + font-weight: var(--font-bold); + line-height: 1; + color: var(--habits-accent); + background: transparent; + border: none; + border-radius: var(--radius-s); + cursor: pointer; + box-shadow: none; +} + +.habits-dashboard button.habits-value:hover:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--background-modifier-hover); +} + +.habits-dashboard .habits-value-input:where(.tg-habits-surface, .tg-habits-surface *) { + width: 4rem; + padding: 0 0.25rem; + font-size: 1.8rem; + font-weight: var(--font-bold); + line-height: 1; + text-align: center; + color: var(--habits-accent); + background: var(--background-modifier-form-field); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-s); +} + +.habits-target:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); +} + +.habits-progress:where(.tg-habits-surface, .tg-habits-surface *) { + width: 100%; + height: 0.4rem; + border-radius: var(--radius-s); + background: var(--background-modifier-border); + overflow: hidden; +} + +.habits-progress-fill:where(.tg-habits-surface, .tg-habits-surface *) { + width: var(--habits-progress, 0%); + height: 100%; + background: var(--habits-accent); + transition: width 0.2s ease; +} + +.habits-progress.is-complete .habits-progress-fill:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--color-green, var(--habits-accent)); +} + +/* A big, read-only derived number — a note habit's char/checklist count, + or a flexible habit's running total for the period. */ +.habits-readout-value:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0 0.15rem; + font-size: 1.8rem; + font-weight: var(--font-bold); + line-height: 1; + color: var(--habits-accent); + font-variant-numeric: tabular-nums; +} + +.habits-note-action:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.4rem; + padding: 0.5rem 1.25rem; + border-radius: var(--radius-m); + background: var(--interactive-accent); + color: var(--text-on-accent); + font-weight: var(--font-semibold); + border: none; + cursor: pointer; +} + +.habits-note-action:hover:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--interactive-accent-hover); +} + +.habits-counter-buttons:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 1.5rem; +} + +.habits-counter-buttons .habits-icon-button:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.5rem; + border: 1px solid var(--background-modifier-border); +} + +/* Timed habits show +1/+5/+10 chips: spread them across the card. */ +.habits-counter-buttons.is-compact:where(.tg-habits-surface, .tg-habits-surface *) { + width: 100%; + gap: 0.4rem; + justify-content: center; +} + +.habits-counter-buttons.is-compact .habits-icon-button:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1 1 0; + min-width: 0; + max-width: 4.5rem; + padding: 0.45rem 0.3rem; +} + +.habits-dashboard .habits-step-button:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.45rem 0.55rem; + font-size: var(--font-ui-small); + font-weight: var(--font-semibold); + font-variant-numeric: tabular-nums; + line-height: 1; +} + +.habits-carousel-controls:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + justify-content: center; + gap: 0.75rem; + margin-top: 0.75rem; +} + +.habits-dots:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.35rem; +} + +.habits-dot:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.5rem; + height: 0.5rem; + padding: 0; + border-radius: 50%; + background: var(--background-modifier-border); + cursor: pointer; + box-shadow: none; +} + +.habits-dot.is-active:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--habits-accent); +} + +/* Completion animation: a green circle-check swooshes in with a springy + spin while a ring pulses outward behind it, then the card is re-queued to + the end of the carousel. Colour comes from the theme palette. */ + +.habits-complete-overlay:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + inset: 0; + z-index: 1; + display: flex; + align-items: center; + justify-content: center; + background: var(--background-primary); + border-radius: inherit; + opacity: 1; + transition: opacity 0.2s ease; + animation: habits-complete-fade-in 0.15s ease-out; +} + +.habits-complete-overlay.is-leaving:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0; +} + +.habits-complete-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + color: var(--color-green, var(--text-success)); + animation: habits-complete-swoosh 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; +} + +.habits-complete-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 3rem; + height: 3rem; +} + +/* Soft ring that pulses outward just as the check lands. */ +.habits-complete-ring:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + inset: 0; + margin: auto; + width: 3.4rem; + height: 3.4rem; + border-radius: 50%; + border: 2px solid var(--color-green, var(--text-success)); + opacity: 0; + animation: habits-complete-ring 0.6s ease-out 0.3s forwards; +} + +@keyframes habits-complete-fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +@keyframes habits-complete-swoosh { + 0% { + transform: rotate(-180deg) scale(0.2); + opacity: 0; + } + 50% { + opacity: 1; + } + 100% { + transform: rotate(0deg) scale(1); + opacity: 1; + } +} + +@keyframes habits-complete-ring { + 0% { + transform: scale(0.8); + opacity: 0.65; + } + 100% { + transform: scale(2); + opacity: 0; + } +} + +/* Departure: the completed card swooshes off to the right and its slot + collapses, so the rest of the queue slides in to close the gap. + + The slot collapsing to zero width reflows the card's own contents into + a very tall, very narrow column. Both the carousel track and the grid + stretch their items to the tallest one, so without the height clamp + below that momentary column drags every sibling card taller for the + length of the animation. The card is already fully transparent by the + time the collapse starts (opacity finishes at 0.25s, which is exactly + when flex-basis begins), so its height is pinned to zero at that same + moment — invisible, and no longer able to set the row's height. */ +.habits-card.is-departing:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0; + transform: translateX(45%) scale(0.9); + flex-basis: 0; + max-height: 0; + padding-left: 0; + padding-right: 0; + border-left-width: 0; + border-right-width: 0; + transition: + opacity 0.25s ease-in, + transform 0.3s ease-in, + flex-basis 0.3s ease-in-out 0.25s, + padding 0.3s ease-in-out 0.25s, + border-width 0.3s ease-in-out 0.25s, + max-height 0s linear 0.25s; +} + +/* Perfect day: glow, confetti and "Perfect!" spanning the dashboard when + every habit for the selected day is complete. Pointer-transparent. */ + +.habits-perfect-overlay:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + inset: 0; + z-index: 10; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; + pointer-events: none; + border-radius: var(--radius-m); + opacity: 1; + transition: opacity 0.25s ease; +} + +.habits-perfect-overlay.is-leaving:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0; +} + +.habits-perfect-glow:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + inset: 0; + background: radial-gradient( + ellipse at center, + color-mix( + in srgb, + var(--color-green, var(--interactive-accent)) 22%, + transparent + ), + transparent 70% + ); + animation: habits-perfect-glow 1.85s ease-out forwards; +} + +@keyframes habits-perfect-glow { + 0% { + opacity: 0; + } + 25% { + opacity: 1; + } + 100% { + opacity: 0.5; + } +} + +.habits-perfect-text:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; + font-size: clamp(2rem, 8vw, 3.2rem); + font-weight: 800; + letter-spacing: 0.02em; + line-height: 1; + background: linear-gradient( + 120deg, + var(--color-green, var(--text-success)), + var(--interactive-accent) + ); + -webkit-background-clip: text; + background-clip: text; + -webkit-text-fill-color: transparent; + animation: habits-perfect-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; +} + +@keyframes habits-perfect-pop { + 0% { + transform: scale(0.3) rotate(-6deg); + opacity: 0; + } + 60% { + opacity: 1; + } + 100% { + transform: scale(1) rotate(0deg); + opacity: 1; + } +} + +.habits-perfect-confetti:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + inset: 0; + display: flex; + align-items: center; + justify-content: center; +} + +.habits-perfect-piece:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + width: 7px; + height: 11px; + border-radius: 1px; + background: var(--hc-color, var(--interactive-accent)); + opacity: 0; + animation: habits-perfect-confetti 1.4s ease-out var(--hc-delay, 0ms) + forwards; +} + +@keyframes habits-perfect-confetti { + 0% { + transform: translate(0, 0) rotate(0deg); + opacity: 1; + } + 30% { + transform: translate(calc(var(--hc-x) * 0.5), var(--hc-my)) + rotate(calc(var(--hc-r) * 0.5)); + opacity: 1; + } + 100% { + transform: translate(var(--hc-x), var(--hc-y)) + rotate(var(--hc-r)); + opacity: 0; + } +} + +/* New-habit modal: live preview and icon picker */ + +.habits-modal-preview:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.75rem; + padding: 0.75rem 0; + margin-bottom: 0.25rem; + border-bottom: 1px solid var(--background-modifier-border); +} + +.habits-modal-preview-icon:where(.tg-habits-surface, .tg-habits-surface *) { + --habits-accent: var(--interactive-accent); + display: flex; + align-items: center; + justify-content: center; + width: 3rem; + height: 3rem; + border-radius: 50%; + color: var(--text-on-accent); + background: var(--habits-accent); + flex: 0 0 auto; +} + +.habits-modal-preview-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 1.6rem; + height: 1.6rem; +} + +.habits-modal-preview-name:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: var(--font-ui-large); + font-weight: var(--font-semibold); + color: var(--text-normal); +} + +.habits-button-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + margin-right: 0.4rem; + vertical-align: middle; +} + +.habits-button-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 1em; + height: 1em; +} + +.habits-icon-suggestion:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.6rem; +} + +.habits-icon-suggestion-glyph:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + color: var(--text-muted); +} + +.habits-icon-suggestion-glyph .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 1.1rem; + height: 1.1rem; +} + +/* Theme colour swatches */ + +.habits-swatches:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-wrap: wrap; + gap: 0.35rem; + margin-right: 0.5rem; +} + +.habits-swatches button.habits-swatch:where(.tg-habits-surface, .tg-habits-surface *) { + width: 1.5rem; + height: 1.5rem; + min-width: 0; + padding: 0; + border-radius: 50%; + background-color: var(--habits-swatch); + background-image: none; + border: 2px solid transparent; + cursor: pointer; + box-shadow: none; +} + +.habits-swatches button.habits-swatch:hover:where(.tg-habits-surface, .tg-habits-surface *) { + border-color: var(--background-modifier-border-hover); +} + +.habits-swatches button.habits-swatch.is-selected:where(.tg-habits-surface, .tg-habits-surface *) { + border-color: var(--text-normal); +} + +/* Emoji icons */ + +.habits-modal-preview-icon:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: 1.5rem; + line-height: 1; +} + +.habits-card-icon:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: 1.1rem; + line-height: 1; +} + +.habits-emoji-suggestion:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.6rem; +} + +.habits-emoji-suggestion-glyph:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: 1.2rem; + line-height: 1; +} + +/* Carousel arrow disabled state and position counter */ + +.habits-carousel-prev.is-disabled:where(.tg-habits-surface, .tg-habits-surface *), +.habits-carousel-next.is-disabled:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0.3; + pointer-events: none; +} + +.habits-carousel-count:where(.tg-habits-surface, .tg-habits-surface *) { + min-width: 3rem; + text-align: center; + color: var(--text-muted); + font-size: var(--font-ui-small); +} + +/* Stats view */ + +.habits-dashboard .habits-stats-tab:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.25rem 0.7rem; + font-weight: var(--font-semibold); + color: var(--text-muted); + background: transparent; + border: none; + border-radius: var(--radius-s); + cursor: pointer; + box-shadow: none; +} + +.habits-dashboard .habits-stats-tab.is-active:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-on-accent); + background: var(--interactive-accent); +} + +.habits-stats-range:where(.tg-habits-surface, .tg-habits-surface *) { + margin-bottom: 0.75rem; + text-align: center; + color: var(--text-muted); + font-size: var(--font-ui-small); +} + +/* From/to pickers on the custom stats tab. */ +.habits-custom-range:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + justify-content: center; + gap: 0.4rem; +} + +.habits-dashboard input.habits-custom-date:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: var(--font-ui-small); + padding: 0.15rem 0.45rem; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-s); + color: var(--text-normal); +} + +.habits-custom-range-sep:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); +} + +.habits-stats-summary:where(.tg-habits-surface, .tg-habits-surface *) { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr)); + gap: 0.5rem; + margin-bottom: 0.85rem; +} + +.habits-stat-tile:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + align-items: center; + gap: 0.15rem; + padding: 0.6rem 0.3rem; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); +} + +.habits-stat-value:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: 1.4rem; + font-weight: var(--font-bold); + color: var(--interactive-accent); + line-height: 1; +} + +.habits-stat-label:where(.tg-habits-surface, .tg-habits-surface *) { + text-align: center; + color: var(--text-muted); + font-size: var(--font-ui-smaller); +} + +.habits-ai-summary:where(.tg-habits-surface, .tg-habits-surface *) { + margin-bottom: 0.85rem; + padding: 0.7rem 0.8rem; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); +} + +.habits-ai-summary-header:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.5rem; + margin-bottom: 0.4rem; +} + +.habits-ai-summary-title:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + gap: 0.35rem; + font-weight: var(--font-semibold); + font-size: var(--font-ui-small); +} + +.habits-ai-summary-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + color: var(--interactive-accent); +} + +.habits-ai-summary-icon svg:where(.tg-habits-surface, .tg-habits-surface *) { + width: 1em; + height: 1em; +} + +.habits-ai-summary-button:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: var(--font-ui-smaller); + padding: 0.25rem 0.7rem; + border-radius: var(--radius-s); + cursor: pointer; +} + +.habits-ai-summary-button:disabled:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0.6; + cursor: default; +} + +.habits-ai-summary-body p:where(.tg-habits-surface, .tg-habits-surface *) { + margin: 0 0 0.5rem; + font-size: var(--font-ui-small); + line-height: 1.45; +} + +.habits-ai-summary-body p:last-child:where(.tg-habits-surface, .tg-habits-surface *) { + margin-bottom: 0; +} + +.habits-ai-summary-body.is-muted p:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); +} + +.habits-ai-summary.is-loading .habits-ai-summary-body p:where(.tg-habits-surface, .tg-habits-surface *) { + animation: habits-ai-pulse 1.2s ease-in-out infinite; +} + +@keyframes habits-ai-pulse { + 0%, + 100% { + opacity: 1; + } + 50% { + opacity: 0.45; + } +} + +.habits-stats-list:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 0.6rem; +} + +/* Stats carousel: pages of habit rows sliding horizontally. */ +.habits-stats-carousel-viewport:where(.tg-habits-surface, .tg-habits-surface *) { + overflow: hidden; +} + +.habits-stats-carousel-track:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: flex-start; + transform: translateX(var(--habits-stats-translate, 0%)); + transition: transform 0.3s ease; +} + +.habits-stats-page:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 0 0 100%; + min-width: 0; +} + +.habits-stats-carousel-controls:where(.tg-habits-surface, .tg-habits-surface *) { + margin-top: 0.6rem; +} + +.habits-stats-row:where(.tg-habits-surface, .tg-habits-surface *) { + --habits-accent: var(--interactive-accent); + display: flex; + flex-direction: column; + gap: 0.45rem; + padding: 0.7rem 0.8rem; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-left: 3px solid var(--habits-accent); + border-radius: var(--radius-m); +} + +.habits-stats-row-top:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.5rem; +} + +.habits-stats-name:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.4rem; + font-weight: var(--font-semibold); +} + +.habits-stats-streak:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + gap: 0.2rem; + font-weight: var(--font-semibold); + white-space: nowrap; +} + +/* Lucide flame used for streaks, tinted with the habit's accent. */ +.habits-stats-flame:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + vertical-align: text-bottom; + color: var(--habits-accent); +} + +.habits-stats-flame .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 1em; + height: 1em; +} + +.habits-stats-heatmap:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-wrap: wrap; + gap: 3px; +} + +.habits-stats-cell:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.85rem; + height: 0.85rem; + border-radius: 3px; + background: var(--background-modifier-border); +} + +.habits-stats-cell.is-partial:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--habits-accent); + opacity: 0.45; +} + +.habits-stats-cell.is-complete:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--habits-accent); +} + +.habits-stats-meta:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + font-size: var(--font-ui-small); +} + +/* Stats range toggle (rolling vs calendar) */ + +.habits-range-toggle:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + justify-content: center; + gap: 0.25rem; + margin-bottom: 0.75rem; + padding: 0.2rem; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); +} + +.habits-dashboard .habits-range-btn:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1; + max-width: 12rem; + padding: 0.3rem 0.6rem; + font-size: var(--font-ui-small); + font-weight: var(--font-semibold); + color: var(--text-muted); + background: transparent; + border: none; + border-radius: var(--radius-s); + cursor: pointer; + box-shadow: none; +} + +.habits-dashboard .habits-range-btn.is-active:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-normal); + background: var(--background-modifier-hover); +} + +.habits-stats-cell.is-future:where(.tg-habits-surface, .tg-habits-surface *) { + background: transparent; + border: 1px dashed var(--background-modifier-border); +} + +.habits-stats-cell.is-paused:where(.tg-habits-surface, .tg-habits-surface *) { + background: transparent; + border: 1px solid var(--background-modifier-border); + opacity: 0.6; +} + +/* Days a weekly/monthly habit is not due: faint, so due days stand out. */ +.habits-stats-cell.is-notdue:where(.tg-habits-surface, .tg-habits-surface *) { + background: transparent; + opacity: 0.25; +} + +.habits-stats-cell.is-prestart:where(.tg-habits-surface, .tg-habits-surface *) { + background: transparent; + border: 1px dotted var(--background-modifier-border); + opacity: 0.35; +} + +.habits-stats-cell.is-start:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + justify-content: center; +} + +/* Filled play icon marking the first tracked day. Accent-coloured on + neutral cells; flipped to the on-accent text colour when the cell + itself is filled with the accent (start day already complete). */ +.habits-stats-cell.is-start svg:where(.tg-habits-surface, .tg-habits-surface *) { + width: 72%; + height: 72%; + color: var(--habits-accent); + fill: currentcolor; +} + +.habits-stats-cell.is-start.is-complete svg:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-on-accent); +} + +/* A partial start cell would fade the icon along with the whole-cell + opacity; keep the icon solid and fade only the background instead. */ +.habits-stats-cell.is-start.is-partial:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 1; + background: color-mix(in srgb, var(--habits-accent) 45%, transparent); +} + +.habits-stats-cell.is-start.is-partial svg:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-on-accent); +} + +/* Stats per-habit goal progress */ + +.habits-goal-bar:where(.tg-habits-surface, .tg-habits-surface *) { + width: 100%; + height: 0.4rem; + margin-top: 0.15rem; + border-radius: var(--radius-s); + background: var(--background-modifier-border); + overflow: hidden; +} + +.habits-goal-fill:where(.tg-habits-surface, .tg-habits-surface *) { + width: var(--habits-progress, 0%); + height: 100%; + background: var(--habits-accent); + transition: width 0.2s ease; +} + +.habits-goal-bar.is-complete .habits-goal-fill:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--color-green, var(--habits-accent)); +} + +.habits-stats-goal-label:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + font-size: var(--font-ui-smaller); +} + +/* Collapsible targets section in the habit modal */ + +.habits-targets:where(.tg-habits-surface, .tg-habits-surface *) { + margin: 0.25rem 0 0.5rem; + padding: 0.4rem 0.6rem; + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); + background: var(--background-secondary); +} + +.habits-targets-summary:where(.tg-habits-surface, .tg-habits-surface *) { + cursor: pointer; + font-weight: var(--font-semibold); + color: var(--text-normal); + list-style: none; + display: flex; + align-items: center; + gap: 0.4rem; + padding: 0.15rem 0; +} + +.habits-targets-summary:where(.tg-habits-surface, .tg-habits-surface *)::-webkit-details-marker { + display: none; +} + +.habits-targets-summary:where(.tg-habits-surface, .tg-habits-surface *)::before { + content: "▸"; + color: var(--text-muted); + transition: transform 0.15s ease; +} + +.habits-targets[open] .habits-targets-summary:where(.tg-habits-surface, .tg-habits-surface *)::before { + transform: rotate(90deg); +} + +.habits-targets-intro:where(.tg-habits-surface, .tg-habits-surface *) { + margin: 0.25rem 0 0.5rem; + color: var(--text-muted); + font-size: var(--font-ui-small); +} + +/* Missed-habits review modal (experimental rescheduling) */ + +.habits-missed-intro:where(.tg-habits-surface, .tg-habits-surface *) { + margin: 0.25rem 0 0.5rem; + color: var(--text-muted); + font-size: var(--font-ui-small); +} + +.habits-missed-empty:where(.tg-habits-surface, .tg-habits-surface *) { + margin: 0.5rem 0 0; + color: var(--text-muted); +} + +.habits-missed-error:where(.tg-habits-surface, .tg-habits-surface *) { + min-height: 1.2em; + margin: 0.25rem 0; + color: var(--color-red, var(--text-error)); + font-size: var(--font-ui-small); +} + +.habits-missed-list:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 0.4rem; + max-height: 60vh; + overflow-y: auto; +} + +.habits-missed-card:where(.tg-habits-surface, .tg-habits-surface *) { + --habits-accent: var(--interactive-accent); + display: flex; + align-items: center; + gap: 0.6rem; + padding: 0.5rem 0.6rem; + border: 1px solid var(--background-modifier-border); + border-left: 3px solid var(--habits-accent); + border-radius: var(--radius-m); + background: var(--background-primary); +} + +.habits-missed-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + justify-content: center; + width: 1.6rem; + height: 1.6rem; + flex-shrink: 0; + color: var(--habits-accent); +} + +.habits-missed-info:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + min-width: 0; + flex: 1; +} + +.habits-missed-name:where(.tg-habits-surface, .tg-habits-surface *) { + font-weight: var(--font-semibold); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.habits-missed-date:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + font-size: var(--font-ui-small); +} + +.habits-missed-reschedule:where(.tg-habits-surface, .tg-habits-surface *) { + flex-shrink: 0; + padding: 0.3rem 0.7rem; + font-size: var(--font-ui-small); + font-weight: var(--font-semibold); +} + +/* Dashboard/panel: notification button and rescheduled-card indicators */ + +/* Same size and shape as the other header icon buttons (habits-header-left/ + -right) — .habits-icon-button already supplies that; this just anchors it + to the corner and adds the pulse. */ +.habits-missed-button:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + right: 0.75rem; + bottom: 0.75rem; + z-index: 2; + animation: habits-missed-pulse 2.2s ease-in-out infinite; +} + +.habits-missed-badge:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + top: -0.3rem; + right: -0.3rem; + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 1.1rem; + height: 1.1rem; + padding: 0 0.25rem; + border-radius: 1rem; + background: var(--color-red, var(--text-error)); + color: var(--text-on-accent); + font-size: 0.65rem; + font-weight: var(--font-semibold); + line-height: 1; +} + +@keyframes habits-missed-pulse { + 0%, + 100% { + box-shadow: 0 0 0 0 rgba(var(--color-red-rgb, 224, 93, 93), 0.4); + } + 50% { + box-shadow: 0 0 0 6px rgba(var(--color-red-rgb, 224, 93, 93), 0); + } +} + +.habits-panel-missed:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; +} + +.habits-card-rescheduled:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.3rem; + margin-top: 0.1rem; + color: var(--text-muted); + font-size: var(--font-ui-smaller); +} + +.habits-card-rescheduled-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; +} + +.habits-card-rescheduled-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.85em; + height: 0.85em; +} + +.habits-panel-rescheduled:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + color: var(--text-muted); + flex-shrink: 0; +} + +.habits-panel-rescheduled .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.85em; + height: 0.85em; +} + +/* Trim the last setting's bottom border inside the section */ +.habits-targets .setting-item:last-child:where(.tg-habits-surface, .tg-habits-surface *) { + border-bottom: none; + padding-bottom: 0; +} + +/* Mobile: tighter cards and controls, stacked export modal. */ +@media (max-width: 768px) { + .habits-dashboard:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.5rem; + } + + .habits-card:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.75rem 0.6rem; + gap: 0.6rem; + } + + /* Match the tighter card padding so the lip stays flush. */ + .habits-card-group-lip:where(.tg-habits-surface, .tg-habits-surface *) { + margin: -0.75rem -0.6rem 0; + } + + .habits-card-title:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: var(--font-ui-medium); + } + + .habits-dashboard button.habits-value:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: 1.5rem; + } + + .habits-dashboard .habits-value-input:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: 1.5rem; + width: 3.4rem; + } + + .habits-counter-buttons:where(.tg-habits-surface, .tg-habits-surface *) { + gap: 0.75rem; + } + + .habits-counter-buttons.is-compact:where(.tg-habits-surface, .tg-habits-surface *) { + flex-wrap: wrap; + gap: 0.3rem; + } + + .habits-counter-buttons.is-compact .habits-icon-button:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.35rem 0.25rem; + } + + .habits-binary-toggle:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.75rem 1.1rem; + } + + .habits-stats-cell:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.7rem; + height: 0.7rem; + } + + .habits-export-body:where(.tg-habits-surface, .tg-habits-surface *) { + flex-direction: column; + max-height: none; + } + + .habits-export-controls:where(.tg-habits-surface, .tg-habits-surface *) { + flex: none; + width: 100%; + max-height: none; + padding-right: 0; + } + + .habits-export-preview:where(.tg-habits-surface, .tg-habits-surface *) { + width: 100%; + max-height: 50vh; + } +} + +/* Habit metrics (rendered by the habit-metrics code block) */ + +.habits-metrics:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 0.85rem; + padding: 0.75rem; + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); + background: var(--background-secondary); +} + +.habits-metrics-empty:where(.tg-habits-surface, .tg-habits-surface *) { + margin: 0; + text-align: center; + color: var(--text-muted); +} + +.habits-metrics-section:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 0.4rem; +} + +.habits-metrics-title:where(.tg-habits-surface, .tg-habits-surface *) { + font-weight: var(--font-semibold); + font-size: var(--font-ui-small); + color: var(--text-muted); +} + +.habits-metrics-canvas:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; + height: var(--habits-metrics-height, 220px); +} + +/* Comparison view: a habit-metrics block listing several habits */ + +.habits-metrics-range:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.5rem 0.75rem; +} + +.habits-metrics-range .habits-metrics-tabs:where(.tg-habits-surface, .tg-habits-surface *) { + flex-wrap: wrap; + margin-bottom: 0; +} + +.habits-metrics-range-label:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + font-size: var(--font-ui-small); +} + +.habits-metrics input.habits-custom-date:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: var(--font-ui-small); + padding: 0.15rem 0.45rem; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-s); + color: var(--text-normal); +} + +.habits-metrics-compare:where(.tg-habits-surface, .tg-habits-surface *) { + overflow-x: auto; +} + +.habits-metrics-compare-table:where(.tg-habits-surface, .tg-habits-surface *) { + width: 100%; + border-collapse: collapse; + font-size: var(--font-ui-small); +} + +.habits-metrics-compare-table th:where(.tg-habits-surface, .tg-habits-surface *), +.habits-metrics-compare-table td:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.35rem 0.5rem; + text-align: right; + border-bottom: 1px solid var(--background-modifier-border); + font-variant-numeric: tabular-nums; +} + +.habits-metrics-compare-table th:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + font-weight: var(--font-semibold); +} + +.habits-metrics-compare-table th:first-child:where(.tg-habits-surface, .tg-habits-surface *), +.habits-metrics-compare-table td:first-child:where(.tg-habits-surface, .tg-habits-surface *) { + text-align: left; +} + +.habits-metrics-compare-table tr:last-child td:where(.tg-habits-surface, .tg-habits-surface *) { + border-bottom: none; +} + +.habits-metrics-compare-swatch:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-block; + width: 0.7rem; + height: 0.7rem; + margin-right: 0.45rem; + border-radius: 50%; + background: var(--habits-compare-color); + vertical-align: middle; +} + +.habits-metrics-compare-badge:where(.tg-habits-surface, .tg-habits-surface *) { + margin-left: 0.45rem; + padding: 0 0.35rem; + border-radius: var(--radius-s); + background: var(--background-modifier-hover); + color: var(--text-muted); + font-size: var(--font-ui-smaller); +} + +/* Charts/Heatmap tab bar in a habit-metrics block */ + +.habits-metrics-tabs:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + gap: 0.25rem; + width: fit-content; + margin-bottom: 0.75rem; + padding: 0.2rem; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); +} + +.habits-metrics-tab:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.3rem 0.75rem; + font-size: var(--font-ui-small); + font-weight: var(--font-semibold); + color: var(--text-muted); + background: transparent; + border: none; + border-radius: var(--radius-s); + cursor: pointer; + box-shadow: none; +} + +.habits-metrics-tab.is-active:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-normal); + background: var(--background-modifier-hover); +} + +/* Paused and stopped habit states */ + +.habits-card.is-paused:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0.75; + border-left-style: dashed; +} + +.habits-paused-badge:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.4rem; + padding: 0.5rem 1rem; + border-radius: var(--radius-m); + background: var(--background-modifier-hover); + color: var(--text-muted); + font-weight: var(--font-semibold); +} + +.habits-paused-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; +} + +/* Overlay icon shown while a freshly paused card departs the queue. */ +.habits-paused-overlay-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + color: var(--text-muted); + animation: habits-complete-swoosh 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; +} + +.habits-paused-overlay-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 3rem; + height: 3rem; +} + +.habits-paused-note:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-faint); + font-size: var(--font-ui-smaller); + text-align: center; +} + +.habits-metrics-banner:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.6rem; + padding: 0.5rem 0.75rem; + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); + background: var(--background-primary); + color: var(--text-muted); +} + +.habits-metrics-banner-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; +} + +.habits-metrics-banner-text:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1; + font-size: var(--font-ui-small); +} + +/* Sidebar quick-log panel */ + +.habits-panel:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 0.5rem; + padding: 0.5rem; +} + +.habits-panel-header:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.5rem; +} + +.habits-panel-title:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1; + display: flex; + align-items: baseline; + gap: 0.4rem; + min-width: 0; + font-weight: var(--font-semibold); +} + +.habits-panel-date:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + font-size: var(--font-ui-smaller); + font-weight: var(--font-normal); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.habits-panel-count:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.1rem 0.5rem; + border-radius: 1rem; + background: var(--background-modifier-hover); + color: var(--text-muted); + font-size: var(--font-ui-smaller); + font-weight: var(--font-semibold); + white-space: nowrap; +} + +.habits-panel-count.is-all-done:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--color-green, var(--text-success)); + color: var(--text-on-accent); +} + +.habits-panel-empty:where(.tg-habits-surface, .tg-habits-surface *) { + text-align: center; + padding: 1rem 0.5rem; + color: var(--text-muted); +} + +.habits-panel-list:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 0.35rem; +} + +.habits-panel-row:where(.tg-habits-surface, .tg-habits-surface *) { + --habits-accent: var(--interactive-accent); + position: relative; + overflow: hidden; + -webkit-user-select: none; + user-select: none; + -webkit-touch-callout: none; + display: flex; + flex-direction: column; + gap: 0.3rem; + padding: 0.4rem 0.55rem; + background: var(--background-primary); + border: 1px solid var(--background-modifier-border); + border-left: 2px solid var(--habits-accent); + border-radius: var(--radius-s); +} + +.habits-panel-row.is-done:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0.75; +} + +.habits-panel-row.is-paused:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0.6; + border-left-style: dashed; +} + +.habits-panel-row-main:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.4rem; + min-width: 0; +} + +.habits-panel-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + flex: 0 0 auto; + color: var(--habits-accent); + font-size: 1rem; + line-height: 1; +} + +.habits-panel-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 1rem; + height: 1rem; +} + +.habits-panel .habits-panel-name:where(.tg-habits-surface, .tg-habits-surface *) { + display: block; + flex: 1 1 auto; + min-width: 0; + width: auto; + margin: 0; + padding: 0; + justify-content: flex-start; + text-align: left; + font-size: var(--font-ui-small); + font-weight: var(--font-semibold); + color: var(--text-normal); + background: transparent; + border: none; + box-shadow: none; + cursor: pointer; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.habits-panel .habits-panel-name:hover:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--habits-accent); + text-decoration: underline; +} + +.habits-panel-time:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 0 0 auto; + color: var(--text-muted); + font-size: var(--font-ui-smaller); + font-variant-numeric: tabular-nums; + white-space: nowrap; +} + +.habits-panel .habits-panel-value:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 0 0 auto; + margin: 0; + padding: 0 0.15rem; + background: transparent; + border: none; + border-radius: var(--radius-s); + box-shadow: none; + cursor: pointer; + color: var(--text-muted); + font-size: var(--font-ui-smaller); + font-variant-numeric: tabular-nums; + white-space: nowrap; +} + +.habits-panel .habits-panel-value:hover:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-normal); + background: var(--background-modifier-hover); +} + +.habits-panel .habits-panel-value-input:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 0 0 auto; + width: 3rem; + padding: 0 0.2rem; + font-size: var(--font-ui-smaller); + text-align: center; + color: var(--text-normal); + background: var(--background-modifier-form-field); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-s); +} + +/* Note and flexible habits: the readout is machine-derived (a note's + char/checklist count, or a flexible habit's period total), so it is + plain text rather than the click-to-edit button other types use. */ +.habits-panel .habits-panel-readout-value:where(.tg-habits-surface, .tg-habits-surface *) { + cursor: default; +} + +.habits-panel .habits-panel-readout-value:hover:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + background: transparent; +} + +.habits-panel .habits-panel-mini:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 0 0 auto; + padding: 0.2rem; + border: 1px solid var(--background-modifier-border); +} + +.habits-panel .habits-panel-mini .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.85rem; + height: 0.85rem; +} + +.habits-panel .habits-panel-step:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.2rem 0.3rem; + font-size: var(--font-ui-smaller); + font-weight: var(--font-semibold); + font-variant-numeric: tabular-nums; + line-height: 1; +} + +.habits-panel .habits-panel-toggle:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 0 0 auto; + display: inline-flex; + align-items: center; + justify-content: center; + padding: 0.25rem; + border-radius: 50%; + background: transparent; + color: var(--text-muted); + cursor: pointer; + box-shadow: none; +} + +.habits-panel .habits-panel-toggle:hover:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--background-modifier-hover); +} + +.habits-panel-row.is-done .habits-panel-toggle:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--color-green, var(--text-success)); +} + +.habits-panel-progress:where(.tg-habits-surface, .tg-habits-surface *) { + width: 100%; + height: 3px; + border-radius: var(--radius-s); + background: var(--background-modifier-border); + overflow: hidden; +} + +.habits-panel-progress-fill:where(.tg-habits-surface, .tg-habits-surface *) { + width: var(--habits-progress, 0%); + height: 100%; + background: var(--habits-accent); + transition: width 0.2s ease; +} + +.habits-panel-progress.is-complete .habits-panel-progress-fill:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--color-green, var(--habits-accent)); +} + +/* Brief celebration when a row is completed from the panel. */ +.habits-panel-flash:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + inset: 0; + display: flex; + align-items: center; + justify-content: center; + background: var(--background-primary); + border-radius: inherit; + animation: habits-complete-fade-in 0.15s ease-out; +} + +.habits-panel-flash-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + color: var(--color-green, var(--text-success)); + animation: habits-complete-swoosh 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; +} + +.habits-panel-flash-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 1.4rem; + height: 1.4rem; +} + +/* Export modal: options left, live A4 preview right. */ + +.modal.habits-export-modal:where(.tg-habits-surface, .tg-habits-surface *) { + width: 1020px; + max-width: 96vw; +} + +.habits-export-body:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + gap: 1rem; + align-items: flex-start; + max-height: 80vh; +} + +.habits-export-controls:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 0 0 320px; + max-height: 80vh; + overflow-y: auto; + padding-right: 0.5rem; +} + +.habits-export-controls .setting-item:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.45rem 0; + border-top: none; +} + +.habits-export-hidden:where(.tg-habits-surface, .tg-habits-surface *) { + display: none; +} + +.habits-export-preview:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1; + max-height: 80vh; + overflow-y: auto; + overflow-x: hidden; + padding: 0.75rem; + background: var(--background-secondary-alt, var(--background-secondary)); + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-m); +} + +.habits-export-pages:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + align-items: center; + gap: 0.75rem; +} + +.habits-export-empty:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + padding: 1.5rem; + text-align: center; +} + +/* Scaled wrapper: reserves the on-screen footprint of the scaled page. */ +.habits-export-page-outer:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; + flex: 0 0 auto; + width: var(--hx-outer-w); + height: var(--hx-outer-h); + overflow: hidden; +} + +.habits-export-page-outer.is-zoomable:where(.tg-habits-surface, .tg-habits-surface *) { + cursor: zoom-in; +} + +/* Magnifying-glass badge shown while hovering a preview page. */ +.habits-export-zoom-hint:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + top: 6px; + right: 6px; + z-index: 2; + display: flex; + align-items: center; + justify-content: center; + width: 26px; + height: 26px; + border-radius: 50%; + background: rgba(0, 0, 0, 0.55); + color: #ffffff; + opacity: 0; + transition: opacity 0.15s ease; + pointer-events: none; +} + +.habits-export-zoom-hint .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 14px; + height: 14px; +} + +.habits-export-page-outer.is-zoomable:hover .habits-export-zoom-hint:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 1; +} + +/* Full-size lightbox overlaying the whole window. */ +.habits-export-lightbox:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + inset: 0; + z-index: 100; + display: flex; + flex-direction: column; + align-items: center; + overflow-y: auto; + padding: 1.5rem; + background: rgba(0, 0, 0, 0.7); + cursor: zoom-out; +} + +.habits-export-lightbox-pages:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + align-items: center; + gap: 1rem; + margin: auto; +} + +.habits-export-lightbox-close:where(.tg-habits-surface, .tg-habits-surface *) { + position: sticky; + top: 0; + z-index: 2; + align-self: flex-end; + display: flex; + align-items: center; + justify-content: center; + width: 2rem; + height: 2rem; + padding: 0; + border-radius: 50%; + background: rgba(0, 0, 0, 0.6); + color: #ffffff; + border: 1px solid rgba(255, 255, 255, 0.25); + cursor: pointer; + box-shadow: none; +} + +/* The preview page is always paper-white regardless of theme. */ +.habits-export-page:where(.tg-habits-surface, .tg-habits-surface *) { + transform: scale(var(--hx-scale, 1)); + transform-origin: top left; +} + +.habits-export-page:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; + flex: 0 0 auto; + box-sizing: border-box; + overflow: hidden; + width: var(--hx-page-w); + height: var(--hx-page-h); + padding: var(--hx-page-pad); + background: #ffffff; + color: #222222; + box-shadow: var(--shadow-s); + border-radius: 2px; +} + +.habits-export-block:where(.tg-habits-surface, .tg-habits-surface *) { + height: var(--hx-block-h); + margin-bottom: var(--hx-block-gap); +} + +.habits-export-text:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: var(--hx-font); +} + +.habits-export-page-number:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute; + bottom: 4px; + left: 0; + right: 0; + text-align: center; + font-size: 6px; + color: #6e6e6e; +} + +.habits-export-block:where(.tg-habits-surface, .tg-habits-surface *) { + overflow: hidden; +} + +.habits-export-title:where(.tg-habits-surface, .tg-habits-surface *) { + font-weight: 700; + color: #222222; + line-height: 1.3; +} + +.habits-export-subtitle:where(.tg-habits-surface, .tg-habits-surface *) { + color: #6e6e6e; + line-height: 1.4; +} + +.habits-export-summary:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + gap: 9px; +} + +.habits-export-tile:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 2px; + background: #f6f6f6; + border: 1px solid #cdcdcd; + border-radius: 3px; +} + +.habits-export-tile-value:where(.tg-habits-surface, .tg-habits-surface *) { + font-weight: 700; + color: #222222; + line-height: 1; +} + +.habits-export-tile-label:where(.tg-habits-surface, .tg-habits-surface *) { + color: #6e6e6e; + line-height: 1; +} + +.habits-export-section:where(.tg-habits-surface, .tg-habits-surface *) { + font-weight: 700; + color: #222222; + margin-bottom: 2px; +} + +.habits-export-chart:where(.tg-habits-surface, .tg-habits-surface *) { + display: block; + width: 100%; + height: auto; +} + +.habits-export-habit:where(.tg-habits-surface, .tg-habits-surface *) { + border-left: 3px solid var(--hx-accent, #888888); + padding-left: 8px; +} + +.habits-export-habit-name:where(.tg-habits-surface, .tg-habits-surface *) { + font-weight: 700; + color: #222222; + line-height: 1.4; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.habits-export-habit-meta:where(.tg-habits-surface, .tg-habits-surface *) { + color: #6e6e6e; + line-height: 1.4; + margin-bottom: 3px; +} + +.habits-export-grid:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-wrap: wrap; + gap: var(--hx-cell-gap, 2px); +} + +.habits-export-cell:where(.tg-habits-surface, .tg-habits-surface *) { + box-sizing: border-box; + width: var(--hx-cell, 8px); + height: var(--hx-cell, 8px); + background: var(--hx-fill, #ffffff); + border: 1px solid var(--hx-border, transparent); + border-radius: 1px; +} + +.habits-export-goal:where(.tg-habits-surface, .tg-habits-surface *) { + color: #6e6e6e; + margin-top: 3px; +} + +.habits-export-comment:where(.tg-habits-surface, .tg-habits-surface *) { + height: var(--hx-line-h, 10px); + line-height: var(--hx-line-h, 10px); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: #555555; +} + +/* == Limit habits (experimental) ================================== */ + +/* Clean / Slipped boxes on binary limit-habit cards. The two boxes act + like radio buttons; Clean is highlighted by default because an + unlogged day already counts as clean. */ +.habits-limit-boxes:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + /* If both labels don't fit side by side, the boxes stack vertically + instead of truncating or breaking the text. */ + flex-wrap: wrap; + gap: 6px; + width: 100%; +} + +.habits-limit-box:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1 1 0; + /* Never smaller than the label, so the text always shows in full. */ + min-width: fit-content; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 3px; + /* Obsidian buttons have a fixed height (--input-height); this box + stacks an icon over a label, so it must size to its content. */ + height: auto; + min-height: 0; + padding: 8px 4px; + border-radius: 8px; + border: 1px solid var(--background-modifier-border); + background: var(--background-secondary); + color: var(--text-muted); + cursor: pointer; + box-sizing: border-box; + box-shadow: none; + line-height: 1.2; + transition: + background-color 0.15s ease, + border-color 0.15s ease, + color 0.15s ease; +} + +.habits-limit-box-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + justify-content: center; +} + +.habits-limit-box-icon svg:where(.tg-habits-surface, .tg-habits-surface *) { + width: 16px; + height: 16px; +} + +.habits-limit-box-label:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: var(--font-ui-smaller); + line-height: 1.2; + text-align: center; + white-space: nowrap; +} + +.habits-limit-box.habits-limit-clean.is-active:where(.tg-habits-surface, .tg-habits-surface *) { + border-color: var(--color-green, var(--text-success)); + background: rgba(var(--color-green-rgb, 76, 175, 80), 0.12); + color: var(--color-green, var(--text-success)); +} + +.habits-limit-box.habits-limit-slipped.is-active:where(.tg-habits-surface, .tg-habits-surface *) { + border-color: var(--color-red, var(--text-error)); + background: rgba(var(--color-red-rgb, 224, 93, 93), 0.12); + color: var(--color-red, var(--text-error)); +} + +/* Counter/timed limit habits: the bar turns red once over the limit. */ +.habits-progress.is-over .habits-progress-fill:where(.tg-habits-surface, .tg-habits-surface *), +.habits-panel-progress.is-over .habits-panel-progress-fill:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--color-red, var(--text-error)); +} + +/* Stats heatmap: a day over the limit. */ +.habits-stats-cell.is-over:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--color-red, var(--text-error)); + opacity: 0.75; +} + +/* Panel row for a slipped/over-limit day: tint the toggle red. */ +.habits-panel-row.is-slipped .habits-panel-slip-toggle:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--color-red, var(--text-error)); +} + +/* Note shown at the top of the experimental settings section. */ +.habits-experimental-note:where(.tg-habits-surface, .tg-habits-surface *) { + margin: 0 0 12px; + color: var(--text-muted); + font-size: var(--font-ui-small); +} + +.habits-advanced-note:where(.tg-habits-surface, .tg-habits-surface *) { + margin: 0 0 12px; + color: var(--text-muted); + font-size: var(--font-ui-small); +} + +/* Hand-rolled top tab bar for the settings tab (General/Experimental/ + Advanced) — Obsidian has no native tab component. */ +.habits-settings-tabs:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + gap: 4px; + margin-bottom: 12px; + border-bottom: 1px solid var(--background-modifier-border); +} + +.habits-settings-tab:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 6px 14px; + background: transparent; + border: none; + border-bottom: 2px solid transparent; + border-radius: 0; + box-shadow: none; + color: var(--text-muted); + font-size: var(--font-ui-medium); + cursor: pointer; +} + +.habits-settings-tab:hover:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-normal); + background: transparent; +} + +.habits-settings-tab.is-active:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-normal); + border-bottom-color: var(--interactive-accent); + font-weight: var(--font-weight-bold, 600); +} + +/* Weekday pills (multi-day picker in the habit modal) */ + +.habits-weekday-picker:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-wrap: wrap; + gap: 0.35rem; +} + +.habits-weekday-picker button.habits-weekday-pill:where(.tg-habits-surface, .tg-habits-surface *) { + min-width: 2.6em; + padding: 0.25em 0.55em; + border-radius: var(--radius-l); + border: 1px solid var(--background-modifier-border); + background-color: var(--background-secondary); + background-image: none; + color: var(--text-muted); + font-size: var(--font-ui-small); + cursor: pointer; + box-shadow: none; +} + +.habits-weekday-picker button.habits-weekday-pill:hover:where(.tg-habits-surface, .tg-habits-surface *) { + border-color: var(--background-modifier-border-hover); + color: var(--text-normal); +} + +.habits-weekday-picker button.habits-weekday-pill.is-active:where(.tg-habits-surface, .tg-habits-surface *) { + background-color: var(--interactive-accent); + border-color: var(--interactive-accent); + color: var(--text-on-accent); +} + +/* Habits table (`habits-table` code block) */ + +.habits-table-block:where(.tg-habits-surface, .tg-habits-surface *) { + overflow-x: auto; +} + +table.habits-table:where(.tg-habits-surface, .tg-habits-surface *) { + width: 100%; + border-collapse: collapse; + font-size: var(--font-ui-small); + margin: 0; +} + +table.habits-table th:where(.tg-habits-surface, .tg-habits-surface *), +table.habits-table td:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.35em 0.6em; + border-bottom: 1px solid var(--background-modifier-border); + text-align: left; + white-space: nowrap; +} + +table.habits-table th:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + font-weight: var(--font-semibold); +} + +table.habits-table th.habits-table-count:where(.tg-habits-surface, .tg-habits-surface *), +table.habits-table td.habits-table-count:where(.tg-habits-surface, .tg-habits-surface *) { + text-align: right; + font-variant-numeric: tabular-nums; +} + +table.habits-table tr.habits-table-group td:where(.tg-habits-surface, .tg-habits-surface *) { + padding-top: 0.9em; + color: var(--text-muted); + font-size: var(--font-ui-smaller); + font-weight: var(--font-semibold); + text-transform: uppercase; + letter-spacing: 0.04em; + border-bottom: none; +} + +table.habits-table a.habits-table-link:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-normal); + text-decoration: none; + cursor: pointer; +} + +table.habits-table a.habits-table-link:hover:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-accent); + text-decoration: underline; +} + +table.habits-table .habits-table-paused:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + vertical-align: middle; + margin-left: 0.4em; + color: var(--text-muted); +} + +table.habits-table .habits-table-paused .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.85em; + height: 0.85em; +} + +table.habits-table .habits-table-rescheduled:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + vertical-align: middle; + margin-left: 0.4em; + color: var(--text-muted); +} + +table.habits-table .habits-table-rescheduled .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.85em; + height: 0.85em; +} + +table.habits-table td.habits-table-schedule:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); +} + +.habits-table-empty:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); + font-size: var(--font-ui-small); + padding: 0.5em 0; +} + +/* Habits table — the interactive Today column */ + +table.habits-table td.habits-table-today:where(.tg-habits-surface, .tg-habits-surface *) { + width: 1%; +} + +table.habits-table button.habits-table-toggle:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + gap: 0.35em; + padding: 0.25em 0.7em; + border-radius: var(--radius-m); + background: var(--background-modifier-hover); + color: var(--text-muted); + font-size: var(--font-ui-small); + font-weight: var(--font-semibold); + cursor: pointer; + box-shadow: none; + white-space: nowrap; +} + +table.habits-table button.habits-table-toggle:hover:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--background-modifier-active-hover); + color: var(--text-normal); +} + +table.habits-table button.habits-table-toggle.is-done:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--interactive-accent); + color: var(--text-on-accent); +} + +table.habits-table button.habits-table-toggle.habits-table-slip.is-done:where(.tg-habits-surface, .tg-habits-surface *) { + background: var(--background-modifier-error); + color: var(--text-on-accent); +} + +table.habits-table .habits-table-toggle-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; +} + +table.habits-table .habits-table-toggle-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.9em; + height: 0.9em; +} + +table.habits-table .habits-table-stepper:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + gap: 0.3em; +} + +table.habits-table .habits-table-value:where(.tg-habits-surface, .tg-habits-surface *) { + min-width: 3em; + text-align: center; + font-variant-numeric: tabular-nums; +} + +table.habits-table .habits-icon-button.habits-table-mini:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.15em; +} + +table.habits-table .habits-icon-button.habits-table-mini .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.85em; + height: 0.85em; +} + +table.habits-table .habits-table-notdue:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-faint); +} + +/* Planned-times picker (habit modal) */ + +.habits-time-picker:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 0.35rem; +} + +.habits-time-row:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.3rem; +} + +.habits-time-picker button.habits-time-add:where(.tg-habits-surface, .tg-habits-surface *) { + font-size: var(--font-ui-small); + padding: 0.2em 0.7em; + cursor: pointer; +} + +.habits-time-picker .habits-icon-button.habits-time-remove:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.15em; +} + +.habits-time-picker .habits-icon-button.habits-time-remove .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.85em; + height: 0.85em; +} + +/* Habits failed, skipped or snoozed for the day: a "N hidden" disclosure + under the dashboard's cards and the panel's rows, with Undo per habit. */ + +.habits-closed:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 0.35rem; + margin-top: 0.75rem; +} + +.habits-closed-toggle:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + gap: 0.3rem; + width: fit-content; + padding: 0.2rem 0.5rem; + font-size: var(--font-ui-small); + color: var(--text-muted); + background: transparent; + border: none; + box-shadow: none; + cursor: pointer; +} + +.habits-closed-toggle:hover:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-normal); + background: var(--background-modifier-hover); +} + +.habits-closed-chevron:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; +} + +.habits-closed-chevron .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.9em; + height: 0.9em; +} + +.habits-closed-list:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + flex-direction: column; + gap: 0.25rem; +} + +.habits-closed-row:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 0.3rem 0.5rem; + border: 1px solid var(--background-modifier-border); + border-radius: var(--radius-s); + background: var(--background-primary); + font-size: var(--font-ui-small); +} + +.habits-closed-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + color: var(--text-muted); +} + +.habits-closed-name:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 1; + min-width: 0; + overflow-wrap: anywhere; + color: var(--text-muted); +} + +.habits-closed-row.is-failed .habits-closed-name:where(.tg-habits-surface, .tg-habits-surface *) { + text-decoration: line-through; +} + +.habits-closed-status:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + gap: 0.25rem; + color: var(--text-faint); + white-space: nowrap; +} + +.habits-closed-row.is-failed .habits-closed-status:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--color-red, var(--text-error)); +} + +.habits-closed-status-icon:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; +} + +.habits-closed-status-icon .svg-icon:where(.tg-habits-surface, .tg-habits-surface *) { + width: 0.85em; + height: 0.85em; +} + +.habits-closed-undo:where(.tg-habits-surface, .tg-habits-surface *) { + padding: 0.1rem 0.5rem; + font-size: var(--font-ui-smaller); +} + +table.habits-table .habits-table-toggle.habits-table-closed:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--text-muted); +} + +table.habits-table .habits-table-toggle.habits-table-closed.is-failed:where(.tg-habits-surface, .tg-habits-surface *) { + color: var(--color-red, var(--text-error)); +} + +/* Compact embedded logger: one coloured row per habit. */ +.habits-compact:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; + border: 1px solid var(--background-modifier-border); + border-radius: 10px; + padding: 8px; + background: var(--background-primary); +} +.habits-compact-header:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + margin-bottom: 8px; +} +.habits-compact-nav:where(.tg-habits-surface, .tg-habits-surface *), .habits-compact-controls:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 8px; +} +.habits-compact-nav:where(.tg-habits-surface, .tg-habits-surface *) { + position: relative; + justify-content: center; + flex: 0 0 auto; +} +.habits-compact-nav > button:where(.tg-habits-surface, .tg-habits-surface *) { + flex: 0 0 auto; +} +.habits-compact-date:where(.tg-habits-surface, .tg-habits-surface *) { + display: inline-flex; + align-items: center; + justify-content: center; + font-weight: var(--font-semibold); + background: transparent; + box-shadow: none; + padding: 4px; +} +.habits-compact-date-input:where(.tg-habits-surface, .tg-habits-surface *) { + position: absolute !important; + left: 50%; + top: 24px; + width: 1px; + height: 1px; + min-width: 0; + min-height: 0; + max-width: 1px; + max-height: 1px; + margin: 0; + padding: 0; + border: 0; + opacity: 0; + pointer-events: none; +} +.habits-compact-list:where(.tg-habits-surface, .tg-habits-surface *) { display: flex; flex-direction: column; gap: 6px; } +.habits-compact-row:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + min-height: 46px; + padding: 5px 8px; + border: 1px solid var(--background-modifier-border); + border-left: 3px solid var(--habits-accent); + border-radius: 12px; + background: var(--background-secondary); + background: color-mix(in srgb, var(--habits-accent) 8%, var(--background-primary)); +} +/* Match the compact-card reference: completed habits recede but remain usable. */ +.habits-compact-row.is-done:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0.58; + filter: saturate(0.45); + border-left-color: var(--background-modifier-border); +} +.habits-compact-row.is-done:hover:where(.tg-habits-surface, .tg-habits-surface *), +.habits-compact-row.is-done:focus-within:where(.tg-habits-surface, .tg-habits-surface *) { + opacity: 0.78; +} +.habits-compact-name:where(.tg-habits-surface, .tg-habits-surface *) { + display: flex; + align-items: center; + gap: 6px; + min-width: 0; + color: var(--text-normal); + font-weight: var(--font-semibold); + text-decoration: none; +} +.habits-compact-name > span:last-child:where(.tg-habits-surface, .tg-habits-surface *) { overflow-wrap: anywhere; } +.habits-compact-icon:where(.tg-habits-surface, .tg-habits-surface *) { display: inline-flex; color: var(--habits-accent); flex-shrink: 0; } +.habits-compact-controls:where(.tg-habits-surface, .tg-habits-surface *) { flex-shrink: 0; color: var(--text-muted); } +.habits-compact-value:where(.tg-habits-surface, .tg-habits-surface *) { font-variant-numeric: tabular-nums; } +.habits-compact-current:where(.tg-habits-surface, .tg-habits-surface *) { color: var(--habits-accent); font-weight: var(--font-semibold); } +.habits-compact .habits-compact-button:where(.tg-habits-surface, .tg-habits-surface *) { width: 32px; height: 32px; padding: 5px; } +.habits-compact .habits-compact-toggle:where(.tg-habits-surface, .tg-habits-surface *) { border-radius: 50%; } +.habits-compact-row.is-done .habits-compact-toggle:where(.tg-habits-surface, .tg-habits-surface *) { color: var(--habits-accent); } +.habits-compact-group:where(.tg-habits-surface, .tg-habits-surface *) { color: var(--text-muted); font-weight: var(--font-semibold); } +.habits-compact-empty:where(.tg-habits-surface, .tg-habits-surface *) { padding: 16px; color: var(--text-muted); text-align: center; } +@media (max-width: 480px) { + .habits-compact-row:where(.tg-habits-surface, .tg-habits-surface *) { flex-wrap: wrap; gap: 6px; padding: 5px 8px; } + .habits-compact-controls:where(.tg-habits-surface, .tg-habits-surface *) { margin-left: auto; } + .habits-compact-value:where(.tg-habits-surface, .tg-habits-surface *) { font-size: var(--font-small); } +} diff --git a/src/integrations/habits/settings.ts b/src/integrations/habits/settings.ts new file mode 100644 index 000000000..a98633a21 --- /dev/null +++ b/src/integrations/habits/settings.ts @@ -0,0 +1,1282 @@ +import { App, Notice, PluginSettingTab, setIcon, Setting } from "obsidian"; +import { t } from "./i18n"; +import type HabitsPlugin from "./main"; +import type { GroupStyle, HabitSortMode } from "./types"; +import { habitAccent, sortHabits } from "./utils"; +import { applyHabitIcon } from "./ui/icon-suggest-modal"; +import { ConfirmModal } from "./ui/confirm-modal"; +import { GroupsModal } from "./ui/groups-modal"; +import { FolderSuggest } from "./ui/vault-suggest"; + +/** + * Feature flags for functionality that is still being tested. + * + * Every flag defaults to off. A flag only ever gates *entry points* (for + * example whether a creation option is offered) — never how existing data + * is interpreted — so turning a flag off can never corrupt or reinterpret + * anything the user created while it was on. Graduating a feature to + * fully-fledged means deleting its flag here and removing the UI guards. + */ +export interface ExperimentalFlags { + /** AI-generated summaries on the weekly and monthly stats tabs. */ + aiSummaries: boolean; + /** + * Note habits: a card backed by a per-day note, completed by reaching a + * character count or checking off every task in it, optionally created + * from a Templater template. + */ + noteHabits: boolean; + /** + * Reviewing and rescheduling missed habits onto a different day, from a + * notification button on the dashboard and sidebar panel. + */ + rescheduling: boolean; +} + +export const DEFAULT_EXPERIMENTAL: ExperimentalFlags = { + aiSummaries: false, + noteHabits: false, + rescheduling: false, +}; + +/** + * The frontmatter property name used for every field a habit note stores. + * Renaming one here only changes what the plugin reads and writes going + * forward — see {@link HabitStore.renameFrontmatterKeys} for moving a + * field's existing value onto its new key across a vault's habit notes. + * + * Defaults match the plugin's original, fixed key names, so an existing + * vault is unaffected until a user changes one in Settings → Advanced. Kept + * deliberately separate from `HabitDefinition`'s field names (in `types.ts`), + * which never change: only the on-disk key is configurable, not the + * in-memory shape the rest of the plugin works with. + * + * `weekday`/`time` each cover two on-disk encodings of the same concept — a + * scalar for a single value, or a `s` list for several — so only the + * singular form is configurable; the plural is always derived from it. + */ +export interface FrontmatterKeys { + type: string; + records: string; + frequency: string; + weekday: string; + monthDay: string; + intervalDays: string; + intervalMode: string; + time: string; + goalDirection: string; + target: string; + unit: string; + step: string; + weeklyTarget: string; + monthlyTarget: string; + weeklyPerfect: string; + monthlyPerfect: string; + startDate: string; + pauses: string; + reschedules: string; + failed: string; + skipped: string; + stopped: string; + stopDate: string; + icon: string; + color: string; + group: string; + useGroupColor: string; + noteFolder: string; + noteFilenameFormat: string; + templatePath: string; + noteCompletionMode: string; + noteChecklistRequirement: string; + noteChecklistMin: string; + noteFailKeyword: string; + /** Legacy: day comments, before they moved into the note body. */ + comments: string; +} + +export const DEFAULT_FRONTMATTER_KEYS: FrontmatterKeys = { + type: "type", + records: "records", + frequency: "frequency", + weekday: "weekday", + monthDay: "monthDay", + intervalDays: "intervalDays", + intervalMode: "intervalMode", + time: "time", + goalDirection: "goalDirection", + target: "target", + unit: "unit", + step: "step", + weeklyTarget: "weeklyTarget", + monthlyTarget: "monthlyTarget", + weeklyPerfect: "weeklyPerfect", + monthlyPerfect: "monthlyPerfect", + startDate: "startDate", + pauses: "pauses", + reschedules: "reschedules", + failed: "failed", + skipped: "skipped", + stopped: "stopped", + stopDate: "stopDate", + icon: "icon", + color: "color", + group: "group", + useGroupColor: "useGroupColor", + noteFolder: "noteFolder", + noteFilenameFormat: "noteFilenameFormat", + templatePath: "templatePath", + noteCompletionMode: "noteCompletionMode", + noteChecklistRequirement: "noteChecklistRequirement", + noteChecklistMin: "noteChecklistMin", + noteFailKeyword: "noteFailKeyword", + comments: "comments", +}; + +/** + * Connection details for the AI summaries feature. Any OpenAI-compatible + * chat-completions endpoint works, including local servers (Ollama, + * LM Studio), in which case the API key may be left blank. + */ +export interface AiSummarySettings { + /** Endpoint base URL, e.g. `https://api.openai.com/v1`. */ + baseUrl: string; + /** Bearer token for the endpoint. May be blank for local servers. */ + apiKey: string; + /** Model name to request, e.g. `gpt-4o-mini`. */ + model: string; +} + +export const DEFAULT_AI_SUMMARY: AiSummarySettings = { + baseUrl: "https://api.openai.com/v1", + apiKey: "", + model: "gpt-4o-mini", +}; + +/** + * Where and whether the plugin writes reminder checklist lines for the + * Reminder plugin to pick up. The lines live in a marked block, one per + * planned time of each habit due that day. + */ +export interface ReminderSettings { + /** Master switch; off by default. */ + enabled: boolean; + /** + * `daily-note` writes the block into today's daily note (following the + * core Daily notes plugin's folder and format, once the note exists); + * `fixed-note` keeps it in one dedicated note, created on demand. + */ + target: "daily-note" | "fixed-note"; + /** Vault path of the dedicated note when `target` is `fixed-note`. */ + notePath: string; +} + +export const DEFAULT_REMINDERS: ReminderSettings = { + enabled: false, + target: "daily-note", + notePath: "Habit reminders.md", +}; + +/** How the dashboard presents its habit cards. */ +export type DashboardLayout = "carousel" | "grid" | "vertical" | "compact"; + +/** User-configurable settings for the plugin. */ +export interface HabitsPluginSettings { + /** Folder that holds one note per habit. */ + habitsFolder: string; + /** + * How the dashboard shows its cards: a paged carousel, a grid that + * wraps onto new rows, a fixed-height vertically scrolling grid, + * or a compact list with one row per habit. + */ + dashboardLayout: DashboardLayout; + /** How many cards are visible at once in the carousel on wide screens. */ + cardsPerView: number; + /** The base order of habit cards. `name` is the original behaviour. */ + sortMode: HabitSortMode; + /** + * Note paths in the order the user arranged them in settings. Only + * consulted when `sortMode` is `manual`; habits missing from the list + * (created since it was arranged) go to the end. + */ + manualOrder: string[]; + /** + * When true (the original behaviour), completed habits drift to the + * end of the queue and paused ones park behind them. When false every + * card keeps its sorted position. + */ + statusOrdering: boolean; + /** + * Show habits in sections by their group, with a group lip on each + * card. Off by default. + */ + groupsEnabled: boolean; + /** + * Group the rows of `habits-table` blocks by habit group, with a + * heading row per group. When false the table is one flat list, + * ordered by planned time. On by default. + */ + tableGrouping: boolean; + /** Shared group styling (colour, icon), keyed by group name. */ + groups: Record; + /** + * Group names in the order their sections should appear. Groups + * missing from the list append alphabetically. + */ + groupOrder: string[]; + /** How many cards are visible at once on phone-sized screens (1–2). */ + mobileCardsPerView: number; + /** + * When a dashboard is embedded in a daily note (a note whose name + * contains a date), open it on that note's date instead of today. + */ + followDailyNoteDate: boolean; + /** + * Moment.js format used to read the date from a daily note's name, + * e.g. `YYYY-MM-DD` or `YYYYMMDD`. + */ + dailyNoteDateFormat: string; + /** Show the comment flap on dashboard cards. */ + enableComments: boolean; + /** + * Play the completion celebrations: the check swoosh and card + * departure, the perfect-day confetti, and the panel row flash. + * When off, logging updates the view instantly and quietly. + */ + animations: boolean; + /** + * How many habit rows each stats carousel page shows. Only applies + * while the layout is `carousel`; grid and vertical layouts show the + * stats as one flat list. + */ + statsRowsPerPage: number; + /** Opt-in switches for features that are still being tested. */ + experimental: ExperimentalFlags; + /** Connection details used when AI summaries are enabled. */ + aiSummary: AiSummarySettings; + /** Reminder-line generation for the Reminder plugin. */ + reminders: ReminderSettings; + /** + * Snoozed habits: habit note path → when the snooze ends (epoch ms). + * Kept here rather than in the habit note because a snooze is + * short-lived and never affects stats. Expired entries are pruned + * whenever a snooze is set or cleared. + */ + snoozes: Record; + /** + * Frontmatter property names, so a habit note's frontmatter can share a + * note with another plugin's own properties without colliding. + */ + frontmatterKeys: FrontmatterKeys; +} + +export const DEFAULT_SETTINGS: HabitsPluginSettings = { + habitsFolder: "Habits", + dashboardLayout: "carousel", + cardsPerView: 4, + sortMode: "name", + manualOrder: [], + statusOrdering: true, + groupsEnabled: false, + tableGrouping: true, + groups: {}, + groupOrder: [], + mobileCardsPerView: 2, + followDailyNoteDate: true, + dailyNoteDateFormat: "YYYY-MM-DD", + enableComments: true, + animations: true, + statsRowsPerPage: 4, + experimental: { ...DEFAULT_EXPERIMENTAL }, + aiSummary: { ...DEFAULT_AI_SUMMARY }, + reminders: { ...DEFAULT_REMINDERS }, + snoozes: {}, + frontmatterKeys: { ...DEFAULT_FRONTMATTER_KEYS }, +}; + +/** The three top-level tabs the settings UI is split into. */ +type SettingsTabId = "general" | "experimental" | "advanced"; + +/** Settings tab shown under Settings → Community plugins → Habits. */ +export class HabitsSettingTab extends PluginSettingTab { + private plugin: HabitsPlugin; + + constructor(app: App, plugin: HabitsPlugin) { + super(app, plugin); + this.plugin = plugin; + } + + /** + * The drag-to-reorder editor shown when sorting is manual: one slim + * row per habit that can be dragged (mouse or touch) into place. The + * arranged order is stored as note paths in `manualOrder`. + */ + private renderManualOrderEditor(setting: Setting): void { + setting.settingEl.addClass("habits-order-setting"); + const list = setting.settingEl.createDiv({ + cls: "habits-order-list", + }); + this.buildOrderList(list); + } + + private buildOrderList(list: HTMLElement): void { + list.empty(); + const habits = sortHabits( + this.plugin.store.getHabits().filter((habit) => !habit.stopped), + "manual", + this.plugin.settings.manualOrder, + this.plugin.settings.groups, + this.plugin.settings.groupOrder, + ); + for (const habit of habits) { + const row = list.createDiv({ cls: "habits-order-row" }); + row.dataset.path = habit.path; + const accent = habitAccent(habit, this.plugin.settings.groups); + if (accent) { + row.setCssProps({ "--habits-accent": accent }); + } + const grip = row.createSpan({ cls: "habits-order-grip" }); + setIcon(grip, "grip-vertical"); + if (habit.icon) { + const icon = row.createSpan({ cls: "habits-order-icon" }); + applyHabitIcon(icon, habit.icon); + } + row.createSpan({ cls: "habits-order-name", text: habit.name }); + this.registerRowDrag(row, list, ".habits-order-row", () => { + void this.persistOrder(list); + }); + } + } + + /** + * The drag-to-reorder editor for group sections, shown while groups + * are enabled. Stores the arranged names in `groupOrder`. + */ + private renderGroupOrderEditor(setting: Setting): void { + setting.settingEl.addClass("habits-order-setting"); + const list = setting.settingEl.createDiv({ + cls: "habits-order-list", + }); + this.buildGroupOrderList(list); + } + + /** Every known group: in use by a habit, styled, or already ordered. */ + private knownGroups(): string[] { + const names = new Set(); + for (const habit of this.plugin.store.getHabits()) { + const group = habit.group.trim(); + if (group && !habit.stopped) { + names.add(group); + } + } + for (const name of Object.keys(this.plugin.settings.groups)) { + names.add(name); + } + const position = new Map( + this.plugin.settings.groupOrder.map((name, index) => [ + name, + index, + ]), + ); + return Array.from(names).sort((a, b) => { + const pa = position.get(a) ?? Number.MAX_SAFE_INTEGER; + const pb = position.get(b) ?? Number.MAX_SAFE_INTEGER; + return pa - pb || a.localeCompare(b); + }); + } + + private buildGroupOrderList(list: HTMLElement): void { + list.empty(); + for (const name of this.knownGroups()) { + const row = list.createDiv({ cls: "habits-order-row" }); + row.dataset.group = name; + const style = this.plugin.settings.groups[name]; + if (style?.color) { + row.setCssProps({ "--habits-accent": style.color }); + } + const grip = row.createSpan({ cls: "habits-order-grip" }); + setIcon(grip, "grip-vertical"); + if (style?.icon) { + const icon = row.createSpan({ cls: "habits-order-icon" }); + applyHabitIcon(icon, style.icon); + } + row.createSpan({ cls: "habits-order-name", text: name }); + this.registerRowDrag(row, list, ".habits-order-row", () => { + void this.persistGroupOrder(list); + }); + } + } + + /** Store the DOM order of the rows as the new group order. */ + private async persistGroupOrder(list: HTMLElement): Promise { + const names: string[] = []; + for (const el of Array.from( + list.querySelectorAll(".habits-order-row"), + )) { + if (el.dataset.group) { + names.push(el.dataset.group); + } + } + this.plugin.settings.groupOrder = names; + await this.plugin.saveSettings(); + } + + /** + * Pointer-based dragging (rather than HTML5 drag events) so the rows + * can be rearranged by touch on mobile as well as by mouse. The move + * and release listeners sit on the window, not the row: reordering + * re-inserts the row into the list, which would clear any pointer + * capture on it and kill the drag mid-flight. + */ + private registerRowDrag( + row: HTMLElement, + list: HTMLElement, + selector: string, + onDrop: () => void, + ): void { + row.addEventListener("pointerdown", (evt: PointerEvent) => { + if (evt.button !== 0) { + return; + } + evt.preventDefault(); + row.addClass("is-dragging"); + const win = row.win; + + const onMove = (e: PointerEvent): void => { + const rows = Array.from( + list.querySelectorAll(selector), + ).filter((el) => el !== row); + const next = rows.find( + (el) => + e.clientY < + el.getBoundingClientRect().top + el.offsetHeight / 2, + ); + if (next) { + if (next !== row.nextElementSibling) { + list.insertBefore(row, next); + } + } else if (list.lastElementChild !== row) { + list.appendChild(row); + } + }; + const onUp = (): void => { + row.removeClass("is-dragging"); + win.removeEventListener("pointermove", onMove); + win.removeEventListener("pointerup", onUp); + win.removeEventListener("pointercancel", onUp); + onDrop(); + }; + win.addEventListener("pointermove", onMove); + win.addEventListener("pointerup", onUp); + win.addEventListener("pointercancel", onUp); + }); + } + + /** Store the DOM order of the rows as the new manual order. */ + private async persistOrder(list: HTMLElement): Promise { + const paths: string[] = []; + for (const el of Array.from( + list.querySelectorAll(".habits-order-row"), + )) { + if (el.dataset.path) { + paths.push(el.dataset.path); + } + } + this.plugin.settings.manualOrder = paths; + await this.plugin.saveSettings(); + } + + /** Which of the three tabs is currently shown. */ + private activeTab: SettingsTabId = "general"; + + /** + * Renders the settings tab as three persistent top tabs (General, + * Experimental, Advanced) rather than one long scrolling page. Obsidian + * has no built-in tab-bar control, so this is hand-rolled; that also + * means the plugin's settings are no longer indexed by Obsidian's own + * settings search (that only worked through the declarative + * getSettingDefinitions() API this tab used to implement, which cannot + * coexist with custom chrome drawn around its content). + */ + display(): void { + const { containerEl } = this; + containerEl.empty(); + + const tabBar = containerEl.createDiv({ cls: "habits-settings-tabs" }); + const content = containerEl.createDiv({ + cls: "habits-settings-tab-content", + }); + + const tabs: { + id: SettingsTabId; + label: string; + render: (el: HTMLElement) => void; + }[] = [ + { + id: "general", + label: t("General"), + render: (el) => this.displayGeneral(el), + }, + { + id: "experimental", + label: t("Experimental"), + render: (el) => this.displayExperimental(el), + }, + { + id: "advanced", + label: t("Advanced"), + render: (el) => this.displayAdvanced(el), + }, + ]; + + const selectTab = (id: SettingsTabId): void => { + this.activeTab = id; + buttons.forEach((button, i) => + button.toggleClass("is-active", tabs[i].id === id), + ); + content.empty(); + tabs.find((tab) => tab.id === id)?.render(content); + }; + + const buttons = tabs.map((tab) => { + const button = tabBar.createEl("button", { + cls: "habits-settings-tab", + text: tab.label, + }); + button.addEventListener("click", () => selectTab(tab.id)); + return button; + }); + + selectTab(this.activeTab); + } + + /** General settings: everything that isn't Experimental or Advanced. */ + private displayGeneral(containerEl: HTMLElement): void { + new Setting(containerEl) + .setName(t("Habits folder")) + .setDesc( + t( + "Folder where each habit is stored as its own note. It is created automatically if it does not exist.", + ), + ) + .addText((text) => { + text + .setPlaceholder("Habits") + .setValue(this.plugin.settings.habitsFolder) + .onChange(async (value) => { + this.plugin.settings.habitsFolder = + value.trim() || DEFAULT_SETTINGS.habitsFolder; + await this.plugin.saveSettings(); + }); + new FolderSuggest(this.app, text.inputEl); + }); + + new Setting(containerEl) + .setName(t("Follow daily note date")) + .setDesc( + t( + "When a dashboard is embedded in a daily note (a note whose name contains a date like 2026-07-01), open it on that note's date instead of today.", + ), + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.followDailyNoteDate) + .onChange(async (value) => { + this.plugin.settings.followDailyNoteDate = value; + await this.plugin.saveSettings(); + }), + ); + + new Setting(containerEl) + .setName(t("Daily note date format")) + .setDesc( + t( + "Moment.js format used to read the date from a daily note's name, such as YYYY-MM-DD or YYYYMMDD.", + ), + ) + .addText((text) => + text + .setPlaceholder("YYYY-MM-DD") + .setValue(this.plugin.settings.dailyNoteDateFormat) + .onChange(async (value) => { + this.plugin.settings.dailyNoteDateFormat = + value.trim() || DEFAULT_SETTINGS.dailyNoteDateFormat; + await this.plugin.saveSettings(); + }), + ); + + new Setting(containerEl) + .setName(t("Comments on cards")) + .setDesc( + t( + "Show a comment flap on dashboard cards for jotting a note about any day.", + ), + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.enableComments) + .onChange(async (value) => { + this.plugin.settings.enableComments = value; + await this.plugin.saveSettings(); + }), + ); + + new Setting(containerEl) + .setName(t("Completion animations")) + .setDesc( + t( + "Play the check swoosh, card departure, and perfect-day confetti when habits are completed. Turn off for instant, quiet updates.", + ), + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.animations) + .onChange(async (value) => { + this.plugin.settings.animations = value; + await this.plugin.saveSettings(); + }), + ); + + new Setting(containerEl).setName(t("Layout")).setHeading(); + + new Setting(containerEl) + .setName(t("Dashboard layout")) + .setDesc( + t( + "Choose a carousel, grid, vertical scroll, or compact list for your habits dashboard.", + ), + ) + .addDropdown((dropdown) => + dropdown + .addOption("carousel", t("Carousel")) + .addOption("grid", t("Grid")) + .addOption("vertical", t("Vertical scroll")) + .addOption("compact", t("Compact list")) + .setValue(this.plugin.settings.dashboardLayout) + .onChange(async (value) => { + this.plugin.settings.dashboardLayout = + value === "grid" || value === "vertical" || value === "compact" + ? value + : "carousel"; + await this.plugin.saveSettings(); + // The stats page-size option only applies to the + // carousel layout. + renderStatsOptions(); + }), + ); + + new Setting(containerEl) + .setName(t("Cards per view")) + .setDesc( + t( + "How many habit cards fit side by side on wider screens.", + ), + ) + .addDropdown((dropdown) => + dropdown + .addOption("1", "1") + .addOption("2", "2") + .addOption("3", "3") + .addOption("4", "4") + .setValue(String(this.plugin.settings.cardsPerView)) + .onChange(async (value) => { + this.plugin.settings.cardsPerView = Number(value); + await this.plugin.saveSettings(); + }), + ); + + new Setting(containerEl) + .setName(t("Cards per view on mobile")) + .setDesc( + t( + "How many habit cards fit side by side on phone-sized screens.", + ), + ) + .addDropdown((dropdown) => + dropdown + .addOption("1", "1") + .addOption("2", "2") + .setValue( + String(this.plugin.settings.mobileCardsPerView), + ) + .onChange(async (value) => { + this.plugin.settings.mobileCardsPerView = + Number(value); + await this.plugin.saveSettings(); + }), + ); + + // In its own container so changing the layout can redraw just + // this block instead of the whole tab. + const statsDetails = containerEl.createDiv(); + const renderStatsOptions = (): void => { + statsDetails.empty(); + if (this.plugin.settings.dashboardLayout !== "carousel") { + return; + } + new Setting(statsDetails) + .setName(t("Stats rows per page")) + .setDesc(t("How many habits each stats page shows.")) + .addDropdown((dropdown) => { + for (let n = 1; n <= 8; n++) { + dropdown.addOption(String(n), String(n)); + } + dropdown + .setValue( + String(this.plugin.settings.statsRowsPerPage), + ) + .onChange(async (value) => { + this.plugin.settings.statsRowsPerPage = + Number(value); + await this.plugin.saveSettings(); + }); + }); + }; + renderStatsOptions(); + + new Setting(containerEl).setName(t("Sorting")).setHeading(); + + new Setting(containerEl) + .setName(t("Sort habits by")) + .setDesc( + t( + "The base order of habit cards in the dashboard and side panel.", + ), + ) + .addDropdown((dropdown) => + dropdown + .addOption("name", t("Name (A–Z)")) + .addOption("color", t("Color")) + .addOption("startDate", t("Start date")) + .addOption("lastLogged", t("Last logged")) + .addOption("time", t("Planned time")) + .addOption("group", t("Group")) + .addOption("manual", t("Manual")) + .setValue(this.plugin.settings.sortMode) + .onChange(async (value) => { + this.plugin.settings.sortMode = [ + "name", + "color", + "startDate", + "lastLogged", + "time", + "group", + "manual", + ].includes(value) + ? (value as HabitSortMode) + : "name"; + await this.plugin.saveSettings(); + manualOrderSetting.settingEl.toggle( + this.plugin.settings.sortMode === "manual", + ); + groupOrderSetting.settingEl.toggle( + this.plugin.settings.sortMode === "group", + ); + }), + ); + + // Always rendered, shown only while sorting is manual. + const manualOrderSetting = new Setting(containerEl) + .setName(t("Manual order")) + .setDesc( + t( + "Drag the cards into the order you want. New habits join the end of the list.", + ), + ); + this.renderManualOrderEditor(manualOrderSetting); + manualOrderSetting.settingEl.toggle( + this.plugin.settings.sortMode === "manual", + ); + + // Always rendered, shown only while sorting by group. + const groupOrderSetting = new Setting(containerEl) + .setName(t("Group order")) + .setDesc( + t( + "Drag the groups into the order you want. Sections follow the same order.", + ), + ); + this.renderGroupOrderEditor(groupOrderSetting); + groupOrderSetting.settingEl.toggle( + this.plugin.settings.sortMode === "group", + ); + + new Setting(containerEl) + .setName(t("Move completed cards to the end")) + .setDesc( + t( + "Completed habits drift to the end of the queue and paused ones park behind them. Turn this off to keep every card in its sorted position.", + ), + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.statusOrdering) + .onChange(async (value) => { + this.plugin.settings.statusOrdering = value; + await this.plugin.saveSettings(); + }), + ); + + new Setting(containerEl).setName(t("Groups")).setHeading(); + + new Setting(containerEl) + .setName(t("Enable groups")) + .setDesc( + t( + "Show habits in sections by their group, with a group lip on each card.", + ), + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.groupsEnabled) + .onChange(async (value) => { + this.plugin.settings.groupsEnabled = value; + await this.plugin.saveSettings(); + groupDetails.toggle(value); + }), + ); + + // The group tools only matter while groups are on. + const groupDetails = containerEl.createDiv(); + new Setting(groupDetails) + .setName(t("Manage groups")) + .setDesc( + t("See every habit by group and drag cards between groups."), + ) + .addButton((button) => + button.setButtonText(t("Open")).onClick(() => { + new GroupsModal( + this.app, + this.plugin.store, + () => this.plugin.settings, + () => this.plugin.saveSettings(), + ).open(); + }), + ); + groupDetails.toggle(this.plugin.settings.groupsEnabled); + + this.displayReminders(containerEl); + } + + /** Reminder-line generation for the Reminder plugin. */ + private displayReminders(containerEl: HTMLElement): void { + new Setting(containerEl).setName(t("Reminders")).setHeading(); + + new Setting(containerEl) + .setName(t("Write reminders for due habits")) + .setDesc( + t( + "Each day, write one reminder checklist line per planned time of every habit due that day, in the format the Reminder plugin picks up. The lines live in a marked block and refresh as you log habits.", + ), + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.reminders.enabled) + .onChange(async (value) => { + this.plugin.settings.reminders.enabled = value; + await this.plugin.saveSettings(); + reminderDetails.toggle(value); + notePathSetting.settingEl.toggle( + value && + this.plugin.settings.reminders.target === + "fixed-note", + ); + }), + ); + + const reminderDetails = containerEl.createDiv(); + new Setting(reminderDetails) + .setName(t("Where to write reminders")) + .setDesc( + t( + "The daily note follows the Daily notes core plugin's folder and date format; the block is added once the note exists. A fixed note is created automatically.", + ), + ) + .addDropdown((dropdown) => + dropdown + .addOption("daily-note", t("Today's daily note")) + .addOption("fixed-note", t("A fixed note")) + .setValue(this.plugin.settings.reminders.target) + .onChange(async (value) => { + this.plugin.settings.reminders.target = + value === "fixed-note" ? "fixed-note" : "daily-note"; + await this.plugin.saveSettings(); + notePathSetting.settingEl.toggle( + this.plugin.settings.reminders.target === + "fixed-note", + ); + }), + ); + + const notePathSetting = new Setting(reminderDetails) + .setName(t("Reminder note path")) + .setDesc( + t("Vault path of the note that holds the reminder block."), + ) + .addText((text) => + text + .setPlaceholder(DEFAULT_REMINDERS.notePath) + .setValue(this.plugin.settings.reminders.notePath) + .onChange(async (value) => { + this.plugin.settings.reminders.notePath = + value.trim() || DEFAULT_REMINDERS.notePath; + await this.plugin.saveSettings(); + }), + ); + reminderDetails.toggle(this.plugin.settings.reminders.enabled); + notePathSetting.settingEl.toggle( + this.plugin.settings.reminders.enabled && + this.plugin.settings.reminders.target === "fixed-note", + ); + } + + /** + * Opt-in toggles for features still being tested. Turning a flag off + * only hides the feature's entry points; anything already created with + * it keeps working and keeps its meaning. + */ + private displayExperimental(containerEl: HTMLElement): void { + containerEl.createEl("p", { + cls: "habits-experimental-note", + text: t( + "These features are still being tested and may change before they become permanent. Turning one off only hides it from menus — anything you created with it keeps working.", + ), + }); + + new Setting(containerEl) + .setName(t("Note habits")) + .setDesc( + t( + "Track a habit by writing in a per-day note instead of logging a value by hand. A day is complete once the note reaches a character count or every task in it is checked. Works with the Templater plugin to create each day's note from a template.", + ), + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.experimental.noteHabits) + .onChange(async (value) => { + this.plugin.settings.experimental.noteHabits = value; + await this.plugin.saveSettings(); + }), + ); + + new Setting(containerEl) + .setName(t("Reschedule missed habits")) + .setDesc( + t( + "Add a notification button to the dashboard and sidebar panel when a habit's been missed, opening a review of missed days you can move onto a different one (never a day that habit is already due, so nothing doubles up).", + ), + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.experimental.rescheduling) + .onChange(async (value) => { + this.plugin.settings.experimental.rescheduling = value; + await this.plugin.saveSettings(); + }), + ); + + new Setting(containerEl) + .setName(t("AI summaries")) + .setDesc( + t( + "Show an AI-generated summary with feedback and advice on the stats page tabs. Uses an OpenAI-compatible service you configure below; your habit stats are sent to it only when you press the generate button.", + ), + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.experimental.aiSummaries) + .onChange(async (value) => { + this.plugin.settings.experimental.aiSummaries = value; + await this.plugin.saveSettings(); + // Show or hide the connection fields with the toggle. + renderAiFields(); + }), + ); + + // The connection fields live in their own container so toggling the + // feature can redraw just this block instead of the whole tab. + const aiDetails = containerEl.createDiv(); + const renderAiFields = (): void => { + aiDetails.empty(); + if (this.plugin.settings.experimental.aiSummaries) { + this.displayAiSummary(aiDetails); + } + }; + renderAiFields(); + } + + /** Connection fields for the AI summaries feature (shown only when on). */ + private displayAiSummary(containerEl: HTMLElement): void { + new Setting(containerEl) + .setName(t("AI base URL")) + .setDesc( + t( + "Base URL of an OpenAI-compatible API. Works with OpenAI, OpenRouter, or local servers like Ollama (http://localhost:11434/v1).", + ), + ) + .addText((text) => + text + .setPlaceholder(DEFAULT_AI_SUMMARY.baseUrl) + .setValue(this.plugin.settings.aiSummary.baseUrl) + .onChange(async (value) => { + this.plugin.settings.aiSummary.baseUrl = + value.trim() || DEFAULT_AI_SUMMARY.baseUrl; + await this.plugin.saveSettings(); + }), + ); + + new Setting(containerEl) + .setName(t("AI API key")) + .setDesc( + t( + "Stored locally in this vault's plugin data. Leave blank for local servers that need no key.", + ), + ) + .addText((text) => { + text.inputEl.type = "password"; + text + .setValue(this.plugin.settings.aiSummary.apiKey) + .onChange(async (value) => { + this.plugin.settings.aiSummary.apiKey = value.trim(); + await this.plugin.saveSettings(); + }); + }); + + new Setting(containerEl) + .setName(t("AI model")) + .setDesc(t("Model name the service should use.")) + .addText((text) => + text + .setPlaceholder(DEFAULT_AI_SUMMARY.model) + .setValue(this.plugin.settings.aiSummary.model) + .onChange(async (value) => { + this.plugin.settings.aiSummary.model = + value.trim() || DEFAULT_AI_SUMMARY.model; + await this.plugin.saveSettings(); + }), + ); + } + + /** Content of the "Advanced" tab: frontmatter property-key remapping. */ + private displayAdvanced(containerEl: HTMLElement): void { + new FrontmatterKeysEditor(this.app, this.plugin).render(containerEl); + } +} + +/** + * Human-readable label for each configurable frontmatter key, grouped the + * way they're presented in the Advanced page/section. + */ +const FRONTMATTER_KEY_GROUPS: { + heading: () => string; + fields: [keyof FrontmatterKeys, () => string][]; +}[] = [ + { + heading: () => t("Identity"), + fields: [ + ["type", () => t("Habit type key")], + ["records", () => t("Completion records key")], + ], + }, + { + heading: () => t("Schedule"), + fields: [ + ["frequency", () => t("Frequency key")], + ["weekday", () => t("Weekday key")], + ["monthDay", () => t("Month day key")], + ["intervalDays", () => t("Interval days key")], + ["intervalMode", () => t("Interval schedule key")], + ["time", () => t("Planned time key")], + ], + }, + { + heading: () => t("Goal"), + fields: [ + ["goalDirection", () => t("Goal direction key")], + ["target", () => t("Target key")], + ["unit", () => t("Unit key")], + ["step", () => t("Step size key")], + ["weeklyTarget", () => t("Weekly target key")], + ["monthlyTarget", () => t("Monthly target key")], + ["weeklyPerfect", () => t("Weekly perfect key")], + ["monthlyPerfect", () => t("Monthly perfect key")], + ], + }, + { + heading: () => t("Lifecycle"), + fields: [ + ["startDate", () => t("Start date key")], + ["pauses", () => t("Pauses key")], + ["reschedules", () => t("Reschedules key")], + ["failed", () => t("Failed days key")], + ["skipped", () => t("Skipped days key")], + ["stopped", () => t("Stopped key")], + ["stopDate", () => t("Stop date key")], + ], + }, + { + heading: () => t("Presentation"), + fields: [ + ["icon", () => t("Icon key")], + ["color", () => t("Color key")], + ["group", () => t("Group key")], + ["useGroupColor", () => t("Use group color key")], + ], + }, + { + heading: () => t("Note habit"), + fields: [ + ["noteFolder", () => t("Note folder key")], + ["noteFilenameFormat", () => t("Note filename format key")], + ["templatePath", () => t("Template path key")], + ["noteCompletionMode", () => t("Note completion mode key")], + [ + "noteChecklistRequirement", + () => t("Note checklist requirement key"), + ], + ["noteChecklistMin", () => t("Note checklist minimum key")], + ["noteFailKeyword", () => t("Note fail keyword key")], + ], + }, + { + heading: () => t("Legacy"), + fields: [["comments", () => t("Legacy comments key")]], + }, +]; + +/** + * Editor for the frontmatter-key remapping, rendered inline into the + * "Advanced" tab's content by {@link HabitsSettingTab.displayAdvanced}. + * + * Edits are held locally until "Apply key changes" is pressed: applying + * validates the whole set at once (no blanks, no two fields sharing a key), + * confirms with the user via {@link ConfirmModal}, then moves each renamed + * field's existing value onto its new key across every habit note before + * saving the setting — see {@link HabitStore.renameFrontmatterKeys}. + */ +class FrontmatterKeysEditor { + private pending: FrontmatterKeys; + private applySetting?: Setting; + + constructor( + private app: App, + private plugin: HabitsPlugin, + ) { + this.pending = { ...this.plugin.settings.frontmatterKeys }; + } + + render(containerEl: HTMLElement): void { + containerEl.createEl("p", { + cls: "habits-advanced-note", + text: t( + "Rename the frontmatter properties habit notes use. Useful for avoiding collisions with another plugin's own properties in the same note (for example TaskNotes).", + ), + }); + + for (const group of FRONTMATTER_KEY_GROUPS) { + new Setting(containerEl).setName(group.heading()).setHeading(); + for (const [field, label] of group.fields) { + const setting = new Setting(containerEl).setName(label()); + if (field === "records") { + setting.setDesc( + t( + "Renaming this away from the default also changes how binary habits log a day: instead of {\"2026-08-25\": 1}, a completed day becomes a bare date, like [\"2026-08-25\"] — the shape TaskNotes uses for complete_instances. Repetition and timed habits are unaffected either way; they always need a value, never just a date.", + ), + ); + } + setting.addText((text) => + text.setValue(this.pending[field]).onChange((value) => { + this.pending[field] = value; + this.refreshApplyVisibility(); + }), + ); + } + } + + this.applySetting = new Setting(containerEl).addButton((button) => + button + .setButtonText(t("Apply key changes")) + .setCta() + .onClick(() => { + void this.apply(); + }), + ); + this.refreshApplyVisibility(); + } + + private isDirty(): boolean { + const saved = this.plugin.settings.frontmatterKeys; + return (Object.keys(this.pending) as (keyof FrontmatterKeys)[]).some( + (field) => this.pending[field].trim() !== saved[field], + ); + } + + private refreshApplyVisibility(): void { + this.applySetting?.settingEl.toggle(this.isDirty()); + } + + private async apply(): Promise { + const saved = this.plugin.settings.frontmatterKeys; + const fields = Object.keys(this.pending) as (keyof FrontmatterKeys)[]; + + const seen = new Map(); + for (const field of fields) { + const value = this.pending[field].trim(); + if (!value) { + new Notice(t("Property keys can't be empty.")); + return; + } + this.pending[field] = value; + const clash = seen.get(value); + if (clash) { + new Notice( + t( + '"{a}" and "{b}" can\'t use the same property key ("{value}").', + { a: clash, b: field, value }, + ), + ); + return; + } + seen.set(value, field); + } + + const renames = fields + .filter((field) => this.pending[field] !== saved[field]) + .map((field) => ({ old: saved[field], new: this.pending[field] })); + if (renames.length === 0) { + return; + } + + const summary = renames + .map((r) => `"${r.old}" → "${r.new}"`) + .join(", "); + const count = this.plugin.store.getHabits().length; + new ConfirmModal(this.app, { + title: t("Apply key changes"), + message: t( + "This renames {summary} in every note in your habits folder ({count} habit(s) currently). Existing values are moved, not discarded. Continue?", + { summary, count }, + ), + confirmText: t("Apply"), + onConfirm: async () => { + // Settings are saved *before* the notes are rewritten: the + // rewrite fires metadataCache "changed" events for each + // file as it's touched, and anything reacting to those + // (e.g. a habit-metrics block) must already see the new + // key mapping — otherwise it re-reads a note whose data + // just moved to the new key using the old one, finds + // nothing, and stays empty until something else happens + // to trigger a further refresh. + this.plugin.settings.frontmatterKeys = { ...this.pending }; + await this.plugin.saveSettings(); + const changed = + await this.plugin.store.renameFrontmatterKeys(renames); + new Notice( + t("Updated the frontmatter keys in {count} note(s).", { + count: changed, + }), + ); + this.refreshApplyVisibility(); + }, + }).open(); + } +} diff --git a/src/integrations/habits/stats.ts b/src/integrations/habits/stats.ts new file mode 100644 index 000000000..dae7b8707 --- /dev/null +++ b/src/integrations/habits/stats.ts @@ -0,0 +1,866 @@ +import type { HabitDefinition } from "./types"; +import { + addDays, + daysInMonth, + fromDateKey, + isFlexibleFrequency, + toDateKey, +} from "./utils"; + +const MS_PER_DAY = 86_400_000; + +export type StatsPeriod = "weekly" | "monthly" | "custom"; +export type StatsRangeMode = "rolling" | "calendar"; + +/** + * Longest span a custom range may cover. Keeps the per-habit heatmaps + * renderable — a full year is 366 cells; an accidental decade would be + * thousands. + */ +export const MAX_CUSTOM_DAYS = 366; + +export interface DateRange { + start: Date; + end: Date; +} + +/** Midnight of the given date, in local time. */ +function startOfDay(date: Date): Date { + return new Date(date.getFullYear(), date.getMonth(), date.getDate()); +} + +/** Monday of the week containing the given date. */ +function startOfWeek(date: Date): Date { + const base = startOfDay(date); + const offset = (base.getDay() + 6) % 7; // Monday = 0 + return addDays(base, -offset); +} + +/** True for the two "N times per period, any day" frequencies. */ +export function isFlexible(habit: HabitDefinition): boolean { + return isFlexibleFrequency(habit.frequency); +} + +/** + * Whether a habit's card should show and be interactive on `date`. + * + * For every other frequency this is exactly {@link isDue}. Flexible + * habits are due (in the stats sense) only on their period's last day — + * see {@link isDue} — but need to be actionable every day so the user can + * log an occurrence whenever it actually happens. + */ +export function isActive(habit: HabitDefinition, date: Date): boolean { + return isDue(habit, date) || isFlexible(habit); +} + +/** The Monday–Sunday week, or calendar month, containing `date`. */ +export function flexiblePeriodRange( + habit: HabitDefinition, + date: Date, +): DateRange { + if (habit.frequency === "flexibleWeekly") { + const start = startOfWeek(date); + return { start, end: addDays(start, 6) }; + } + const base = startOfDay(date); + return { + start: new Date(base.getFullYear(), base.getMonth(), 1), + end: new Date(base.getFullYear(), base.getMonth() + 1, 0), + }; +} + +/** The period immediately before `range` (mirrors its week/month shape). */ +function previousPeriodRange( + habit: HabitDefinition, + range: DateRange, +): DateRange { + if (habit.frequency === "flexibleWeekly") { + const start = addDays(range.start, -7); + return { start, end: addDays(start, 6) }; + } + const prevEnd = addDays(range.start, -1); + return { + start: new Date(prevEnd.getFullYear(), prevEnd.getMonth(), 1), + end: prevEnd, + }; +} + +/** The period immediately after `range` (mirrors its week/month shape). */ +function nextPeriodRange( + habit: HabitDefinition, + range: DateRange, +): DateRange { + if (habit.frequency === "flexibleWeekly") { + const start = addDays(range.start, 7); + return { start, end: addDays(start, 6) }; + } + const nextStart = addDays(range.end, 1); + return { + start: nextStart, + end: new Date(nextStart.getFullYear(), nextStart.getMonth() + 1, 0), + }; +} + +/** Every day in `range` is paused — a whole period to leave out of streaks. */ +function periodFullyPaused(habit: HabitDefinition, range: DateRange): boolean { + let cursor = new Date(range.start); + while (cursor.getTime() <= range.end.getTime()) { + if (!isPausedOn(habit, toDateKey(cursor))) { + return false; + } + cursor = addDays(cursor, 1); + } + return true; +} + +/** Sum of `records` within `range`, from its start through `throughDate`. */ +function periodTotalThrough( + habit: HabitDefinition, + range: DateRange, + throughDate: Date, +): number { + const end = + throughDate.getTime() < range.end.getTime() ? throughDate : range.end; + let total = 0; + let cursor = new Date(range.start); + while (cursor.getTime() <= end.getTime()) { + total += habit.records[toDateKey(cursor)] ?? 0; + cursor = addDays(cursor, 1); + } + return total; +} + +/** + * A flexible habit's period-cumulative total, from the start of the period + * containing `date` through `date` itself. On a non-canonical day this is a + * live "have I hit quota yet this period" reading; on the period's last day + * it is the authoritative full-period total. + */ +export function flexiblePeriodTotal( + habit: HabitDefinition, + date: Date, +): number { + return periodTotalThrough(habit, flexiblePeriodRange(habit, date), date); +} + +/** Whether a period total reaches a flexible habit's "times per period" goal. */ +function meetsFlexibleTarget(habit: HabitDefinition, total: number): boolean { + if (habit.goalDirection === "max") return total <= limitOf(habit); + return habit.target > 0 ? total >= habit.target : total > 0; +} + +/** Number of whole days from start to end, inclusive. */ +export function rangeLength(range: DateRange): number { + return ( + Math.round((range.start.getTime() - range.end.getTime()) / -MS_PER_DAY) + + 1 + ); +} + +/** + * Bring a user-picked custom range into canonical form: reversed ends are + * swapped, times are stripped, and the span is capped at + * {@link MAX_CUSTOM_DAYS} (keeping the chosen end). Without a range, the + * last 14 days are used as a sensible starting point. + */ +export function normalizeCustomRange( + custom: DateRange | undefined, + today: Date, +): DateRange { + const base = startOfDay(today); + if (!custom) { + return { start: addDays(base, -13), end: base }; + } + let start = startOfDay(custom.start); + let end = startOfDay(custom.end); + if (start.getTime() > end.getTime()) { + [start, end] = [end, start]; + } + if (rangeLength({ start, end }) > MAX_CUSTOM_DAYS) { + start = addDays(end, -(MAX_CUSTOM_DAYS - 1)); + } + return { start, end }; +} + +/** + * Resolve the date range for a period and mode. + * + * - rolling: the last 7 or 30 days ending today. + * - calendar: the current week (Monday–Sunday) or current month (dynamic). + * - custom period: the user-picked range (normalized); `mode` is ignored. + */ +export function getStatsRange( + today: Date, + period: StatsPeriod, + mode: StatsRangeMode, + custom?: DateRange, +): DateRange { + if (period === "custom") { + return normalizeCustomRange(custom, today); + } + const base = startOfDay(today); + if (mode === "rolling") { + const length = period === "weekly" ? 7 : 30; + return { start: addDays(base, -(length - 1)), end: base }; + } + if (period === "weekly") { + const start = startOfWeek(base); + return { start, end: addDays(start, 6) }; + } + const start = new Date(base.getFullYear(), base.getMonth(), 1); + const end = new Date(base.getFullYear(), base.getMonth() + 1, 0); + return { start, end }; +} + +/** + * The day of the month a monthly habit falls due in the given month, clamped + * to the month's length. A habit set to the 31st therefore lands on the last + * day of shorter months (e.g. 28 or 29 in February) rather than being skipped. + */ +export function effectiveMonthDay( + year: number, + month: number, + monthDay: number, +): number { + const length = daysInMonth(year, month); + return Math.min(Math.max(1, monthDay), length); +} + +/** + * The day an interval habit's every-N-days cycle counts from: its start + * date, or the earliest record for hand-written notes without one. `null` + * means no anchor exists yet (a brand-new note with no records). + */ +export function intervalAnchor(habit: HabitDefinition): Date | null { + if (habit.startDate !== "") { + return fromDateKey(habit.startDate); + } + const keys = Object.keys(habit.records); + if (keys.length > 0) { + return fromDateKey(keys.reduce((min, key) => (key < min ? key : min))); + } + return null; +} + +/** + * True when the habit is due on the given date. + * + * - `daily` habits are due every day. + * - `weekly` habits are due on their chosen weekdays. + * - `monthly` habits are due on their chosen day of the month, clamped to the + * month's last day when the month is shorter. + * - `interval` habits are due every N days counted from their anchor (see + * {@link intervalAnchor}); dates before the anchor are never due, and a + * habit with no anchor yet behaves as daily until one exists. + * - `flexibleWeekly`/`flexibleMonthly` habits are due, in this stats sense, + * only on the last day of their period (Sunday, or the month's last day) + * — the one canonical day a whole period's outcome is scored on. Use + * {@link isActive} for "should this show up today" instead; it is true + * every day for these two frequencies. + */ +export function isDue(habit: HabitDefinition, date: Date): boolean { + const key = toDateKey(date); + if (rescheduleTarget(habit, key)) { + // This day's instance moved elsewhere; it isn't due here any more. + return false; + } + if (rescheduleSource(habit, key)) { + // A moved instance lands here instead, whether or not this day + // would otherwise be due on its own. + return true; + } + if (habit.frequency === "flexibleWeekly") { + return date.getDay() === 0; // Sunday: the last day of a Monday-start week + } + if (habit.frequency === "flexibleMonthly") { + return ( + date.getDate() === daysInMonth(date.getFullYear(), date.getMonth()) + ); + } + if (habit.frequency === "weekly") { + return habit.weekdays.includes(date.getDay()); + } + if (habit.frequency === "monthly") { + return ( + date.getDate() === + effectiveMonthDay( + date.getFullYear(), + date.getMonth(), + habit.monthDay, + ) + ); + } + if (habit.frequency === "interval") { + if (habit.intervalMode === "completion" && habit.goalDirection !== "max") { + // Only earlier successful records can move this day's due date. + // Future records and partial counts never rewrite its history. + const completed = (day: string): boolean => { + const value = habit.records[day] ?? 0; + return !(habit.failed ?? []).includes(day) && !(habit.skipped ?? []).includes(day) + && !isPausedOn(habit, day) && value > 0 + && (habit.type === "binary" || value >= habit.target); + }; + if (completed(key)) return true; + const previous = Object.keys(habit.records).filter(day => day < key && completed(day)).sort().pop(); + const anchor = previous ? fromDateKey(previous) : intervalAnchor(habit); + if (!anchor) return true; + const days = Math.round((startOfDay(date).getTime() - anchor.getTime()) / MS_PER_DAY); + // An overdue habit remains actionable until it is completed. + return days >= (previous ? Math.max(2, habit.intervalDays) : 0); + } + const anchor = intervalAnchor(habit); + if (!anchor) { + return true; + } + // Both dates are local midnights; rounding absorbs the odd hour a + // DST transition adds or removes inside the span. + const days = Math.round( + (startOfDay(date).getTime() - anchor.getTime()) / MS_PER_DAY, + ); + return days >= 0 && days % Math.max(1, habit.intervalDays) === 0; + } + return true; +} + +/** + * The limit a `max` habit must stay under. Binary limit habits are always + * "none at all" (any logged value is a slip); counter and timed habits use + * `target` as the limit, where `0` is a valid "zero allowed" limit. + */ +export function limitOf(habit: HabitDefinition): number { + if (habit.type === "binary") { + return 0; + } + return Math.max(0, habit.target); +} + +/** + * The first day a habit counts towards scoring. + * + * Days before a habit existed must not count at all: for `max` habits an + * unlogged day scores as "within limit", so without a lower bound every day + * since the beginning of time would count as a success — and for `min` + * habits every pre-start day would count as a failure, deflating rates. + * Habits normally carry a `startDate`; for hand-written notes without one, + * the earliest record is used, and a habit with neither only starts scoring + * today. + */ +export function trackingStartKey( + habit: HabitDefinition, + today: Date = new Date(), +): string { + if (habit.startDate !== "") { + return habit.startDate; + } + const keys = Object.keys(habit.records); + if (keys.length > 0) { + return keys.reduce((min, key) => (key < min ? key : min)); + } + return toDateKey(today); +} + +/** + * True when a habit met its goal on the given day. + * + * For `flexibleWeekly`/`flexibleMonthly` habits: the running total for the + * period containing `dateKey`, summed from the period's start through + * `dateKey` itself, reaches `target`. Well-defined for any day, not just + * the period's canonical last day — see {@link flexiblePeriodTotal}. + * For `min` habits: the logged value reached the target. + * For `max` habits: the logged value stayed at or under the limit — an + * unlogged day counts as within limit, but only from the habit's start + * day onward (see {@link limitStartKey}). + */ +export function isComplete(habit: HabitDefinition, dateKey: string): boolean { + const target = rescheduleTarget(habit, dateKey); + if (target) { + // A rescheduled day's completion lives entirely on its new day — + // reschedules can't chain, so this never recurses more than once. + return isComplete(habit, target); + } + if (isFlexible(habit)) { + if (habit.goalDirection === "max" && dateKey < trackingStartKey(habit)) return false; + const date = fromDateKey(dateKey); + return date ? meetsFlexibleTarget(habit, flexiblePeriodTotal(habit, date)) : false; + } + // "Fail for today" is a deliberate miss: it wins over any logged value, + // and over a limit habit's "silence is clean" default. + if (isFailedOn(habit, dateKey)) { + return false; + } + const value = habit.records[dateKey] ?? 0; + if (habit.goalDirection === "max") { + if (dateKey < trackingStartKey(habit)) { + return false; + } + return value <= limitOf(habit); + } + if (habit.type === "binary") { + return value >= 1; + } + return habit.target > 0 ? value >= habit.target : value > 0; +} + +/** + * True when the habit was paused on the given day — including a day the + * user skipped ("Skip for today"), which is a one-day pause: it's left out + * of streaks and completion rates exactly like any other paused day. + */ +export function isPausedOn(habit: HabitDefinition, dateKey: string): boolean { + if (isSkippedOn(habit, dateKey)) { + return true; + } + return habit.pauses.some( + (pause) => + dateKey >= pause.start && + (pause.end === "" || dateKey <= pause.end), + ); +} + +/** + * True when the user closed the given day as failed ("Fail for today"). + * Tolerates a habit object built without the list (e.g. a test fixture or + * a habit from an older code path), treating it as empty. + */ +export function isFailedOn(habit: HabitDefinition, dateKey: string): boolean { + return (habit.failed as string[] | undefined)?.includes(dateKey) ?? false; +} + +/** True when the user skipped the given day ("Skip for today"). */ +export function isSkippedOn(habit: HabitDefinition, dateKey: string): boolean { + return (habit.skipped as string[] | undefined)?.includes(dateKey) ?? false; +} + +/** + * The date a due day's instance was moved to, if `dateKey` was rescheduled + * away. `isDue`/`isComplete` use this to make a moved day stop counting and + * its new day count in its place. + */ +export function rescheduleTarget( + habit: HabitDefinition, + dateKey: string, +): string | null { + return habit.reschedules.find((r) => r.from === dateKey)?.to ?? null; +} + +/** + * The original due date `dateKey` covers, if it's a reschedule's + * destination. + */ +export function rescheduleSource( + habit: HabitDefinition, + dateKey: string, +): string | null { + return habit.reschedules.find((r) => r.to === dateKey)?.from ?? null; +} + +/** + * Whether a habit's missed days can be reviewed and rescheduled at all + * (experimental): a fixed-schedule (non-flexible), reach-a-target + * (non-`max`) habit whose value is logged by hand, not derived from a + * note's own content — and, crucially, not due every single day. A daily + * habit has no day that isn't already its own due day, so there would + * never be anywhere open to move a miss onto; interval habits are always + * at least every-other-day (`intervalDays` is clamped to 2+), so they + * always have somewhere free. + */ +export function isRescheduleEligible(habit: HabitDefinition): boolean { + return ( + !habit.stopped && + habit.type !== "note" && + habit.goalDirection !== "max" && + habit.frequency !== "daily" && + !isFlexible(habit) + ); +} + +/** + * Whether `dateKey` is open to become a reschedule's destination for + * `habit`: on or after the habit's tracking start (a day before the habit + * existed couldn't have been due there anyway), not already due on its own + * (that would collide with its own obligation — the "no double entries" + * rule), not paused, and not already claimed by another reschedule as + * either its origin or its destination. Chaining a rescheduled day into a + * second reschedule isn't supported. + */ +export function isRescheduleTargetOpen( + habit: HabitDefinition, + dateKey: string, +): boolean { + const date = fromDateKey(dateKey); + if (!date) { + return false; + } + if (dateKey < trackingStartKey(habit)) { + return false; + } + if (isDue(habit, date) || isPausedOn(habit, dateKey)) { + return false; + } + return !habit.reschedules.some( + (r) => r.from === dateKey || r.to === dateKey, + ); +} + +/** One habit's missed due day, as surfaced by {@link missedInstances}. */ +export interface MissedInstance { + habit: HabitDefinition; + dateKey: string; +} + +/** + * Every open (due, not paused, not complete) past due day across + * `habits`, newest first, capped at `limit`. Feeds the "missed habits" + * notification and its review modal (experimental) — only habits passing + * {@link isRescheduleEligible} are scanned, and `isDue`/`isComplete` + * already fold in reschedules, so a day already moved elsewhere is + * correctly skipped and a rescheduled-to day that's since also gone + * unlogged correctly turns up in its place. + */ +export function missedInstances( + habits: HabitDefinition[], + today: Date, + limit = 30, +): MissedInstance[] { + const results: MissedInstance[] = []; + // Guard against a pathological scan on a very old, long-gapped habit. + const maxScan = 366 * 2; + for (const habit of habits) { + if (!isRescheduleEligible(habit)) { + continue; + } + const startKey = trackingStartKey(habit, today); + let cursor = addDays(today, -1); + let scanned = 0; + while (scanned < maxScan) { + const key = toDateKey(cursor); + if (key < startKey) { + break; + } + if ( + isDue(habit, cursor) && + !isPausedOn(habit, key) && + // A failed day was decided on purpose, not forgotten, so + // it isn't offered for rescheduling. + !isFailedOn(habit, key) && + !isComplete(habit, key) + ) { + results.push({ habit, dateKey: key }); + } + cursor = addDays(cursor, -1); + scanned++; + } + } + results.sort((a, b) => (a.dateKey < b.dateKey ? 1 : -1)); + return results.slice(0, limit); +} + +/** + * {@link currentStreak} for a flexible habit: walks period by period (weeks + * or months) rather than day by day, since evaluating every day of an + * in-progress, not-yet-satisfied period would falsely look like a string of + * broken days. The current, still-open period counts if it is already + * satisfied and otherwise doesn't break anything — there is still time left + * in it, the same idea as the existing "today may still be blank" grace, + * just at period granularity. Every fully elapsed period after that is a + * plain pass/fail, so no grace is needed there. + */ +function flexibleCurrentStreak(habit: HabitDefinition, today: Date): number { + const habitStart = fromDateKey(trackingStartKey(habit, today)); + let range = flexiblePeriodRange(habit, today); + let streak = 0; + + if (toDateKey(range.end) !== toDateKey(startOfDay(today))) { + // An exceeded limit has no grace while the current period is open. + if (habit.goalDirection === "max" && habitStart && today >= habitStart && + !periodFullyPaused(habit, range) && + !meetsFlexibleTarget(habit, periodTotalThrough(habit, range, today))) return 0; + if ( + habitStart && + range.end.getTime() >= habitStart.getTime() && + !periodFullyPaused(habit, range) && + meetsFlexibleTarget(habit, periodTotalThrough(habit, range, today)) + ) { + streak++; + } + range = previousPeriodRange(habit, range); + } + + for (;;) { + if (habitStart && range.end.getTime() < habitStart.getTime()) { + break; + } + if (periodFullyPaused(habit, range)) { + range = previousPeriodRange(habit, range); + continue; + } + if (meetsFlexibleTarget(habit, periodTotalThrough(habit, range, range.end))) { + streak++; + } else { + break; + } + range = previousPeriodRange(habit, range); + } + return streak; +} + +/** {@link longestStreak} for a flexible habit; see {@link flexibleCurrentStreak}. */ +function flexibleLongestStreak(habit: HabitDefinition, today: Date): number { + const habitStart = fromDateKey(trackingStartKey(habit, today)); + if (!habitStart) { + return 0; + } + const todayRange = flexiblePeriodRange(habit, today); + let range = flexiblePeriodRange(habit, habitStart); + let best = 0; + let run = 0; + while (range.start.getTime() <= todayRange.start.getTime()) { + if (periodFullyPaused(habit, range)) { + range = nextPeriodRange(habit, range); + continue; + } + const isCurrent = range.start.getTime() === todayRange.start.getTime(); + const through = isCurrent ? today : range.end; + if (meetsFlexibleTarget(habit, periodTotalThrough(habit, range, through))) { + run++; + best = Math.max(best, run); + } else if (!isCurrent) { + // An unmet but still-open current period doesn't reset the run — + // mirrors flexibleCurrentStreak's grace for it. + run = 0; + } + range = nextPeriodRange(habit, range); + } + return best; +} + +/** + * Consecutive complete due periods ending with the most recent one. + * + * For daily habits every day is a period. For weekly and monthly habits only + * their due dates count, so the streak measures consecutive weeks or months + * completed. Paused due dates are skipped entirely (they neither break nor + * extend a streak), and the most recent due date may still be blank (e.g. a + * due date that is today) without breaking the streak. Flexible habits + * delegate to {@link flexibleCurrentStreak}, which walks whole periods + * instead of days. + */ +export function currentStreak(habit: HabitDefinition, today: Date): number { + if (isFlexible(habit)) { + return flexibleCurrentStreak(habit, today); + } + let cursor = startOfDay(today); + let streak = 0; + let graceUsed = false; + // An interval habit is never due before its anchor, so without a floor + // the walk below would search backwards forever. + const floor = + habit.frequency === "interval" ? intervalAnchor(habit) : null; + for (;;) { + if (floor && cursor.getTime() < floor.getTime()) { + break; + } + if (!isDue(habit, cursor)) { + cursor = addDays(cursor, -1); + continue; + } + const key = toDateKey(cursor); + if (isPausedOn(habit, key)) { + cursor = addDays(cursor, -1); + continue; + } + if (isComplete(habit, key)) { + streak++; + } else if ( + streak === 0 && + !graceUsed && + habit.goalDirection !== "max" + ) { + // The most recent due date may still be blank (e.g. today). Limit + // habits get no grace: for them a blank day already counts as + // within limit, so an incomplete day is a real slip (or a day + // before the habit started) and the streak genuinely ends there. + graceUsed = true; + } else { + break; + } + cursor = addDays(cursor, -1); + } + return streak; +} + +/** + * The longest run of consecutive complete due periods ever recorded. Days on + * which the habit is not due are ignored, and paused due dates inside a run do + * not break it. + * + * `min` habits anchor the scan on logged completions. `max` habits cannot + * (silence is success, so there may be no logged "completions" at all); + * they scan the whole tracked window, from the habit's start day to today. + * Flexible habits delegate to {@link flexibleLongestStreak}. + */ +export function longestStreak( + habit: HabitDefinition, + today: Date = new Date(), +): number { + if (isFlexible(habit)) { + return flexibleLongestStreak(habit, today); + } + let first: Date | null; + let last: Date | null; + if (habit.goalDirection === "max") { + first = fromDateKey(trackingStartKey(habit, today)); + last = startOfDay(today); + if (!first || first.getTime() > last.getTime()) { + return 0; + } + } else { + const completedKeys = Object.keys(habit.records) + .filter((key) => isComplete(habit, key)) + .sort(); + if (completedKeys.length === 0) { + return 0; + } + first = fromDateKey(completedKeys[0]); + last = fromDateKey(completedKeys[completedKeys.length - 1]); + } + if (!first || !last) { + return 0; + } + + let best = 0; + let run = 0; + let cursor = first; + while (cursor.getTime() <= last.getTime()) { + if (isDue(habit, cursor)) { + const key = toDateKey(cursor); + if (isComplete(habit, key)) { + run++; + best = Math.max(best, run); + } else if (!isPausedOn(habit, key)) { + run = 0; + } + } + cursor = addDays(cursor, 1); + } + return best; +} + +export interface HabitPeriodStats { + days: number; + completed: number; + total: number; + rate: number; + current: number; + best: number; +} + +/** The last day of the range to count towards metrics (never in the future). */ +function elapsedEnd(range: DateRange, today: Date): number { + return Math.min(range.end.getTime(), startOfDay(today).getTime()); +} + +/** + * Aggregate a single habit's stats over the elapsed days of a range. + * Days before the habit's tracking start (see {@link trackingStartKey}) are + * excluded entirely — the habit did not exist yet, so they count neither as + * successes nor as failures. + */ +export function habitStats( + habit: HabitDefinition, + range: DateRange, + today: Date, +): HabitPeriodStats { + const end = elapsedEnd(range, today); + const startKey = trackingStartKey(habit, today); + let days = 0; + let completed = 0; + let total = 0; + let cursor = new Date(range.start); + while (cursor.getTime() <= end) { + const key = toDateKey(cursor); + if ( + key < startKey || + !isDue(habit, cursor) || + isPausedOn(habit, key) + ) { + cursor = addDays(cursor, 1); + continue; + } + days++; + const value = habit.records[key] ?? 0; + if (isFlexible(habit)) { + // isDue only gates this loop through on the period's last day, so + // `cursor` is the period end here and this total is the whole + // period's, not just this one day's. + total += flexiblePeriodTotal(habit, cursor); + if (isComplete(habit, key)) { + completed++; + } + } else if (habit.goalDirection === "max") { + // For limit habits `total` is consumption (slips for binary), + // and a completed day is one that stayed within the limit. + total += value; + if (isComplete(habit, key)) { + completed++; + } + } else if (habit.type === "binary") { + if (value >= 1) { + completed++; + total++; + } + } else { + total += value; + if (isComplete(habit, key)) { + completed++; + } + } + cursor = addDays(cursor, 1); + } + return { + days, + completed, + total, + rate: days > 0 ? completed / days : 0, + current: currentStreak(habit, today), + best: longestStreak(habit, today), + }; +} + +/** + * Count elapsed days in the range where every habit was complete. + * Habits paused on a given day are ignored for that day, as are habits not + * yet being tracked; a day with every habit paused or untracked cannot be + * perfect. + */ +export function perfectDays( + habits: HabitDefinition[], + range: DateRange, + today: Date, +): number { + if (habits.length === 0) { + return 0; + } + const end = elapsedEnd(range, today); + const startKeys = habits.map((habit) => trackingStartKey(habit, today)); + let count = 0; + let cursor = new Date(range.start); + while (cursor.getTime() <= end) { + const key = toDateKey(cursor); + const date = cursor; + const active = habits.filter( + (habit, i) => + key >= startKeys[i] && + isDue(habit, date) && + !isPausedOn(habit, key), + ); + if ( + active.length > 0 && + active.every((habit) => isComplete(habit, key)) + ) { + count++; + } + cursor = addDays(cursor, 1); + } + return count; +} diff --git a/src/integrations/habits/task-genius-host.ts b/src/integrations/habits/task-genius-host.ts new file mode 100644 index 000000000..751891bed --- /dev/null +++ b/src/integrations/habits/task-genius-host.ts @@ -0,0 +1,102 @@ +import { PluginSettingTab, type PluginManifest } from "obsidian"; +import type TaskProgressBarPlugin from "@/index"; +import HabitsPlugin from "./main"; +import { HabitsSettingTab, type HabitsPluginSettings } from "./settings"; +import { t } from "./i18n"; +import "./scoped.css"; +import "./task-genius.css"; + +/** The integration owns a settings namespace, never a second plugin data.json. */ +export class TaskGeniusHabits extends HabitsPlugin { + readonly ready: Promise; + private resolveReady!: () => void; + private rejectReady!: (reason: unknown) => void; + private disposed = false; + embeddedSettings?: HabitsSettingTab; + + constructor(readonly host: TaskProgressBarPlugin) { + super(host.app, { + ...host.manifest, + id: `${host.manifest.id}-habits`, + name: "Task Genius: Habits", + } as PluginManifest); + this.ready = new Promise((resolve, reject) => { + this.resolveReady = resolve; + this.rejectReady = reject; + }); + } + + async onload(): Promise { + try { + await super.onload(); + this.resolveReady(); + } catch (error) { + this.rejectReady(error); + } + } + + onunload(): void { this.disposed = true; } + protected integrationActive(): boolean { return !this.disposed; } + + /** Read the previous plugin's non-secret configuration only on first use. */ + async loadData(): Promise | null> { + if (this.host.settings.habitsIntegration) { + return JSON.parse(JSON.stringify(this.host.settings.habitsIntegration)); + } + try { + const path = `${this.app.vault.configDir}/plugins/habits/data.json`; + const previous = JSON.parse(await this.app.vault.adapter.read(path)); + const { aiSummary, reminders, ...compatible } = previous; + // Keys and external writes require deliberate configuration in the host. + return compatible; + } catch { return null; } + } + + async saveData(data: HabitsPluginSettings): Promise { + this.host.settings.habitsIntegration = JSON.parse(JSON.stringify(data)); + await this.host.saveSettings(); + } + + addSettingTab(tab: PluginSettingTab): void { + this.embeddedSettings = tab as HabitsSettingTab; + } + + renderSettings(container: HTMLElement): void { + container.addClass("tg-habits-surface"); + if (this.embeddedSettings) { + this.embeddedSettings.containerEl = container; + this.embeddedSettings.display(); + } + } + + /** Always own prefixed blocks; claim legacy blocks only without Habits. */ + registerMarkdownCodeBlockProcessor( + language: string, + handler: Parameters[1], + sortOrder?: number, + ): ReturnType { + const scoped: typeof handler = (source, el, context) => { + el.addClass("tg-habits-surface"); + return handler(source, el, context); + }; + const result = super.registerMarkdownCodeBlockProcessor(`tg-${language}`, scoped, sortOrder); + if (this.backgroundSyncAllowed()) { + super.registerMarkdownCodeBlockProcessor(language, scoped, sortOrder); + } + return result; + } + + protected backgroundSyncAllowed(): boolean { + const plugins = (this.app as any).plugins; + return !this.disposed && this.host.settings.habit.enableHabits && !plugins?.enabledPlugins?.has("habits"); + } + + showCompatibilityNotice(container: HTMLElement): void { + if ((this.app as any).plugins?.enabledPlugins?.has("habits")) { + container.createEl("p", { + cls: "setting-item-description", + text: t("The standalone Habits plugin is enabled. Task Genius shares its notes; automatic reminders and note syncing are handled by Habits to avoid duplicate writes."), + }); + } + } +} diff --git a/src/integrations/habits/task-genius.css b/src/integrations/habits/task-genius.css new file mode 100644 index 000000000..14c95b49a --- /dev/null +++ b/src/integrations/habits/task-genius.css @@ -0,0 +1,17 @@ +.tg-habits-surface { + --habits-radius: var(--radius-m); + font-family: var(--font-interface); + color: var(--text-normal); +} +.tg-habits-surface .habits-card, +.tg-habits-surface .habits-compact-row, +.tg-habits-surface .habits-stat-tile { + border-radius: var(--radius-m); + border-color: var(--background-modifier-border); + box-shadow: none; +} +.tg-habits-surface .habits-settings-tabs { border-bottom: 1px solid var(--background-modifier-border); } +.tg-habits-surface .habits-settings-tab.is-active { color: var(--interactive-accent); } +.tg-habits-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 0; } +.tg-habits-toolbar h2 { flex: 1; margin: 0; } +.tg-habits-legacy { margin-top: 24px; border-top: 1px solid var(--background-modifier-border); padding-top: 12px; } diff --git a/src/integrations/habits/types.ts b/src/integrations/habits/types.ts new file mode 100644 index 000000000..d1efbb728 --- /dev/null +++ b/src/integrations/habits/types.ts @@ -0,0 +1,345 @@ +/** + * The four kinds of habit the plugin can track. + * + * - `binary`: done or not done on a given day. + * - `repetition`: a count towards a target (e.g. 8 cups of water). + * - `timed`: minutes spent towards a target (e.g. 30 minutes of exercise). + * - `note`: writing in a per-day note, completed by reaching a character + * count, satisfying a checklist requirement, or both. See the `note*` + * fields below. + */ +export type HabitType = "binary" | "repetition" | "timed" | "note"; + +/** + * How a `note` habit's day is marked complete. + * + * - `chars`: the note's character count (frontmatter stripped) reaches + * `target`. + * - `checklist`: the checklist requirement in {@link NoteChecklistRequirement} + * is met. + * - `both`: both of the above must be true. `records` stores the lower of + * the two fractions, scaled to `target` (the character goal), so the + * plugin's existing `value >= target` completion check only fires once + * neither condition is the bottleneck. + * + * Regardless of mode, a checked item matching `noteFailKeyword` (if set) + * forces the day to `0` — an automatic fail that overrides everything else. + */ +export type NoteCompletionMode = "chars" | "checklist" | "both"; + +/** + * How a `note` habit's checklist requirement is satisfied. + * + * - `all`: every task-list item must be checked. Stored as a 0–100 + * percentage in `records` (against a fixed `target` of 100), since the + * number of tasks can differ from day to day. + * - `count`: at least `noteChecklistMin` items must be checked — any of + * them, not a specific one. Stored as the raw checked count in `records` + * (against `target` = `noteChecklistMin`). Suits a checklist of + * alternatives (e.g. "cardio" / "weights" / "rest day") where doing any + * one of them counts. + */ +export type NoteChecklistRequirement = "all" | "count"; + +/** + * How often a habit is due. + * + * - `daily`: due every day (the original behaviour). + * - `weekly`: due on one or more chosen weekdays each week. + * - `monthly`: due once a month, on a chosen day of the month. + * - `interval`: due every N days, counted from the habit's start date + * (e.g. every 2 days for an alternate-day schedule). + * - `flexibleWeekly`: due a set number of times each week, on any day the + * user chooses (e.g. kayaking once a week, whichever day is free). + * For `max` habits this is a cumulative weekly limit instead. + * - `flexibleMonthly`: the same idea, scored over a calendar month. + * For `max` habits this is a cumulative monthly limit. + * + * `target` holds the "how many times" for the two flexible frequencies — + * see {@link HabitDefinition.target}. + */ +export type HabitFrequency = + | "daily" + | "weekly" + | "monthly" + | "interval" + | "flexibleWeekly" + | "flexibleMonthly"; + +/** + * Which way a habit's goal points. + * + * - `min`: reach a target — the classic habit (do at least this much). + * - `max`: stay under a limit — for habits being reduced or avoided + * (e.g. at most 2 hours of gaming, or no smoking at all). + * + * Absent from frontmatter means `min`, so every note written before this + * field existed keeps its original meaning untouched. + */ +export type GoalDirection = "min" | "max"; + +/** + * The base order of habit cards in the dashboard and side panel. + * + * - `name`: alphabetical by note name (the original behaviour). + * - `color`: by accent colour hue, so similar colours sit together. + * - `startDate`: oldest habit first — the order habits were created in. + * - `lastLogged`: most recently logged first. + * - `time`: by first planned time — the day's timeline; untimed habits last. + * - `group`: by group, following the arranged group order. + * - `manual`: the order the user arranged in settings. + */ +export type HabitSortMode = + | "name" + | "color" + | "startDate" + | "lastLogged" + | "time" + | "group" + | "manual"; + +/** + * Shared styling for a group, stored once in the plugin settings (keyed + * by group name) so every member card stays in step and renaming a + * habit's group re-links it instead of duplicating style per note. + */ +export interface GroupStyle { + /** Optional accent colour shared by the group ("" = none). */ + color: string; + /** Optional Lucide icon id or emoji shown in group lips and headers. */ + icon: string; +} + +/** + * A period during which a habit was paused (inclusive of both ends). + * An empty `end` means the pause is still ongoing. + */ +export interface HabitPause { + start: string; + end: string; +} + +/** + * A missed due day moved onto a different day (experimental). `from` stops + * counting as due; `to` — which must not already be due on its own — + * becomes due in its place and inherits its completion. Each date may + * appear in at most one reschedule, on one side only: chaining a + * rescheduled day into a second reschedule isn't supported. + */ +export interface HabitReschedule { + /** The original due date, `YYYY-MM-DD`, this instance was moved from. */ + from: string; + /** The date, `YYYY-MM-DD`, it was moved to. */ + to: string; +} + +/** + * A single habit, parsed from a note in the habits folder. + * + * The note's frontmatter holds the definition, and a `records` map holds the + * value logged for each day (keyed by `YYYY-MM-DD`). + */ +export interface HabitDefinition { + /** Path of the backing note. Used as a stable identifier. */ + path: string; + /** Display name, taken from the note's basename. */ + name: string; + /** The kind of habit. */ + type: HabitType; + /** + * Whether the goal is a target to reach (`min`) or a limit to stay + * under (`max`). For `max` habits `target` is the limit — `0` means + * "none at all" — and a binary `max` habit's limit is always `0` + * (any logged value is a slip). + */ + goalDirection: GoalDirection; + /** How often the habit is due. Defaults to `daily`. */ + frequency: HabitFrequency; + /** + * Days of the week a weekly habit is due, as JavaScript `getDay` values + * (`0` = Sunday … `6` = Saturday), sorted and without duplicates. Only + * meaningful when `frequency` is `weekly`. Stored in frontmatter as a + * scalar `weekday` when there is one day (the original format) or as a + * `weekdays` list when there are several. + */ + weekdays: number[]; + /** + * Day of the month a monthly habit is due (`1`–`31`). Only meaningful when + * `frequency` is `monthly`. In months shorter than the chosen day it is + * clamped to the last day of that month (so `31` acts as "last day"). + */ + monthDay: number; + /** + * Number of days between due dates (`2`–`365`), counted from the habit's + * start date. Only meaningful when `frequency` is `interval`; `2` gives an + * alternate-day schedule. + */ + intervalDays: number; + /** Fixed calendar cycle, or a new interval after actual completion. */ + intervalMode?: "fixed" | "completion"; + /** + * Optional times of day the habit is planned for, as 24-hour `HH:mm` + * strings, sorted and without duplicates — one entry for a once-a-day + * plan, several for e.g. twice-daily medication. Purely informational: + * they are shown alongside the schedule on the habit's card and never + * affect when the habit is due. Stored in frontmatter as a scalar + * `time` when there is one, or a `times` list when there are several. + * Empty means no planned time. + */ + times: string[]; + /** + * Daily target. For `repetition` this is a count; for `timed` it is a + * number of minutes. Ignored for `binary` — except when `frequency` is + * `flexibleWeekly`/`flexibleMonthly`, where `target` instead holds the + * number of times (for `binary`) or the cumulative amount (for + * `repetition`/`timed`) required somewhere within the period. + */ + target: number; + /** Optional unit label shown next to the value (e.g. "cups"). */ + unit: string; + /** + * How much one +/− press adds or removes for a `repetition` habit + * (e.g. 0.25 for litres). `1` by default; ignored for other types. See + * {@link stepOf}. + */ + step: number; + /** + * Optional weekly goal: the number of days the daily goal should be met. + * `0` means no target. Ignored when `weeklyPerfect` is true. + */ + weeklyTarget: number; + /** Optional monthly goal, interpreted like `weeklyTarget`. */ + monthlyTarget: number; + /** When true, the weekly goal is every day of the week. */ + weeklyPerfect: boolean; + /** When true, the monthly goal is every day of the month. */ + monthlyPerfect: boolean; + /** Optional Lucide icon id shown on the card. */ + icon: string; + /** Optional accent colour (any valid CSS colour). */ + color: string; + /** + * Optional group name used to build dashboard sections (e.g. an area + * of responsibility). Empty means ungrouped. + */ + group: string; + /** + * When true and the habit's group has a colour, the card is shown in + * the group colour instead of its own. + */ + useGroupColor: boolean; + /** + * Obsidian tags on the note (no leading `#`), stored in the note's + * native `tags` property rather than through the configurable + * frontmatter keys — useful for making a habit recognisable to another + * plugin's own tag-based rules, e.g. TaskNotes' task tag. + */ + tags: string[]; + /** Date the habit started, as `YYYY-MM-DD`. */ + startDate: string; + /** True while an open pause exists. Paused days are skipped by stats. */ + paused: boolean; + /** Every pause period recorded for the habit, including any open one. */ + pauses: HabitPause[]; + /** + * Missed due days moved onto a different day (experimental — + * `experimental.rescheduling`). See {@link HabitReschedule}. + */ + reschedules: HabitReschedule[]; + /** + * Days the user closed as failed ("Fail for today"), as `YYYY-MM-DD`. + * A failed day is hidden from that day's lists and always counts as a + * miss, even for a limit habit or a value logged earlier. Flexible + * habits only hide the card: one day can't fail a weekly quota. + */ + failed: string[]; + /** + * Days the user skipped ("Skip for today"), as `YYYY-MM-DD`. A skipped + * day is hidden and treated exactly like a one-day pause, so it never + * counts for or against the habit. + */ + skipped: string[]; + /** True when the habit is no longer tracked but keeps its history. */ + stopped: boolean; + /** Date tracking stopped, as `YYYY-MM-DD` (empty when tracking). */ + stopDate: string; + /** + * Logged values keyed by day (`YYYY-MM-DD`). + * + * - `binary`: `1` for done, `0`/absent for not done. + * - `repetition`: the count logged that day. + * - `timed`: the number of minutes logged that day. + */ + records: Record; + /** Per-day comments keyed by `YYYY-MM-DD`. */ + comments: Record; + /** + * Folder that holds this habit's per-day notes. Only meaningful when + * `type` is `note`. + */ + noteFolder: string; + /** + * Moment.js format used to name each day's note (e.g. `YYYY-MM-DD`). + * May contain `/` to file notes into date-based subfolders. Only + * meaningful when `type` is `note`. + */ + noteFilenameFormat: string; + /** + * Optional vault path of a template note applied when a day's note is + * created. Expanded through Templater when that plugin is installed; + * otherwise copied verbatim. Only meaningful when `type` is `note`. + */ + templatePath: string; + /** How a `note` habit's day is marked complete. */ + noteCompletionMode: NoteCompletionMode; + /** + * How a `note` habit's checklist requirement is satisfied. Only + * meaningful when `noteCompletionMode` is `checklist` or `both`. + */ + noteChecklistRequirement: NoteChecklistRequirement; + /** + * Minimum number of checklist items that must be checked when + * `noteChecklistRequirement` is `count`. + */ + noteChecklistMin: number; + /** + * Case-insensitive text a checklist item's label must contain, when + * checked, to force the day to fail regardless of every other + * condition (e.g. a "Slipped" item). Empty disables the feature. Only + * meaningful when `type` is `note`. + */ + noteFailKeyword: string; +} + +/** Options used when creating a new habit note. */ +export interface NewHabitOptions { + name: string; + type: HabitType; + goalDirection: GoalDirection; + frequency: HabitFrequency; + weekdays: number[]; + monthDay: number; + intervalDays: number; + /** Fixed calendar cycle, or a new interval after actual completion. */ + intervalMode?: "fixed" | "completion"; + times: string[]; + target: number; + unit: string; + step: number; + weeklyTarget: number; + monthlyTarget: number; + weeklyPerfect: boolean; + monthlyPerfect: boolean; + icon: string; + color: string; + group: string; + useGroupColor: boolean; + tags: string[]; + noteFolder: string; + noteFilenameFormat: string; + templatePath: string; + noteCompletionMode: NoteCompletionMode; + noteChecklistRequirement: NoteChecklistRequirement; + noteChecklistMin: number; + noteFailKeyword: string; +} diff --git a/src/integrations/habits/ui/chart-setup.ts b/src/integrations/habits/ui/chart-setup.ts new file mode 100644 index 000000000..0e4203e1f --- /dev/null +++ b/src/integrations/habits/ui/chart-setup.ts @@ -0,0 +1,32 @@ +import { + BarController, + BarElement, + CategoryScale, + Chart, + Filler, + LineController, + LineElement, + LinearScale, + PointElement, + Tooltip, +} from "chart.js"; +import { MatrixController, MatrixElement } from "chartjs-chart-matrix"; + +/** + * Registers every Chart.js component the plugin's charts and heatmaps use. + * Side-effect only: every file that draws a chart imports this once so + * registration happens regardless of which chart-drawing module loads first. + */ +Chart.register( + BarController, + BarElement, + CategoryScale, + Filler, + LineController, + LineElement, + LinearScale, + MatrixController, + MatrixElement, + PointElement, + Tooltip, +); diff --git a/src/integrations/habits/ui/color-utils.ts b/src/integrations/habits/ui/color-utils.ts new file mode 100644 index 000000000..24bdb50bc --- /dev/null +++ b/src/integrations/habits/ui/color-utils.ts @@ -0,0 +1,60 @@ +/** + * Resolve a CSS colour (including `var(...)` references and a habit's own + * accent) to a concrete `rgb(...)` value Chart.js can use. `root` anchors the + * probe element to the right document/window (relevant for popout windows). + */ +export function resolveColor( + root: HTMLElement, + preferred: string, + fallback: string, +): string { + const probe = root.doc.body.createSpan(); + probe.style.color = preferred || fallback; + const resolved = probe.win.getComputedStyle(probe).color; + probe.remove(); + return resolved || "#888888"; +} + +/** Apply an alpha channel to an `rgb(r, g, b)` colour string. */ +export function withAlpha(color: string, alpha: number): string { + const match = /^rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(color); + if (!match) { + return color; + } + return `rgba(${match[1]}, ${match[2]}, ${match[3]}, ${alpha})`; +} + +/** + * Perceptual brightness of an `rgb()`/`rgba()` colour, 0 (darkest) to 255 + * (lightest), via the fast "YIQ" approximation. Alpha is ignored — this + * reads the colour's own hue and lightness, not how transparent it is. + * Returns `null` when `color` isn't a parseable rgb(a) string (e.g. a + * keyword like `"transparent"`). + */ +function brightness(color: string): number | null { + const match = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(color); + if (!match) { + return null; + } + const [, r, g, b] = match.map(Number); + return (r * 299 + g * 587 + b * 114) / 1000; +} + +/** + * Pick whichever of near-white or near-black reads more clearly against + * both `fill` (what's drawn under the border) and `surrounding` (what's + * drawn around it — the page behind the gaps between cells/bars). Contrast + * against the fill alone isn't enough: a pale fill wants a dark border for + * contrast against *it*, but if the page itself is dark, that same dark + * border disappears into the gap right next to it. Picking whichever of + * white/black has the better *worst-case* contrast against the two (not + * just the fill) keeps the border visible against both at once. Unparsable + * colours (e.g. `"transparent"`) are treated as a neutral middle grey. + */ +export function contrastColor(fill: string, surrounding: string): string { + const fillB = brightness(fill) ?? 128; + const surroundB = brightness(surrounding) ?? 128; + const whiteContrast = Math.min(255 - fillB, 255 - surroundB); + const blackContrast = Math.min(fillB, surroundB); + return whiteContrast >= blackContrast ? "#fafafa" : "#1a1a1a"; +} diff --git a/src/integrations/habits/ui/comment-suggest.ts b/src/integrations/habits/ui/comment-suggest.ts new file mode 100644 index 000000000..0fd700538 --- /dev/null +++ b/src/integrations/habits/ui/comment-suggest.ts @@ -0,0 +1,346 @@ +import { + App, + Component, + TFile, + getAllTags, + prepareFuzzySearch, + renderResults, + setIcon, + type SearchResult, +} from "obsidian"; + +/** + * Autocomplete for the day-comment textarea. + * + * Obsidian's own `EditorSuggest` only attaches to CodeMirror editors and + * `AbstractInputSuggest` only to ``/contenteditable, so neither can + * drive a `