├── .hotreload ├── .npmrc ├── .eslintignore ├── screenshots └── ui-demo.png ├── test-vault ├── single-habits │ ├── no-frontmatter.md │ ├── empty-entries.md │ ├── minimal-habit.md │ ├── custom-color.md │ ├── irregular-pattern.md │ ├── special-chars-habit-名前.md │ └── long-streak.md ├── mixed-content │ ├── Regular Note.md │ └── Habit in Mixed.md ├── nested │ └── deep │ │ └── Very Deep Habit.md ├── broken-habits │ ├── invalid-dates.md │ ├── malformed-yaml.md │ ├── duplicate-entries.md │ └── corrupted-file.md ├── timezone-tests │ ├── dst-transition.md │ ├── midnight-boundary.md │ └── international-dates.md ├── habits │ ├── Meditation.md │ ├── Water Intake.md │ ├── Daily Exercise.md │ ├── Long Habit Name That Tests UI Wrapping.md │ └── Read Books.md ├── ⚡ Performance Tests.md ├── 🧪 Test Dashboard.md ├── README.md ├── 📊 Settings Matrix.md └── 🐛 Edge Cases.md ├── .editorconfig ├── manifest.json ├── .gitignore ├── tsconfig.json ├── .prettierrc ├── .eslintrc ├── versions.json ├── package.json ├── esbuild.config.mjs ├── TODO.md ├── src ├── utils.js ├── HabitTrackerError.svelte ├── Habit.svelte ├── HabitTracker.svelte └── main.ts ├── make-release.mjs ├── README.md ├── styles.css └── LICENSE /.hotreload: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | tag-version-prefix="" -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | 3 | main.js -------------------------------------------------------------------------------- /screenshots/ui-demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincplusplus/habit-tracker/HEAD/screenshots/ui-demo.png -------------------------------------------------------------------------------- /test-vault/single-habits/no-frontmatter.md: -------------------------------------------------------------------------------- 1 | # No Frontmatter Habit 2 | 3 | This habit file has no frontmatter at all. The plugin should handle this gracefully and show empty entries. -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | rootElement = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | insert_final_newline = true 8 | indent_style = tab 9 | indent_size = 2 10 | tab_width = 2 -------------------------------------------------------------------------------- /test-vault/mixed-content/Regular Note.md: -------------------------------------------------------------------------------- 1 | # Regular Note 2 | 3 | This is a regular note that should be ignored by the habit tracker when loading from this folder. 4 | 5 | It has no frontmatter with entries, so it's not a habit. -------------------------------------------------------------------------------- /test-vault/single-habits/empty-entries.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Empty Entries Test" 3 | entries: [] 4 | color: "#9b59b6" 5 | --- 6 | 7 | # Empty Entries 8 | 9 | This habit has an empty entries array. Should display with no checkmarks. -------------------------------------------------------------------------------- /test-vault/single-habits/minimal-habit.md: -------------------------------------------------------------------------------- 1 | --- 2 | entries: 3 | - "2024-11-17" 4 | - "2024-11-18" 5 | - "2024-11-19" 6 | --- 7 | 8 | # Minimal Habit 9 | 10 | This habit has the absolute minimum frontmatter required. -------------------------------------------------------------------------------- /test-vault/mixed-content/Habit in Mixed.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "📁 Mixed Folder Habit" 3 | entries: 4 | - "2024-11-17" 5 | - "2024-11-18" 6 | - "2024-11-19" 7 | color: "#16a085" 8 | --- 9 | 10 | # Habit in Mixed Content Folder 11 | 12 | This habit exists in a folder with other non-habit files to test folder filtering. -------------------------------------------------------------------------------- /test-vault/nested/deep/Very Deep Habit.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "🏔️ Very Deep Nested Habit" 3 | entries: 4 | - "2024-11-17" 5 | - "2024-11-18" 6 | - "2024-11-19" 7 | color: "#2c3e50" 8 | --- 9 | 10 | # Very Deep Nested Habit 11 | 12 | This habit tests deeply nested folder structures to ensure path resolution works correctly. -------------------------------------------------------------------------------- /test-vault/broken-habits/invalid-dates.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "🚫 Invalid Dates" 3 | entries: 4 | - "2024-13-99" 5 | - "not-a-date" 6 | - "2024/11/19" 7 | - "11-19-2024" 8 | - "2024-02-30" 9 | - "" 10 | - null 11 | color: "#c0392b" 12 | --- 13 | 14 | # Invalid Date Formats 15 | 16 | This habit contains various invalid date formats to test error handling. -------------------------------------------------------------------------------- /test-vault/single-habits/custom-color.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "🎨 Custom Color Test" 3 | entries: 4 | - "2024-11-15" 5 | - "2024-11-16" 6 | - "2024-11-17" 7 | - "2024-11-18" 8 | - "2024-11-19" 9 | color: "#f39c12" 10 | --- 11 | 12 | # Custom Color Habit 13 | 14 | This habit tests custom color functionality in frontmatter. Should override any global/tracker colors. -------------------------------------------------------------------------------- /test-vault/broken-habits/malformed-yaml.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Malformed YAML" 3 | entries: 4 | - "2024-11-17" 5 | - "2024-11-18" 6 | - nested item that breaks yaml 7 | - "2024-11-19" 8 | invalid: yaml: structure: here 9 | color: #missing-quotes 10 | --- 11 | 12 | # Malformed YAML 13 | 14 | This habit has intentionally broken YAML frontmatter to test error handling. -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "habit-tracker-21", 3 | "name": "Habit Tracker 21", 4 | "version": "2.2.2", 5 | "minAppVersion": "1.1.0", 6 | "description": "Your 21-day journey to habit formation, simplified", 7 | "author": "zincplusplus", 8 | "authorUrl": "https://github.com/zincplusplus", 9 | "isDesktopOnly": false, 10 | "fundingUrl": "https://buymeacoffee.com/zincplusplus" 11 | } -------------------------------------------------------------------------------- /test-vault/broken-habits/duplicate-entries.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "🔄 Duplicate Entries" 3 | entries: 4 | - "2024-11-17" 5 | - "2024-11-17" 6 | - "2024-11-18" 7 | - "2024-11-18" 8 | - "2024-11-18" 9 | - "2024-11-19" 10 | - "2024-11-17" 11 | color: "#f1c40f" 12 | --- 13 | 14 | # Duplicate Entries Test 15 | 16 | This habit has duplicate date entries to test deduplication handling. -------------------------------------------------------------------------------- /test-vault/broken-habits/corrupted-file.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "💥 Corrupted File" 3 | entries: 4 | - "2024-11-17" 5 | - "2024-11-18" 6 | ---INCOMPLETE FRONTMATTER SEPARATOR 7 | 8 | # Corrupted File 9 | 10 | This file has a corrupted frontmatter separator to test robust parsing. 11 | 12 | Some random binary-like content: 13 | ��������������� 14 | NULL byte test: 15 | EOF without proper ending -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # vscode 2 | .vscode 3 | release 4 | 5 | # Intellij 6 | *.iml 7 | .idea 8 | 9 | # npm 10 | node_modules 11 | 12 | # Don't include the compiled main.js file in the repo. 13 | # They should be uploaded to GitHub releases instead. 14 | main.js 15 | 16 | # Exclude sourcemaps 17 | *.map 18 | 19 | # obsidian 20 | data.json 21 | 22 | # Exclude macOS Finder (System Explorer) View States 23 | .DS_Store 24 | -------------------------------------------------------------------------------- /test-vault/single-habits/irregular-pattern.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "📊 Irregular Pattern" 3 | entries: 4 | - "2024-11-01" 5 | - "2024-11-04" 6 | - "2024-11-05" 7 | - "2024-11-09" 8 | - "2024-11-10" 9 | - "2024-11-11" 10 | - "2024-11-15" 11 | - "2024-11-19" 12 | color: "#8e44ad" 13 | --- 14 | 15 | # Irregular Pattern Habit 16 | 17 | This habit has an irregular completion pattern to test streak calculation edge cases. -------------------------------------------------------------------------------- /test-vault/timezone-tests/dst-transition.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "🕐 DST Transition Test" 3 | entries: 4 | - "2024-03-10" 5 | - "2024-03-11" 6 | - "2024-11-03" 7 | - "2024-11-04" 8 | color: "#e74c3c" 9 | --- 10 | 11 | # Daylight Saving Time Transition 12 | 13 | Test habit for daylight saving time transitions: 14 | - Spring forward (March 10, 2024) 15 | - Fall back (November 3, 2024) 16 | 17 | These dates test edge cases in date calculations. -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "inlineSourceMap": true, 5 | "inlineSources": true, 6 | "module": "ESNext", 7 | "target": "ES6", 8 | "allowJs": true, 9 | "noImplicitAny": false, 10 | "moduleResolution": "node", 11 | "importHelpers": true, 12 | "isolatedModules": true, 13 | "strictNullChecks": true, 14 | "lib": ["DOM", "ES5", "ES6", "ES7"], 15 | "types": ["svelte"] 16 | }, 17 | "include": ["**/*.ts", "**/*.svelte"] 18 | } 19 | -------------------------------------------------------------------------------- /test-vault/timezone-tests/midnight-boundary.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "🌙 Midnight Boundary Test" 3 | entries: 4 | - "2024-11-18" 5 | - "2024-11-19" 6 | color: "#34495e" 7 | --- 8 | 9 | # Midnight Boundary Test 10 | 11 | This habit is specifically for testing date calculations around midnight boundaries and timezone edge cases. 12 | 13 | Test scenarios: 14 | - Habit completed just before midnight 15 | - Habit completed just after midnight 16 | - Different timezones 17 | - Daylight saving time transitions -------------------------------------------------------------------------------- /test-vault/single-habits/special-chars-habit-名前.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "🌐 Unicode Test 你好世界 名前 José María" 3 | entries: 4 | - "2024-11-17" 5 | - "2024-11-18" 6 | - "2024-11-19" 7 | color: "#e67e22" 8 | --- 9 | 10 | # Unicode & Special Characters Test 11 | 12 | This habit tests: 13 | - Unicode characters in filename 14 | - Unicode characters in title 15 | - Special characters: José María 16 | - Chinese characters: 你好世界 17 | - Japanese characters: 名前 18 | - Emojis: 🌐🎯💫 19 | 20 | The plugin should handle all these gracefully. -------------------------------------------------------------------------------- /test-vault/timezone-tests/international-dates.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "🌍 International Dates" 3 | entries: 4 | - "2024-11-17" 5 | - "2024-11-18" 6 | - "2024-11-19" 7 | color: "#1abc9c" 8 | --- 9 | 10 | # International Date Format Test 11 | 12 | This habit tests various international date scenarios: 13 | 14 | ## Different Date Formats 15 | - ISO 8601: 2024-11-19 16 | - US Format: 11/19/2024 17 | - European: 19/11/2024 18 | - UK Format: 19-11-2024 19 | 20 | ## Timezone Considerations 21 | - UTC+14 (earliest timezone) 22 | - UTC-12 (latest timezone) 23 | - Various offset calculations -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "always", 3 | "bracketSameLine": false, 4 | "bracketSpacing": false, 5 | "semi": false, 6 | "experimentalTernaries": false, 7 | "singleQuote": true, 8 | "jsxSingleQuote": false, 9 | "quoteProps": "as-needed", 10 | "trailingComma": "all", 11 | "singleAttributePerLine": true, 12 | "htmlWhitespaceSensitivity": "css", 13 | "vueIndentScriptAndStyle": false, 14 | "proseWrap": "preserve", 15 | "insertPragma": false, 16 | "printWidth": 80, 17 | "requirePragma": false, 18 | "tabWidth": 2, 19 | "useTabs": true, 20 | "embeddedLanguageFormatting": "auto" 21 | } 22 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rootElement": true, 3 | "parser": "@typescript-eslint/parser", 4 | "env": {"node": true}, 5 | "plugins": ["@typescript-eslint"], 6 | "extends": [ 7 | "eslint:recommended", 8 | "plugin:@typescript-eslint/eslint-recommended", 9 | "plugin:@typescript-eslint/recommended" 10 | ], 11 | "parserOptions": { 12 | "sourceType": "module" 13 | }, 14 | "rules": { 15 | "no-unused-vars": "off", 16 | "@typescript-eslint/no-unused-vars": ["error", {"args": "none"}], 17 | "@typescript-eslint/ban-ts-comment": "off", 18 | "no-prototype-builtins": "off", 19 | "@typescript-eslint/no-empty-function": "off" 20 | } 21 | } -------------------------------------------------------------------------------- /test-vault/habits/Meditation.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 🧘 Meditation 3 | entries: 4 | - 2024-11-01 5 | - 2024-11-02 6 | - 2024-11-05 7 | - 2024-11-06 8 | - 2024-11-08 9 | - 2024-11-09 10 | - 2024-11-12 11 | - 2024-11-13 12 | - 2024-11-15 13 | - 2024-11-16 14 | - 2024-11-19 15 | - 2025-11-16 16 | - 2025-11-17 17 | color: "#95a5a6" 18 | --- 19 | 20 | # Daily Meditation Practice 21 | 22 | 10 minutes of mindfulness meditation each morning. 23 | 24 | ## Techniques Used 25 | - Breath awareness 26 | - Body scan 27 | - Loving-kindness 28 | - Walking meditation 29 | 30 | ## Progress 31 | - Started with 5 minutes 32 | - Now comfortable with 10 minutes 33 | - Goal: 15 minutes by end of year -------------------------------------------------------------------------------- /versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "1.0.0": "1.1.0", 3 | "1.0.1": "1.1.0", 4 | "1.0.2": "1.1.0", 5 | "1.0.3": "1.1.0", 6 | "1.1.0": "1.1.0", 7 | "1.1.1": "1.1.0", 8 | "1.1.2": "1.1.0", 9 | "1.1.3": "1.1.0", 10 | "1.1.4": "1.1.0", 11 | "1.1.5": "1.1.0", 12 | "1.2.0": "1.1.0", 13 | "1.2.1": "1.1.0", 14 | "1.3.0": "1.1.0", 15 | "1.4.0": "1.1.0", 16 | "1.4.1": "1.1.0", 17 | "1.4.2": "1.1.0", 18 | "1.4.3": "1.1.0", 19 | "1.4.4": "1.1.0", 20 | "1.4.5": "1.1.0", 21 | "1.5.0": "1.1.0", 22 | "2.0.0": "1.1.0", 23 | "2.0.1": "1.1.0", 24 | "2.0.2": "1.1.0", 25 | "2.1.0": "1.1.0", 26 | "2.1.1": "1.1.0", 27 | "2.1.2": "1.1.0", 28 | "2.1.3": "1.1.0", 29 | "2.1.4": "1.1.0", 30 | "2.2.0": "1.1.0", 31 | "2.2.1": "1.1.0", 32 | "2.2.2": "1.1.0" 33 | } -------------------------------------------------------------------------------- /test-vault/habits/Water Intake.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 💧 Water Intake 3 | entries: 4 | - 2024-11-01 5 | - 2024-11-02 6 | - 2024-11-03 7 | - 2024-11-05 8 | - 2024-11-06 9 | - 2024-11-07 10 | - 2024-11-08 11 | - 2024-11-10 12 | - 2024-11-11 13 | - 2024-11-12 14 | - 2024-11-13 15 | - 2024-11-14 16 | - 2024-11-16 17 | - 2024-11-17 18 | - 2024-11-18 19 | - 2024-11-19 20 | - 2025-11-14 21 | - 2025-11-15 22 | color: "#3498db" 23 | --- 24 | 25 | # Daily Water Goal 26 | 27 | Drink at least 8 glasses of water per day. 28 | 29 | ## Tracking Method 30 | - ✅ = 8+ glasses 31 | - Track using phone app 32 | - Morning reminder set 33 | 34 | ## Benefits Noticed 35 | - Better energy levels 36 | - Clearer skin 37 | - Less afternoon fatigue -------------------------------------------------------------------------------- /test-vault/habits/Daily Exercise.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 💪 Daily Exercise 3 | entries: 4 | - 2024-11-01 5 | - 2024-11-03 6 | - 2024-11-04 7 | - 2024-11-05 8 | - 2024-11-07 9 | - 2024-11-08 10 | - 2024-11-09 11 | - 2024-11-11 12 | - 2024-11-12 13 | - 2024-11-14 14 | - 2024-11-15 15 | - 2024-11-16 16 | - 2024-11-17 17 | - 2024-11-18 18 | - 2024-11-19 19 | - 2025-10-13 20 | - 2025-11-18 21 | - 2025-11-19 22 | color: "#ff6b6b" 23 | --- 24 | 25 | # Daily Exercise Routine 26 | 27 | My goal is to exercise for at least 30 minutes every day. 28 | 29 | ## Workout Types 30 | - Cardio (running, cycling) 31 | - Strength training 32 | - Yoga 33 | - Swimming 34 | 35 | ## Notes 36 | - Missed a few days due to travel 37 | - Need to be more consistent on weekends -------------------------------------------------------------------------------- /test-vault/habits/Long Habit Name That Tests UI Wrapping.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 🎯 This is an Extremely Long Habit Name That Should Test How The UI Handles Text Wrapping and Display Issues 3 | entries: 4 | - 2024-11-15 5 | - 2024-11-16 6 | - 2024-11-17 7 | - 2024-11-18 8 | - 2024-11-19 9 | - 2025-11-17 10 | - 2025-11-18 11 | color: "#e74c3c" 12 | --- 13 | 14 | # Long Habit Name Test 15 | 16 | This habit is specifically designed to test how the UI handles very long habit names. 17 | 18 | ## UI Testing Points 19 | - Name wrapping in the habit tracker grid 20 | - Tooltip display 21 | - Settings panel handling 22 | - Mobile responsive behavior 23 | 24 | ## Expected Behavior 25 | - Text should wrap gracefully 26 | - UI should remain functional 27 | - No layout breaking -------------------------------------------------------------------------------- /test-vault/habits/Read Books.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 📚 Read Books 3 | entries: 4 | - 2024-11-01 5 | - 2024-11-02 6 | - 2024-11-03 7 | - 2024-11-04 8 | - 2024-11-05 9 | - 2024-11-06 10 | - 2024-11-07 11 | - 2024-11-08 12 | - 2024-11-09 13 | - 2024-11-10 14 | - 2024-11-11 15 | - 2024-11-12 16 | - 2024-11-13 17 | - 2024-11-14 18 | - 2024-11-15 19 | - 2024-11-16 20 | - 2024-11-17 21 | - 2024-11-18 22 | - 2024-11-19 23 | - 2025-11-15 24 | - 2025-11-16 25 | color: "#4ecdc4" 26 | --- 27 | 28 | # Daily Reading 29 | 30 | Read for at least 20 minutes every day. 31 | 32 | ## Current Books 33 | - The Pragmatic Programmer 34 | - Atomic Habits 35 | - Clean Code 36 | 37 | ## Reading Stats 38 | - Perfect streak this month! 39 | - Average: 45 minutes per day -------------------------------------------------------------------------------- /test-vault/single-habits/long-streak.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "🔥 Long Streak Test" 3 | entries: 4 | - "2024-10-01" 5 | - "2024-10-02" 6 | - "2024-10-03" 7 | - "2024-10-04" 8 | - "2024-10-05" 9 | - "2024-10-06" 10 | - "2024-10-07" 11 | - "2024-10-08" 12 | - "2024-10-09" 13 | - "2024-10-10" 14 | - "2024-10-11" 15 | - "2024-10-12" 16 | - "2024-10-13" 17 | - "2024-10-14" 18 | - "2024-10-15" 19 | - "2024-10-16" 20 | - "2024-10-17" 21 | - "2024-10-18" 22 | - "2024-10-19" 23 | - "2024-10-20" 24 | - "2024-10-21" 25 | - "2024-10-22" 26 | - "2024-10-23" 27 | - "2024-10-24" 28 | - "2024-10-25" 29 | - "2024-10-26" 30 | - "2024-10-27" 31 | - "2024-10-28" 32 | - "2024-10-29" 33 | - "2024-10-30" 34 | - "2024-10-31" 35 | - "2024-11-01" 36 | - "2024-11-02" 37 | - "2024-11-03" 38 | - "2024-11-04" 39 | - "2024-11-05" 40 | - "2024-11-06" 41 | - "2024-11-07" 42 | - "2024-11-08" 43 | - "2024-11-09" 44 | - "2024-11-10" 45 | - "2024-11-11" 46 | - "2024-11-12" 47 | - "2024-11-13" 48 | - "2024-11-14" 49 | - "2024-11-15" 50 | - "2024-11-16" 51 | - "2024-11-17" 52 | - "2024-11-18" 53 | - "2024-11-19" 54 | color: "#27ae60" 55 | --- 56 | 57 | # Long Streak Habit 58 | 59 | This habit has a very long streak (50+ days) to test streak calculation performance and display. -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "habit-tracker-21-dev", 3 | "version": "2.0.2", 4 | "description": "A minimalist, elegant habit tracker for Obsidian that helps you build lasting habits with clear progress visualization.", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "node esbuild.config.mjs", 8 | "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", 9 | "version": "node version-bump.mjs && git add manifest.json versions.json" 10 | }, 11 | "keywords": [], 12 | "author": "zoreet", 13 | "license": "MIT", 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/zoreet/habit-tracker.git" 17 | }, 18 | "bugs": { 19 | "url": "https://github.com/zoreet/habit-tracker/issues" 20 | }, 21 | "homepage": "https://github.com/zoreet/habit-tracker#readme", 22 | "devDependencies": { 23 | "@tsconfig/svelte": "^5.0.4", 24 | "@types/node": "^16.11.6", 25 | "@typescript-eslint/eslint-plugin": "5.29.0", 26 | "@typescript-eslint/parser": "5.29.0", 27 | "builtin-modules": "3.3.0", 28 | "esbuild": "0.17.3", 29 | "esbuild-svelte": "^0.8.0", 30 | "fs-extra": "^11.2.0", 31 | "obsidian": "latest", 32 | "svelte": "^4.2.17", 33 | "svelte-preprocess": "^5.1.4", 34 | "tslib": "2.4.0", 35 | "typescript": "^5.4.5" 36 | }, 37 | "dependencies": { 38 | "date-fns": "^3.6.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /esbuild.config.mjs: -------------------------------------------------------------------------------- 1 | import esbuild from 'esbuild' 2 | import process from 'process' 3 | import builtins from 'builtin-modules' 4 | import esbuildSvelte from 'esbuild-svelte' 5 | import sveltePreprocess from 'svelte-preprocess' 6 | 7 | const banner = `/* 8 | THIS IS A GENERATED/BUNDLED FILE BY ESBUILD 9 | if you want to view the source, please visit the github repository of this plugin 10 | */ 11 | ` 12 | 13 | const prod = process.argv[2] === 'production' 14 | 15 | const context = await esbuild.context({ 16 | banner: { 17 | js: banner, 18 | }, 19 | entryPoints: ['src/main.ts'], 20 | bundle: true, 21 | external: [ 22 | 'obsidian', 23 | 'electron', 24 | '@codemirror/autocomplete', 25 | '@codemirror/collab', 26 | '@codemirror/commands', 27 | '@codemirror/language', 28 | '@codemirror/lint', 29 | '@codemirror/search', 30 | '@codemirror/state', 31 | '@codemirror/view', 32 | '@lezer/common', 33 | '@lezer/highlight', 34 | '@lezer/lr', 35 | ...builtins, 36 | ], 37 | format: 'cjs', 38 | target: 'es2018', 39 | logLevel: 'info', 40 | sourcemap: prod ? false : 'inline', 41 | treeShaking: true, 42 | outfile: 'main.js', 43 | plugins: [ 44 | esbuildSvelte({ 45 | compilerOptions: {css: 'injected'}, 46 | preprocess: sveltePreprocess(), 47 | }), 48 | ], 49 | }) 50 | 51 | if (prod) { 52 | await context.rebuild() 53 | process.exit(0) 54 | } else { 55 | await context.watch() 56 | } -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | ## Critical Fixes (Do Now) 2 | - Fix date mutation bug in streak calculation (Habit.svelte:87) 3 | - Add missing `let` to variable declaration (Habit.svelte:117) 4 | - Clean up event listeners in `onDestroy` to prevent memory leaks 5 | - ✅ Fix daysToShow off-by-one error (already fixed) 6 | 7 | ## Quality Improvements (Next Sprint) 8 | - Migrate utils.js to TypeScript for better type safety 9 | - Add error boundaries for better user experience 10 | - Optimize reactive computations in Habit component 11 | - Convert manual DOM action bar to Svelte component 12 | - Add keyboard navigation and basic accessibility 13 | 14 | ## Feature Backlog 15 | - Show streak even if it's starting from before the displayed days 16 | - Pass Today as a variable instead of using new Date() 17 | - Auto switch to new day at midnight 18 | - Allow user to create a habit from the tracker 19 | - Show only habits that have activity in recent period 20 | - Add dashboard for each habit with stats (current streak, avg streak, best streak, avg completion rate etc) 21 | - Batch file operations for better performance with large habit folders 22 | 23 | ## Nice to Have 24 | - Add comprehensive test suite 25 | - Implement proper CSS design system 26 | - Add RTL language support 27 | - Performance monitoring and optimization 28 | - Add habit templates and quick-create workflows 29 | 30 | ## Done 31 | 32 | - make it work in reading mode 33 | - publish it 34 | - readme/tutorial 35 | - allow user to specify the path 36 | - make it work in portrait mode 37 | - error handling 38 | -------------------------------------------------------------------------------- /src/utils.js: -------------------------------------------------------------------------------- 1 | import { 2 | format, 3 | parseISO, 4 | isToday, 5 | } from 'date-fns'; 6 | 7 | const getDateAsString = function(date) { 8 | const dateObj = typeof date === 'string' ? parseISO(date) : date; 9 | return format(dateObj, 'yyyy-MM-dd') 10 | } 11 | 12 | const getDayOfTheWeek = function(date) { 13 | return format(parseISO(date),'EEEE').toLowerCase(); 14 | } 15 | 16 | // TODO make it somehow that i don't have to pass the debug level every time? 17 | // TODO add different levels of debugging, store them in a object or something so they have labels maybe? 18 | const debugLog = function(message, currentDebugLevel, requiredLevel, pluginName = 'Habit Tracker 21') { 19 | if(!currentDebugLevel) return null; 20 | 21 | if(requiredLevel && requiredLevel!==currentDebugLevel) return null; 22 | 23 | console.log(`[${pluginName}]`, message); 24 | } 25 | 26 | const pluralize = function(count, singular, plural) { 27 | if (count === 1) return singular 28 | return plural || singular + 's' 29 | } 30 | 31 | const renderPrettyDate = function (dateString) { 32 | // Parse the input date string into a Date object 33 | const date = parseISO(dateString) 34 | 35 | // Format the date using date-fns 36 | let prettyDate = format(date, 'MMMM d, yyyy') 37 | 38 | if (isToday(date)) { 39 | prettyDate = `Today, ${prettyDate}` 40 | } 41 | 42 | return prettyDate 43 | } 44 | 45 | const isValidCSSColor = function (color) { 46 | if (!color) return false 47 | const tempEl = document.createElement('div') 48 | tempEl.style.color = color 49 | return tempEl.style.color !== '' 50 | } 51 | 52 | export { 53 | getDateAsString, 54 | getDayOfTheWeek, 55 | debugLog, 56 | renderPrettyDate, 57 | pluralize, 58 | isValidCSSColor 59 | }; 60 | -------------------------------------------------------------------------------- /test-vault/⚡ Performance Tests.md: -------------------------------------------------------------------------------- 1 | # ⚡ Performance Tests 2 | 3 | This page tests performance with large data sets and extreme configurations. 4 | 5 | ## Large Habit Collection 6 | 7 | ```habittracker 8 | { 9 | "path": "test-vault/habits", 10 | "daysToShow": 365, 11 | "debug": false, 12 | "showStreaks": true 13 | } 14 | ``` 15 | 16 | ## Stress Test - Many Days 17 | 18 | ```habittracker 19 | { 20 | "path": "test-vault/single-habits/long-streak.md", 21 | "daysToShow": 365, 22 | "debug": false 23 | } 24 | ``` 25 | 26 | ## Minimal Performance Test 27 | 28 | ```habittracker 29 | { 30 | "path": "test-vault/habits", 31 | "daysToShow": 1, 32 | "debug": false, 33 | "showStreaks": false, 34 | "matchLineLength": false 35 | } 36 | ``` 37 | 38 | ## Maximum Settings Test 39 | 40 | ```habittracker 41 | { 42 | "path": "test-vault/habits", 43 | "daysToShow": 1000, 44 | "debug": true, 45 | "showStreaks": true, 46 | "matchLineLength": true, 47 | "color": "#ff0000" 48 | } 49 | ``` 50 | 51 | ## Performance Metrics to Monitor 52 | 53 | ### Loading Time 54 | 55 | - [ ] < 100ms for 5 habits, 21 days 56 | - [ ] < 500ms for 20 habits, 90 days 57 | - [ ] < 2s for 50 habits, 365 days 58 | 59 | ### Memory Usage 60 | 61 | - [ ] No significant memory leaks 62 | - [ ] Reasonable memory consumption 63 | - [ ] Cleanup on component destroy 64 | 65 | ### Responsiveness 66 | 67 | - [ ] Smooth scrolling 68 | - [ ] Quick habit toggling 69 | - [ ] No UI blocking 70 | 71 | ### Large Data Sets 72 | 73 | - [ ] 100+ habits load correctly 74 | - [ ] 1000+ day ranges work 75 | - [ ] 10,000+ entries per habit 76 | 77 | ## Performance Notes 78 | 79 | Record performance observations here: 80 | 81 | - Loading time with different configurations 82 | - Memory usage patterns 83 | - Any noticeable lag or delays 84 | - Browser/device specific issues 85 | 86 | ## Optimization Opportunities 87 | 88 | Areas identified for potential optimization: 89 | 90 | 1. **Date Calculations**: 91 | 2. **Reactivity**: 92 | 3. **DOM Updates**: 93 | 4. **File I/O**: 94 | -------------------------------------------------------------------------------- /test-vault/🧪 Test Dashboard.md: -------------------------------------------------------------------------------- 1 | # 🧪 Habit Tracker Test Dashboard 2 | 3 | This vault tests all functionality of the Habit Tracker 21 plugin. 4 | 5 | ## 📋 Quick Tests 6 | 7 | ### Basic Functionality 8 | 9 | ```habittracker 10 | { 11 | "path": "test-vault/habits", 12 | "daysToShow": 21, 13 | "debug": true 14 | } 15 | ``` 16 | 17 | ### Single File Test 18 | 19 | ```habittracker 20 | { 21 | "path": "test-vault/single-habits/minimal-habit.md", 22 | "daysToShow": 14, 23 | "debug": true 24 | } 25 | ``` 26 | 27 | ### Custom Settings 28 | 29 | ```habittracker 30 | { 31 | "path": "test-vault/habits", 32 | "daysToShow": 7, 33 | "color": "#ff6b6b", 34 | "showStreaks": true, 35 | "matchLineLength": false, 36 | "debug": true 37 | } 38 | ``` 39 | 40 | ### Empty Folder Test 41 | 42 | ```habittracker 43 | { 44 | "path": "test-vault/empty-folder", 45 | "debug": true 46 | } 47 | ``` 48 | 49 | ### Invalid Path Test 50 | 51 | ```habittracker 52 | { 53 | "path": "test-vault/nonexistent-folder", 54 | "debug": true 55 | } 56 | ``` 57 | 58 | ## 🎯 Test Checklist 59 | 60 | ### Core Features 61 | 62 | - [ ] Habits load and display correctly 63 | - [ ] Clicking toggles habit state 64 | - [ ] Changes save to files 65 | - [ ] External changes update display 66 | - [ ] Streaks calculate correctly 67 | - [ ] Weekend highlighting works 68 | 69 | ### Settings 70 | 71 | - [ ] Path setting works (file and folder) 72 | - [ ] daysToShow affects display 73 | - [ ] Color customization works 74 | - [ ] Debug output appears in console 75 | - [ ] matchLineLength affects width 76 | - [ ] showStreaks toggles streak display 77 | 78 | ### Error Handling 79 | 80 | - [ ] Invalid paths show clear errors 81 | - [ ] Malformed JSON shows helpful messages 82 | - [ ] Recovery works after fixing errors 83 | - [ ] Empty folders handled gracefully 84 | 85 | ### Performance 86 | 87 | - [ ] Large habit lists load quickly 88 | - [ ] Long date ranges render smoothly 89 | - [ ] No lag when toggling habits 90 | 91 | ## 🐛 Known Issues to Test 92 | 93 | 1. Date calculation edge cases 94 | 2. Timezone handling 95 | 3. Memory leak prevention 96 | 4. Theme compatibility 97 | -------------------------------------------------------------------------------- /test-vault/README.md: -------------------------------------------------------------------------------- 1 | # 🧪 Habit Tracker Test Vault 2 | 3 | This vault provides comprehensive testing for the Habit Tracker 21 plugin. 4 | 5 | ## 🎯 How to Use This Test Vault 6 | 7 | 1. **Install the Plugin**: Install Habit Tracker 21 in this vault 8 | 2. **Open Test Dashboard**: Start with `🧪 Test Dashboard.md` 9 | 3. **Run Through Tests**: Follow the checklists in each test file 10 | 4. **Report Issues**: Document any bugs or unexpected behavior 11 | 12 | ## 📁 Test File Structure 13 | 14 | | File | Purpose | 15 | |------|---------| 16 | | `🧪 Test Dashboard.md` | Main test page with core functionality | 17 | | `📊 Settings Matrix.md` | All settings combinations | 18 | | `🐛 Edge Cases.md` | Error handling and edge cases | 19 | | `⚡ Performance Tests.md` | Large data sets and performance | 20 | 21 | ## 📂 Test Folders 22 | 23 | | Folder | Contents | 24 | |--------|----------| 25 | | `habits/` | Main test habits with various configurations | 26 | | `single-habits/` | Individual habit files for specific tests | 27 | | `broken-habits/` | Files with intentional errors | 28 | | `timezone-tests/` | Timezone and date edge cases | 29 | | `mixed-content/` | Folder with habits + other files | 30 | | `nested/deep/` | Deep folder structure test | 31 | | `empty-folder/` | Empty folder test | 32 | 33 | ## ✅ Testing Checklist 34 | 35 | ### Core Functionality 36 | - [ ] Habits display correctly 37 | - [ ] Clicking toggles work 38 | - [ ] File changes persist 39 | - [ ] Streaks calculate properly 40 | - [ ] External file changes update UI 41 | 42 | ### Settings & Configuration 43 | - [ ] All boolean combinations work 44 | - [ ] Path settings (file vs folder) work 45 | - [ ] Color customization works 46 | - [ ] Days to show affects display 47 | - [ ] Debug mode shows console output 48 | 49 | ### Error Handling 50 | - [ ] Invalid JSON shows clear errors 51 | - [ ] Missing files handled gracefully 52 | - [ ] Malformed YAML recovers properly 53 | - [ ] Plugin recovers after fixing errors 54 | 55 | ### Edge Cases 56 | - [ ] Unicode characters display 57 | - [ ] Very long habit names wrap 58 | - [ ] Empty folders show messages 59 | - [ ] Large data sets perform well 60 | 61 | ### Cross-Platform 62 | - [ ] Light/dark themes work 63 | - [ ] Mobile responsive 64 | - [ ] Different screen sizes 65 | - [ ] Various browsers 66 | 67 | ## 🐛 Bug Reporting 68 | 69 | When you find issues, please document: 70 | 71 | 1. **What you did**: Specific steps to reproduce 72 | 2. **What you expected**: Expected behavior 73 | 3. **What happened**: Actual behavior 74 | 4. **Environment**: OS, Obsidian version, plugin version 75 | 5. **Console errors**: Any JavaScript errors 76 | 6. **Test file**: Which test file/configuration 77 | 78 | ## 📝 Test Results Template 79 | 80 | ``` 81 | ## Test Session: [Date] 82 | 83 | **Environment:** 84 | - OS: 85 | - Obsidian: 86 | - Plugin Version: 87 | 88 | **Results:** 89 | - ✅ Core functionality works 90 | - ❌ Settings matrix has issue with... 91 | - ⚠️ Performance degrades with... 92 | 93 | **Issues Found:** 94 | 1. Issue description... 95 | 2. Another issue... 96 | 97 | **Notes:** 98 | Additional observations... 99 | ``` 100 | 101 | ## 🎯 Advanced Testing 102 | 103 | For thorough testing: 104 | 105 | 1. **Test on multiple platforms** (Windows, Mac, Linux, mobile) 106 | 2. **Test with different themes** (light, dark, community themes) 107 | 3. **Test with large data sets** (100+ habits, 365+ days) 108 | 4. **Test concurrent usage** (multiple habit trackers on same page) 109 | 5. **Test integration** (with other plugins, sync services) 110 | 111 | ## 📞 Support 112 | 113 | If you need help with testing or find issues: 114 | - Check the plugin documentation 115 | - Review console errors (F12 → Console) 116 | - Test with debug mode enabled 117 | - Try minimal test cases first -------------------------------------------------------------------------------- /make-release.mjs: -------------------------------------------------------------------------------- 1 | import {readFileSync, writeFileSync} from 'fs' 2 | import fs from 'fs-extra' 3 | import {exec} from 'child_process' 4 | import {promisify} from 'util' 5 | 6 | const execAsync = promisify(exec) 7 | 8 | const versionArg = process.argv[2] 9 | 10 | // Read current version from manifest 11 | const currentManifest = JSON.parse(readFileSync('manifest.json', 'utf8')) 12 | const currentVersion = currentManifest.version 13 | const [major, minor, patch] = currentVersion.split('.').map(Number) 14 | 15 | let targetVersion 16 | 17 | // Check if it's a semantic version type or explicit version 18 | const targetVersionPattern = /^[0-9]+\.[0-9]+\.[0-9]+$/ 19 | if (targetVersionPattern.test(versionArg)) { 20 | // Explicit version provided (existing behavior) 21 | targetVersion = versionArg 22 | } else if (versionArg === 'major') { 23 | targetVersion = `${major + 1}.0.0` 24 | } else if (versionArg === 'minor') { 25 | targetVersion = `${major}.${minor + 1}.0` 26 | } else if (versionArg === 'fix' || versionArg === 'patch') { 27 | targetVersion = `${major}.${minor}.${patch + 1}` 28 | } else { 29 | console.log(`Invalid argument: ${versionArg}`) 30 | console.log('') 31 | console.log('Usage: node make-release.mjs ') 32 | console.log('') 33 | console.log('Where can be:') 34 | console.log(' major - Bump major version (e.g., 2.2.0 → 3.0.0)') 35 | console.log(' minor - Bump minor version (e.g., 2.2.0 → 2.3.0)') 36 | console.log(' fix | patch - Bump patch version (e.g., 2.2.0 → 2.2.1)') 37 | console.log(' 1.2.3 - Set specific version') 38 | console.log('') 39 | console.log(`Current version: ${currentVersion}`) 40 | process.exit(1) 41 | } 42 | 43 | console.log(`Bumping version from ${currentVersion} to ${targetVersion}`) 44 | // read minAppVersion from manifest.json and bump version to target version 45 | let manifest = JSON.parse(readFileSync('manifest.json', 'utf8')) 46 | const {minAppVersion} = manifest 47 | manifest.version = targetVersion 48 | writeFileSync('manifest.json', JSON.stringify(manifest, null, '\t')) 49 | console.log(`bumped manifest.json to version ${targetVersion}`) 50 | 51 | // update versions.json with target version and minAppVersion from manifest.json 52 | let versions = JSON.parse(readFileSync('versions.json', 'utf8')) 53 | versions[targetVersion] = minAppVersion 54 | writeFileSync('versions.json', JSON.stringify(versions, null, '\t')) 55 | console.log(`bumped versions.json to version ${targetVersion}`) 56 | 57 | async function makeRelease() { 58 | try { 59 | // Build the project first 60 | console.log('Building project...') 61 | await execAsync('npm run build') 62 | console.log('Build completed successfully') 63 | 64 | // make a folder with the files 65 | const destinationFolder = './release' 66 | 67 | await fs.remove(destinationFolder) 68 | console.log(`Removed ${destinationFolder} folder`) 69 | 70 | await fs.ensureDir(destinationFolder) 71 | console.log(`Created ${destinationFolder} folder`) 72 | 73 | await fs.copy(`./main.js`, `${destinationFolder}/main.js`) 74 | console.log('main.js copied successfully') 75 | 76 | await fs.copy(`./styles.css`, `${destinationFolder}/styles.css`) 77 | console.log('styles.css copied successfully') 78 | 79 | await fs.copy(`./manifest.json`, `${destinationFolder}/manifest.json`) 80 | console.log('manifest.json copied successfully') 81 | 82 | await fs.copy(`./versions.json`, `${destinationFolder}/versions.json`) 83 | console.log('versions.json copied successfully') 84 | 85 | // Create git tag 86 | console.log('Creating git tag...') 87 | await execAsync(`git tag ${targetVersion}`) 88 | console.log(`✅ Git tag ${targetVersion} created successfully`) 89 | console.log(`\nTo push the tag when ready, run:`) 90 | console.log(` git push origin ${targetVersion}`) 91 | 92 | // open the folder so I can drop it into github 93 | exec('open ./release') 94 | } catch (err) { 95 | console.error('Error:', err) 96 | process.exit(1) 97 | } 98 | } 99 | 100 | makeRelease() 101 | -------------------------------------------------------------------------------- /test-vault/📊 Settings Matrix.md: -------------------------------------------------------------------------------- 1 | # 📊 Settings Matrix Test 2 | 3 | This page tests all combinations of settings to ensure they work correctly. 4 | 5 | ## Boolean Combinations (8 total) 6 | 7 | ### All True 8 | 9 | ```habittracker 10 | { 11 | "path": "test-vault/habits", 12 | "daysToShow": 21, 13 | "debug": true, 14 | "showStreaks": true, 15 | "matchLineLength": true 16 | } 17 | ``` 18 | 19 | ### All False 20 | 21 | ```habittracker 22 | { 23 | "path": "test-vault/habits", 24 | "daysToShow": 21, 25 | "debug": false, 26 | "showStreaks": false, 27 | "matchLineLength": false 28 | } 29 | ``` 30 | 31 | ### Debug Only 32 | 33 | ```habittracker 34 | { 35 | "path": "test-vault/habits", 36 | "daysToShow": 21, 37 | "debug": true, 38 | "showStreaks": false, 39 | "matchLineLength": false 40 | } 41 | ``` 42 | 43 | ### Streaks Only 44 | 45 | ```habittracker 46 | { 47 | "path": "test-vault/habits", 48 | "daysToShow": 21, 49 | "debug": false, 50 | "showStreaks": true, 51 | "matchLineLength": false 52 | } 53 | ``` 54 | 55 | ### Match Line Length Only 56 | 57 | ```habittracker 58 | { 59 | "path": "test-vault/habits", 60 | "daysToShow": 21, 61 | "debug": false, 62 | "showStreaks": false, 63 | "matchLineLength": true 64 | } 65 | ``` 66 | 67 | ## Days to Show Variations 68 | 69 | ### Minimal (1 day) 70 | 71 | ```habittracker 72 | { 73 | "path": "test-vault/habits", 74 | "daysToShow": 1, 75 | "debug": true 76 | } 77 | ``` 78 | 79 | ### Week View (7 days) 80 | 81 | ```habittracker 82 | { 83 | "path": "test-vault/habits", 84 | "daysToShow": 7, 85 | "debug": true 86 | } 87 | ``` 88 | 89 | ### Default (21 days) 90 | 91 | ```habittracker 92 | { 93 | "path": "test-vault/habits", 94 | "daysToShow": 21, 95 | "debug": true 96 | } 97 | ``` 98 | 99 | ### Month View (30 days) 100 | 101 | ```habittracker 102 | { 103 | "path": "test-vault/habits", 104 | "daysToShow": 30, 105 | "debug": true 106 | } 107 | ``` 108 | 109 | ### Year View (365 days) 110 | 111 | ```habittracker 112 | { 113 | "path": "test-vault/habits", 114 | "daysToShow": 365, 115 | "debug": true 116 | } 117 | ``` 118 | 119 | ## Color Variations 120 | 121 | ### Hex Color 122 | 123 | ```habittracker 124 | { 125 | "path": "test-vault/habits", 126 | "daysToShow": 14, 127 | "color": "#4CAF50", 128 | "debug": true 129 | } 130 | ``` 131 | 132 | ### RGB Color 133 | 134 | ```habittracker 135 | { 136 | "path": "test-vault/habits", 137 | "daysToShow": 14, 138 | "color": "rgb(255, 107, 107)", 139 | "debug": true 140 | } 141 | ``` 142 | 143 | ### CSS Color Name 144 | 145 | ```habittracker 146 | { 147 | "path": "test-vault/habits", 148 | "daysToShow": 14, 149 | "color": "coral", 150 | "debug": true 151 | } 152 | ``` 153 | 154 | ### Invalid Color (should fallback) 155 | 156 | ```habittracker 157 | { 158 | "path": "test-vault/habits", 159 | "daysToShow": 14, 160 | "color": "not-a-color", 161 | "debug": true 162 | } 163 | ``` 164 | 165 | ## Path Variations 166 | 167 | ### Single File 168 | 169 | ```habittracker 170 | { 171 | "path": "test-vault/single-habits/custom-color.md", 172 | "daysToShow": 14, 173 | "debug": true 174 | } 175 | ``` 176 | 177 | ### Nested Folder 178 | 179 | ```habittracker 180 | { 181 | "path": "test-vault/nested/deep", 182 | "daysToShow": 14, 183 | "debug": true 184 | } 185 | ``` 186 | 187 | ### Mixed Content Folder 188 | 189 | ```habittracker 190 | { 191 | "path": "test-vault/mixed-content", 192 | "daysToShow": 14, 193 | "debug": true 194 | } 195 | ``` 196 | 197 | ## Date Range Tests 198 | 199 | ### Historical Date 200 | 201 | ```habittracker 202 | { 203 | "path": "test-vault/habits", 204 | "daysToShow": 21, 205 | "lastDisplayedDate": "2024-01-15", 206 | "debug": true 207 | } 208 | ``` 209 | 210 | ### Future Date 211 | 212 | ```habittracker 213 | { 214 | "path": "test-vault/habits", 215 | "daysToShow": 21, 216 | "lastDisplayedDate": "2025-12-31", 217 | "debug": true 218 | } 219 | ``` 220 | 221 | ## Test Results ✅ 222 | 223 | - [ ] All boolean combinations work 224 | - [ ] Days to show affects display correctly 225 | - [ ] Color variations apply properly 226 | - [ ] Invalid colors fallback gracefully 227 | - [ ] Path variations load correctly 228 | - [ ] Date ranges calculate properly 229 | -------------------------------------------------------------------------------- /test-vault/🐛 Edge Cases.md: -------------------------------------------------------------------------------- 1 | # 🐛 Edge Cases & Error Handling Tests 2 | 3 | This page tests error conditions and edge cases to ensure robust behavior. 4 | 5 | ## Invalid JSON Tests 6 | 7 | ### Missing Comma 8 | 9 | ```habittracker 10 | { 11 | "path": "test-vault/habits" 12 | "daysToShow": 21 13 | } 14 | ``` 15 | 16 | ### Trailing Comma 17 | 18 | ```habittracker 19 | { 20 | "path": "test-vault/habits", 21 | "daysToShow": 21, 22 | } 23 | ``` 24 | 25 | ### Missing Quotes 26 | 27 | ```habittracker 28 | { 29 | path: "habits", 30 | daysToShow: 21 31 | } 32 | ``` 33 | 34 | ### Invalid JSON Structure 35 | 36 | ```habittracker 37 | { 38 | "path": "test-vault/habits", 39 | "daysToShow": "not-a-number", 40 | "debug": "not-a-boolean" 41 | } 42 | ``` 43 | 44 | ### Empty JSON 45 | 46 | ```habittracker 47 | {} 48 | ``` 49 | 50 | ### Completely Invalid 51 | 52 | ```habittracker 53 | this is not json at all! 54 | ``` 55 | 56 | ## Path Edge Cases 57 | 58 | ### Non-existent Path 59 | 60 | ```habittracker 61 | { 62 | "path": "test-vault/folder-that-does-not-exist", 63 | "debug": true 64 | } 65 | ``` 66 | 67 | ### Empty String Path 68 | 69 | ```habittracker 70 | { 71 | "path": "", 72 | "debug": true 73 | } 74 | ``` 75 | 76 | ### Special Characters in Path 77 | 78 | ```habittracker 79 | { 80 | "path": "test-vault/habits/special-chars-habit-名前.md", 81 | "debug": true 82 | } 83 | ``` 84 | 85 | ### Path with Spaces 86 | 87 | ```habittracker 88 | { 89 | "path": "test-vault/habits/Long Habit Name That Tests UI Wrapping.md", 90 | "debug": true 91 | } 92 | ``` 93 | 94 | ## Extreme Values 95 | 96 | ### Zero Days 97 | 98 | ```habittracker 99 | { 100 | "path": "test-vault/habits", 101 | "daysToShow": 0, 102 | "debug": true 103 | } 104 | ``` 105 | 106 | ### Negative Days 107 | 108 | ```habittracker 109 | { 110 | "path": "test-vault/habits", 111 | "daysToShow": -5, 112 | "debug": true 113 | } 114 | ``` 115 | 116 | ### Huge Number of Days 117 | 118 | ```habittracker 119 | { 120 | "path": "test-vault/habits", 121 | "daysToShow": 999, 122 | "debug": true 123 | } 124 | ``` 125 | 126 | ### Very Old Date 127 | 128 | ```habittracker 129 | { 130 | "path": "test-vault/habits", 131 | "daysToShow": 21, 132 | "lastDisplayedDate": "1900-01-01", 133 | "debug": true 134 | } 135 | ``` 136 | 137 | ### Invalid Date Format 138 | 139 | ```habittracker 140 | { 141 | "path": "test-vault/habits", 142 | "daysToShow": 21, 143 | "lastDisplayedDate": "not-a-date", 144 | "debug": true 145 | } 146 | ``` 147 | 148 | ## File System Edge Cases 149 | 150 | ### Broken Habit Files 151 | 152 | ```habittracker 153 | { 154 | "path": "test-vault/broken-habits", 155 | "debug": true 156 | } 157 | ``` 158 | 159 | ### Empty Folder 160 | 161 | ```habittracker 162 | { 163 | "path": "test-vault/empty-folder", 164 | "debug": true 165 | } 166 | ``` 167 | 168 | ### Permission Issues (if applicable) 169 | 170 | ```habittracker 171 | { 172 | "path": "test-vault//system/protected/folder", 173 | "debug": true 174 | } 175 | ``` 176 | 177 | ## Unicode & Encoding Tests 178 | 179 | ### Unicode Habit Names 180 | 181 | ```habittracker 182 | { 183 | "path": "test-vault/single-habits/special-chars-habit-名前.md", 184 | "debug": true 185 | } 186 | ``` 187 | 188 | ### Emoji in Settings 189 | 190 | ```habittracker 191 | { 192 | "path": "test-vault/habits", 193 | "color": "🔴", 194 | "debug": true 195 | } 196 | ``` 197 | 198 | ## Recovery Tests 199 | 200 | These test the plugin's ability to recover from errors: 201 | 202 | ### Fix Path After Error 203 | 204 | 1. First, cause error with invalid path: 205 | 206 | ```habittracker 207 | { 208 | "path": "test-vault/invalid-path", 209 | "debug": true 210 | } 211 | ``` 212 | 213 | 2. Then fix the path (edit the block above): 214 | 215 | ```habittracker 216 | { 217 | "path": "test-vault/habits", 218 | "debug": true 219 | } 220 | ``` 221 | 222 | ### Fix JSON After Error 223 | 224 | 1. First, cause JSON error: 225 | 226 | ```habittracker 227 | { 228 | "path": "test-vault/habits", 229 | "daysToShow": 21 230 | // missing comma above 231 | } 232 | ``` 233 | 234 | 2. Then fix the JSON syntax 235 | 236 | ## Performance Edge Cases 237 | 238 | ### Very Long Habit Names 239 | 240 | ```habittracker 241 | { 242 | "path": "test-vault/habits/Long Habit Name That Tests UI Wrapping.md", 243 | "debug": true 244 | } 245 | ``` 246 | 247 | ### Many Small Date Ranges 248 | 249 | ```habittracker 250 | { 251 | "path": "test-vault/habits", 252 | "daysToShow": 1, 253 | "debug": true 254 | } 255 | ``` 256 | 257 | ## Expected Behaviors ✅ 258 | 259 | - [ ] Invalid JSON shows clear error messages 260 | - [ ] Invalid paths show helpful guidance 261 | - [ ] Extreme values are handled gracefully 262 | - [ ] Unicode content displays correctly 263 | - [ ] Plugin recovers after fixing errors 264 | - [ ] No crashes or data corruption 265 | - [ ] Memory usage stays reasonable 266 | - [ ] Error messages are user-friendly 267 | 268 | ## Notes 269 | 270 | Record any unexpected behaviors or bugs discovered during testing: 271 | 272 | - [ ] Bug 1: 273 | - [ ] Bug 2: 274 | - [ ] Bug 3: 275 | -------------------------------------------------------------------------------- /src/HabitTrackerError.svelte: -------------------------------------------------------------------------------- 1 | 139 | 140 |
141 |
142 | 🛑 {pluginName} 143 |
144 | {@html prettyError} 145 |
146 | -------------------------------------------------------------------------------- /src/Habit.svelte: -------------------------------------------------------------------------------- 1 | 182 | 183 | 184 |
185 |
186 | {habitName} 191 |
192 | {#if Object.keys(entriesInRange).length} 193 | {#each dates as date} 194 | 195 | 196 |
toggleHabit(date)} 201 | >
202 | {/each} 203 | {/if} 204 |
205 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Habit Tracker 21 [![Obsidian](https://img.shields.io/badge/Obsidian-6d28d9)](https://obsidian.md) [![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-orange?logo=buy-me-a-coffee)](https://www.buymeacoffee.com/zincplusplus) ![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/zincplusplus/habit-tracker/total?label=Downloads&color=27C840) [![GitHub release](https://img.shields.io/github/release/zincplusplus/habit-tracker.svg?label=Version)](https://github.com/zincplusplus/habit-tracker/releases) ![GitHub Release Date](https://img.shields.io/github/release-date/zincplusplus/habit-tracker?color=6d28d9&label=Latest%20Release) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-27C840)](https://github.com/zincplusplus/habit-tracker/pulls) 2 | 3 | A minimalist, elegant habit tracker for [Obsidian](https://obsidian.md) that helps you build lasting habits with clear progress visualization. 4 | 5 | Transform your [Obsidian](https://obsidian.md) vault into a habit-building powerhouse. Track daily habits with an intuitive grid interface, customize your tracking experience, and watch your consistency streaks grow over time. 6 | 7 | ![Habit Tracker Demo](screenshots/ui-demo.png) 8 | 9 | ## Features 10 | 11 | - **Minimalist Look** - Elegant, clean interface with nothing but essential functionality. Matches your theme effortlessly using Obsidian CSS variables 12 | - **Maximum configurability** - You can tweak and customize pretty much every aspect of Habit Tracker 21 to make it just right for you 13 | - **Easy to setup** - Matches your theme effortlessly using Obsidian CSS variables and includes sensible defaults for all tracker properties 14 | - **Smart Folder Support** - Track individual files or entire habit folders 15 | - **Debug Mode** - Comprehensive debugging gives you all the info you need to figure it out 16 | 17 | ## Quick Start 18 | 19 | 1. Install the plugin from **[Obsidian's Community Plugins](obsidian://show-plugin?id=habit-tracker-21)** 20 | 2. **Create your habits folder** (e.g., `Habits/`) 21 | 3. **Add habit files** like `Exercise.md`, `Reading.md` for each habit you want to track 22 | 4. **Insert tracker** in your Daily notes template, or any other file: 23 | 24 | ````markdown 25 | ```habittracker 26 | { 27 | "path": "Habits" 28 | } 29 | ``` 30 | ```` 31 | 32 | That's it! Click the grid to log your daily habits. 33 | 34 | ## Customization 35 | 36 | ### Custom Habit Titles 37 | 38 | By default, habit titles use the filename (e.g., `Exercise.md` → "Exercise"). Customize titles by adding frontmatter to your habit files: 39 | 40 | ```markdown 41 | --- 42 | title: "Morning Workout 💪" 43 | entries: [] 44 | --- 45 | ``` 46 | 47 | Examples: 48 | - `title: "📚 Daily Reading"` 49 | - `title: "Drink 8 glasses of water"` 50 | - `title: "Meditation & Mindfulness"` 51 | 52 | If no title is specified, the filename is used as before. 53 | 54 | ### Custom Habit Colors 55 | 56 | By default, habit colors inherit from your Obsidian theme's checkbox ticked color. Personalize individual habits with custom colors by adding a `color` property to your habit file frontmatter: 57 | 58 | ```markdown 59 | --- 60 | title: "Morning Workout 💪" 61 | color: "#4CAF50" 62 | entries: [] 63 | --- 64 | ``` 65 | 66 | Examples: 67 | - `color: "#FF5722"` (hex colors) 68 | - `color: "rgb(76, 175, 80)"` (RGB values) 69 | - `color: "green"` (CSS color names) 70 | 71 | Invalid colors are ignored and the default theme color is used. 72 | 73 | ## Configuration 74 | 75 | ### Global Settings 76 | 77 | Access via **Settings > Community plugins > Habit Tracker** to set defaults for all trackers: 78 | 79 | - **Default Path** - Choose from dropdown of vault folders 80 | - **Days to Show** - Number input (default: 21) 81 | - **Debug Mode** - Toggle debug output on/off 82 | - **Match Line Length** - Fit tracker to readable line width 83 | 84 | ### Per-Tracker Settings 85 | 86 | Override global settings in individual code blocks: 87 | 88 | ````markdown 89 | ```habittracker 90 | { 91 | "path": "Habits", 92 | "daysToShow": 30, 93 | "lastDisplayedDate": "2024-01-15", 94 | "debug": true, 95 | "matchLineLength": false 96 | } 97 | ``` 98 | ```` 99 | 100 | ## All Settings 101 | 102 | | Setting | Type | Default | Description | 103 | | ------------------- | ------- | ------- | -------------------------------------------------------------------------------- | 104 | | `path` | string | "/" | Path to habit folder or file. Defaults to root folder if left empty | 105 | | `firstDisplayedDate`| string | auto | First date shown in grid (format: "YYYY-MM-DD"). When provided, takes priority over daysToShow | 106 | | `lastDisplayedDate` | string | today | Last date shown in grid (format: "YYYY-MM-DD"). If left empty, defaults to today | 107 | | `daysToShow` | number | 21 | Number of days to display. Ignored when firstDisplayedDate is explicitly provided | 108 | | `color` | string | "" | Custom color for this tracker (hex, RGB, or CSS color name) | 109 | | `showStreaks` | boolean | true | Display streak indicators and counts | 110 | | `debug` | boolean | false | Enable debug console output | 111 | | `matchLineLength` | boolean | false | Match readable line width | 112 | 113 | ## Usage Examples 114 | 115 | ### Multiple Habits (Most popular) 116 | 117 | Track all habits in a folder: 118 | 119 | ````markdown 120 | ```habittracker 121 | { 122 | "path": "Habits" 123 | } 124 | ``` 125 | ```` 126 | 127 | ### Single Habit 128 | 129 | Track one specific habit file: 130 | 131 | ````markdown 132 | ```habittracker 133 | { 134 | "path": "Habits/Exercise.md" 135 | } 136 | ``` 137 | ```` 138 | 139 | ### Custom Time Range 140 | 141 | Show last 30 days: 142 | 143 | ````markdown 144 | ```habittracker 145 | { 146 | "path": "Habits", 147 | "daysToShow": 30 148 | } 149 | ``` 150 | ```` 151 | 152 | ### Custom Tracker Color 153 | 154 | Override default color for entire tracker: 155 | 156 | ````markdown 157 | ```habittracker 158 | { 159 | "path": "Habits", 160 | "color": "#FF5722" 161 | } 162 | ``` 163 | ```` 164 | 165 | ### Disable Streaks 166 | 167 | Hide streak indicators for cleaner view: 168 | 169 | ````markdown 170 | ```habittracker 171 | { 172 | "path": "Habits", 173 | "showStreaks": false 174 | } 175 | ``` 176 | ```` 177 | 178 | ### View Past Date Range 179 | 180 | Show habits ending on a specific date: 181 | 182 | ````markdown 183 | ```habittracker 184 | { 185 | "path": "Habits", 186 | "lastDisplayedDate": "2024-01-15", 187 | "daysToShow": 30 188 | } 189 | ``` 190 | ```` 191 | 192 | ### Show Specific Date Range 193 | 194 | Track habits for the entire month of November 2024: 195 | 196 | ````markdown 197 | ```habittracker 198 | { 199 | "path": "Habits", 200 | "firstDisplayedDate": "2024-11-01", 201 | "lastDisplayedDate": "2024-11-30" 202 | } 203 | ``` 204 | ```` 205 | 206 | ### Debug Mode 207 | 208 | Enable detailed logging: 209 | 210 | ````markdown 211 | ```habittracker 212 | { 213 | "path": "Habits", 214 | "debug": true 215 | } 216 | ``` 217 | ```` 218 | 219 | ## Troubleshooting 220 | 221 | ### Common Issues 222 | 223 | **"Path is required" error** 224 | 225 | - Set a default path in plugin settings, or specify `"path"` in your tracker 226 | 227 | **Tracker shows "No habits found"** 228 | 229 | - Check the path exists in your vault 230 | - Ensure folder contains `.md` files (subfolders are ignored) 231 | 232 | **Settings not updating** 233 | 234 | - Trackers auto-refresh when global settings change 235 | - For JSON errors, check syntax (commas, quotes, braces) 236 | - If issues persist, try force reload (Ctrl+R) or restart Obsidian 237 | 238 | **Debug Output** 239 | Enable debug mode to see detailed logging in the browser console (F12). 240 | 241 | ## Development 242 | 243 | ### Installation 244 | 245 | ```bash 246 | git clone https://github.com/zincplusplus/habit-tracker 247 | cd habit-tracker 248 | npm install 249 | npm run dev 250 | ``` 251 | 252 | ### Contributing 253 | 254 | PRs welcome! Please: 255 | 256 | - Follow existing code style 257 | - Update documentation 258 | 259 | Buy Me A Coffee 260 | 261 | ## License 262 | 263 | MIT License - see [LICENSE](LICENSE) for details. 264 | 265 | --- 266 | 267 | **Made with ❤️ for the Obsidian community** 268 | -------------------------------------------------------------------------------- /styles.css: -------------------------------------------------------------------------------- 1 | /* TODO configure most of these from a new settings page */ 2 | /* TODO test it with the default themes in Obsidian, light and dark */ 3 | div:has(.block-language-habittracker) { 4 | /* Colors */ 5 | --habit-bg: var(--background-primary); 6 | --habit-bg-ticked: var(--checkbox-color); 7 | --habit-icon-ticked: var(--checkbox-marker-color); 8 | --habit-border: 1px solid var(--divider-color); 9 | --habit-outer-border: var(--habit-border); 10 | --habit-horizontal-border: var(--habit-border); 11 | --habit-vertical-border: var(--habit-border); 12 | --habit-row-bg-hover: var(--background-secondary); 13 | --habit-highlight-weekend: var(--background-secondary); 14 | --habit-highlight-names: var(--background-secondary); 15 | --habit-container-hover: var(--background-secondary); 16 | --habit-tick-hover: var(--color-base-00); 17 | --habit-name-text-color: var(--link-color); 18 | --habit-header-bg-hover: var(--color-base-100); 19 | --habit-header-text-hover: var(--color-base-00); 20 | 21 | /* TODO: make the scroll bar not take vertical space at the bottom at least in synthwave theme */ 22 | 23 | /* Typography */ 24 | --habit-header-font-size: 11px; 25 | --habit-name-font-size: 13px; 26 | 27 | /* Cell dimensions */ 28 | --habit-cell-width: 25px; 29 | --habit-cell-height: 32px; 30 | --habit-name-max-width: 173px; 31 | --habit-name-padding: 8px; 32 | 33 | /* Tick size */ 34 | --habit-tick-size: 16px; 35 | 36 | /* Border radius */ 37 | --habit-streak-radius: calc(var(--habit-tick-size) / 2); 38 | --habit-tooltip-radius: 3px; 39 | 40 | /* Spacing */ 41 | --habit-streak-padding: 4px; 42 | --habit-tooltip-padding: 2px 6px; 43 | } 44 | 45 | /* Action bar for habit tracker code blocks */ 46 | .ht21-action-bar { 47 | display: flex; 48 | position: absolute; 49 | top: 90%; 50 | left: var(--habit-name-padding); 51 | right: var(--habit-name-padding); 52 | background: var(--background-secondary); 53 | border: var(--habit-border) 54 | border-radius: 0 0 var(--radius-s) var(--radius-s); 55 | padding: var(--habit-name-padding); 56 | justify-content: space-between; 57 | align-items: center; 58 | z-index: 100; 59 | font-size: 12px; 60 | opacity: 0; 61 | transition: all 0.2s ease; 62 | box-shadow: var(--shadow-s); 63 | pointer-events: none; 64 | } 65 | 66 | /* Show action bar on hover of the code block or its parent container */ 67 | .markdown-source-view.mod-cm6 .cm-content > .cm-lang-habittracker:hover { 68 | overflow: visible; 69 | contain: none !important; 70 | } 71 | .cm-lang-habittracker:hover .ht21-action-bar, 72 | .cm-preview-code-block.markdown-rendered:has(.block-language-habittracker):hover 73 | .ht21-action-bar { 74 | opacity: 1; 75 | pointer-events: all; 76 | top: 100%; 77 | } 78 | 79 | .ht21-action-bar__title { 80 | font-weight: 600; 81 | color: var(--text-muted); 82 | } 83 | 84 | .ht21-update-dot { 85 | position: absolute; 86 | top: 2px; 87 | right: 2px; 88 | width: 8px; 89 | height: 8px; 90 | background: var(--color-purple); 91 | border-radius: 50%; 92 | border: 1px solid var(--background-secondary); 93 | } 94 | 95 | .ht21-action-bar__buttons { 96 | display: flex; 97 | gap: 8px; 98 | } 99 | 100 | .ht21-action-bar__btn { 101 | background: var(--interactive-normal); 102 | border: var(--habit-border); 103 | border-radius: 4px; 104 | padding: 4px 8px; 105 | font-size: 11px; 106 | cursor: pointer; 107 | color: var(--text-normal); 108 | transition: all 0.2s ease; 109 | display: flex; 110 | align-items: center; 111 | gap: 4px; 112 | } 113 | 114 | .ht21-btn-text { 115 | font-size: 11px; 116 | } 117 | 118 | .ht21-action-bar__btn .svg-icon { 119 | width: 14px; 120 | height: 14px; 121 | } 122 | 123 | .ht21-action-bar__btn:hover { 124 | background: var(--interactive-hover); 125 | border-color: var(--border-color-hover); 126 | } 127 | 128 | .ht21-action-bar__btn:active { 129 | background: var(--interactive-active); 130 | } 131 | 132 | .cm-preview-code-block.markdown-rendered:has(.block-language-habittracker) { 133 | padding: 0; 134 | font-family: monospace; 135 | position: relative; 136 | } 137 | 138 | /* Ensure code blocks in source view also support the action bar */ 139 | .cm-lang-habittracker { 140 | position: relative; 141 | } 142 | .cm-preview-code-block.markdown-rendered:has( 143 | .block-language-habittracker 144 | ):hover { 145 | background-color: var(--habit-container-hover); 146 | } 147 | .cm-preview-code-block.markdown-rendered:has(.block-language-habittracker):hover 148 | .edit-block-button { 149 | display: none !important; 150 | } 151 | 152 | .block-language-habittracker { 153 | border: var(--habit-outer-border); 154 | border-radius: var(--radius-s); 155 | overflow-x: scroll; 156 | width: fit-content; 157 | max-width: 100%; 158 | scrollbar-width: thin; 159 | } 160 | 161 | .habit-tracker { 162 | display: grid; 163 | grid-template-columns: 1fr repeat( 164 | var(--date-columns), 165 | var(--habit-cell-width) 166 | ); 167 | width: fit-content; 168 | background-color: var(--habit-bg); 169 | } 170 | 171 | .is-readable-line-width .habit-tracker--match-line-length { 172 | min-width: calc(var(--file-line-width) - 2px); /* TODO: this is a hack since I know the widht of the border. but it won't scale. figure out a way to fix this that hopefully doesn't break overrides people added in place */ 173 | } 174 | 175 | .habit-tracker__row { 176 | display: contents; 177 | } 178 | 179 | .habit-tracker__row:has(.habit-tracker__cell:hover) > .habit-tracker__cell { 180 | background-color: var(--habit-row-bg-hover); 181 | } 182 | 183 | .habit-tracker__cell { 184 | width: var(--habit-cell-width); 185 | font-size: var(--habit-header-font-size); 186 | height: var(--habit-cell-height); 187 | white-space: nowrap; 188 | display: flex; 189 | align-items: center; 190 | justify-content: center; 191 | } 192 | .habit-tracker__cell:not(:last-child) { 193 | border-right: var(--habit-vertical-border); 194 | } 195 | .habit-tracker__row:not(.habit-tracker__header) .habit-tracker__cell { 196 | border-top: var(--habit-horizontal-border); 197 | } 198 | /* 199 | */ 200 | 201 | .habit-tracker__cell--name { 202 | padding: 0 var(--habit-name-padding); 203 | width: 100%; 204 | max-width: var(--habit-name-max-width); 205 | justify-content: start; 206 | position: sticky; 207 | left: 0; 208 | z-index: 10; 209 | background-color: var(--habit-highlight-names); 210 | } 211 | .habit-tracker__cell--name .internal-link { 212 | color: var(--habit-name-text-color); 213 | max-width: 100%; 214 | overflow: hidden; 215 | text-overflow: ellipsis; 216 | white-space: nowrap; 217 | width: fit-content; 218 | display: inline-block; 219 | font-size: var(--habit-name-font-size); 220 | text-decoration: none; 221 | } 222 | .is-readable-line-width 223 | .habit-tracker--match-line-length 224 | .habit-tracker__cell--name { 225 | max-width: 100%; 226 | } 227 | 228 | .habit-tracker__cell--saturday, 229 | .habit-tracker__cell--sunday { 230 | background-color: var(--habit-highlight-weekend); 231 | font-weight: bold; 232 | } 233 | 234 | .habit-tracker__header .habit-tracker__cell[data-ht21-pretty-date] { 235 | position: relative; 236 | } 237 | .habit-tracker__header .habit-tracker__cell[data-ht21-pretty-date]:hover { 238 | cursor: pointer; 239 | background: var(--habit-header-bg-hover); 240 | color: var(--habit-header-text-hover); 241 | border-top-left-radius: var(--habit-tooltip-radius); 242 | border-top-right-radius: var(--habit-tooltip-radius); 243 | } 244 | 245 | .habit-tracker__header .habit-tracker__cell[data-ht21-pretty-date]:hover:after { 246 | background: var(--habit-header-bg-hover); 247 | color: var(--habit-header-text-hover); 248 | content: attr(data-ht21-pretty-date); 249 | left: 50%; 250 | padding: var(--habit-tooltip-padding); 251 | position: absolute; 252 | top: 100%; 253 | white-space: nowrap; 254 | transform: translateX(-50%); 255 | border-radius: var(--habit-tooltip-radius); 256 | } 257 | .habit-tracker__header 258 | .habit-tracker__cell[data-ht21-pretty-date]:last-child:hover:after { 259 | left: auto; 260 | right: 0; 261 | transform: none; 262 | border-top-right-radius: 0; 263 | } 264 | 265 | .habit-tick { 266 | line-height: 0; 267 | text-align: center; 268 | width: var(--habit-cell-width); 269 | max-width: var(--habit-cell-width); 270 | min-width: var(--habit-cell-width); 271 | padding-left: var(--habit-streak-padding); 272 | padding-right: var(--habit-streak-padding); 273 | } 274 | .habit-tick:hover { 275 | cursor: pointer; 276 | background-color: var(--habit-tick-hover) !important; 277 | } 278 | 279 | .habit-tick--ticked:before { 280 | background: var(--habit-bg-ticked); 281 | content: ''; 282 | display: inline-block; 283 | height: var(--habit-tick-size); 284 | transition: all 0.3s ease; 285 | line-height: var(--habit-tick-size); 286 | color: var(--habit-icon-ticked); 287 | border-radius: 50%; 288 | width: 100%; 289 | } 290 | 291 | .habit-tick--streak { 292 | padding-left: 0; 293 | padding-right: 0; 294 | } 295 | .habit-tick--streak:before { 296 | border-radius: 0; 297 | } 298 | 299 | .habit-tick--streak-start { 300 | padding-left: var(--habit-streak-padding); 301 | } 302 | .habit-tick--streak-start:before { 303 | border-top-left-radius: var(--habit-streak-radius); 304 | border-bottom-left-radius: var(--habit-streak-radius); 305 | } 306 | .habit-tick--streak-end { 307 | padding-right: var(--habit-streak-padding); 308 | } 309 | .habit-tick--streak-end:before { 310 | border-top-right-radius: var(--habit-streak-radius); 311 | border-bottom-right-radius: var(--habit-streak-radius); 312 | } 313 | .habit-tick--streak + .habit-tick--streak-end:before { 314 | content: attr(streak); 315 | font-weight: bold; 316 | } 317 | -------------------------------------------------------------------------------- /src/HabitTracker.svelte: -------------------------------------------------------------------------------- 1 | 328 | 329 | 330 | {#if state.ui.fatalError} 331 |
332 | 🛑 {pluginName} 333 |
334 | {state.ui.fatalError} 335 | {:else if !state.computed.habits.length} 336 |
337 | 😕 {pluginName} 338 |
339 | No habits to show at "{state.settings.path}" 340 | {:else} 341 |
348 |
349 |
350 | {#each state.computed.dates as date} 351 |
358 | {getDate(parseISO(date))} 359 |
360 | {/each} 361 |
362 | {#each state.computed.habits as habit} 363 | 373 | {/each} 374 |
375 | {/if} 376 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | // TODO Add integration tests with jest 2 | import {Plugin, Notice, setIcon, App, PluginSettingTab, Setting} from 'obsidian' 3 | import HabitTracker from './HabitTracker.svelte' 4 | import HabitTrackerError from './HabitTrackerError.svelte' 5 | import { debugLog, renderPrettyDate, isValidCSSColor } from './utils' 6 | 7 | import { 8 | format, 9 | } from 'date-fns' 10 | 11 | interface HabitTrackerSettings { 12 | path: string; 13 | daysToShow: number; 14 | debug: boolean; 15 | matchLineLength: boolean; 16 | defaultColor: string; 17 | showStreaks: boolean; 18 | } 19 | 20 | const DEFAULT_SETTINGS: HabitTrackerSettings = { 21 | path: '', 22 | daysToShow: 21, 23 | debug: false, 24 | matchLineLength: true, 25 | defaultColor: '', 26 | showStreaks: true 27 | } 28 | 29 | export default class HabitTracker21 extends Plugin { 30 | settings: HabitTrackerSettings; 31 | 32 | async onload() { 33 | await this.loadSettings(); 34 | 35 | this.registerMarkdownCodeBlockProcessor('habittracker', async (src, el) => { 36 | // const trackingPixel = document.createElement('img') 37 | // trackingPixel.setAttribute('src', 'https://bit.ly/habitttracker21-140') 38 | // if (el.parentElement) el.parentElement.appendChild(trackingPixel) 39 | // TODO make this dynamic and add it to HabitTracker.svelte 40 | 41 | debugLog('Loading', 1) 42 | 43 | let userSettings: Partial = {} 44 | try { 45 | userSettings = JSON.parse(src); 46 | const debugMode = this.settings.debug || userSettings.debug; 47 | debugLog(`Global settings: ${JSON.stringify(this.settings)}`, debugMode); 48 | debugLog(`Tracker settings: ${JSON.stringify(userSettings)}`, debugMode); 49 | debugLog(`Today is ${format(new Date(), 'yyyy-MM-dd')}`, debugMode); 50 | new HabitTracker({ 51 | target: el, 52 | props: { 53 | app: this.app, 54 | userSettings, 55 | globalSettings: this.settings, 56 | pluginName: this.manifest.name, 57 | }, 58 | }) 59 | } catch(error) { 60 | new HabitTrackerError({ 61 | target: el, 62 | props: { 63 | error, 64 | src, 65 | pluginName: this.manifest.name, 66 | app: this.app, 67 | globalSettings: this.settings 68 | } 69 | }) 70 | console.error(`[${this.manifest.name}] Received invalid settings. ${error}`) 71 | } 72 | }) 73 | 74 | // Add hover action bars to habit tracker code blocks 75 | this.addHoverActionBars() 76 | 77 | // Check for updates in background (after a short delay) 78 | setTimeout(() => this.checkForUpdatesBackground(), 5000) 79 | 80 | // Add the settings tab 81 | this.addSettingTab(new HabitTrackerSettingTab(this.app, this)); 82 | } 83 | 84 | async loadSettings() { 85 | this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); 86 | } 87 | 88 | async saveSettings() { 89 | console.log('[HabitTracker] Saving settings:', this.settings); 90 | await this.saveData(this.settings); 91 | // Refresh all habit tracker instances when settings change 92 | this.refreshAllHabitTrackers(); 93 | } 94 | 95 | refreshAllHabitTrackers() { 96 | // Dispatch a single event at the document level that all components can listen to 97 | console.log('[HabitTracker] Dispatching refresh event with settings:', this.settings); 98 | const refreshEvent = new CustomEvent('habit-tracker-refresh', { 99 | detail: { settings: this.settings } 100 | }); 101 | document.dispatchEvent(refreshEvent); 102 | console.log('[HabitTracker] Refresh event dispatched'); 103 | } 104 | 105 | addHoverActionBars() { 106 | // Use event delegation to handle hover on habit tracker code blocks 107 | document.addEventListener('mouseover', (e) => { 108 | const target = e.target as HTMLElement 109 | if (!target || typeof target.closest !== 'function') return 110 | 111 | const codeBlock = target.closest('.cm-lang-habittracker') as HTMLElement 112 | 113 | if (codeBlock && !codeBlock.querySelector('.ht21-action-bar')) { 114 | // Check for updates when creating new action bars 115 | this.checkForUpdatesBackground() 116 | 117 | const actionBar = this.createActionBar(codeBlock) 118 | codeBlock.appendChild(actionBar) 119 | } 120 | }) 121 | 122 | // Clean up action bars when mouse leaves 123 | document.addEventListener('mouseleave', (e) => { 124 | const target = e.target as HTMLElement 125 | if (!target || typeof target.closest !== 'function') return 126 | 127 | const codeBlock = target.closest('.cm-lang-habittracker') as HTMLElement 128 | 129 | if (codeBlock) { 130 | // Small delay to prevent flickering when moving between elements 131 | setTimeout(() => { 132 | if (!codeBlock.matches(':hover')) { 133 | const actionBar = codeBlock.querySelector('.ht21-action-bar') 134 | actionBar?.remove() 135 | } 136 | }, 100) 137 | } 138 | }) 139 | } 140 | 141 | // TODO could we do this with Svelte? 142 | createActionBar(codeBlock) { 143 | const actionBar = document.createElement('div') 144 | actionBar.className = 'ht21-action-bar' 145 | 146 | // Check for version mismatch between manifest and localStorage 147 | const storedVersion = localStorage.getItem('habit-tracker-update-available') 148 | const currentVersion = this.manifest.version 149 | // TODO add some debugging code here too 150 | 151 | // Show dot if there's a stored version that's different from current 152 | const hasUpdate = storedVersion && storedVersion !== currentVersion 153 | 154 | const updateDot = hasUpdate ? '' : '' 155 | const tooltipText = hasUpdate ? 'New version available' : 'Check for updates' 156 | 157 | actionBar.innerHTML = ` 158 | ${this.manifest.name} 159 |
160 | 161 | 162 | 163 |
164 | ` 165 | 166 | // Add event listeners 167 | const settingsBtn = actionBar.querySelector('.ht21-action-bar__btn--settings') 168 | const updateBtn = actionBar.querySelector('.ht21-action-bar__btn--update') 169 | const editBtn = actionBar.querySelector('.ht21-action-bar__btn--edit') 170 | 171 | // Add Obsidian icons 172 | if (settingsBtn) setIcon(settingsBtn as HTMLElement, 'settings') 173 | if (updateBtn) setIcon(updateBtn as HTMLElement, 'download') 174 | if (editBtn) setIcon(editBtn as HTMLElement, 'lucide-code-2') 175 | 176 | settingsBtn?.addEventListener('click', () => this.openSettings()) 177 | updateBtn?.addEventListener('click', () => { 178 | // Clear update status when clicked 179 | localStorage.removeItem('habit-tracker-update-available') 180 | localStorage.removeItem('habit-tracker-last-update-check') 181 | 182 | if (hasUpdate) { 183 | this.openCommunityPlugins() 184 | } else { 185 | this.checkForUpdates() 186 | } 187 | }) 188 | editBtn?.addEventListener('click', () => this.editBlock(codeBlock)) 189 | 190 | return actionBar 191 | } 192 | 193 | openSettings() { 194 | // Open settings and navigate to this plugin's settings page 195 | (this.app as any).setting.open(); 196 | (this.app as any).setting.openTabById(this.manifest.id); 197 | } 198 | 199 | openCommunityPlugins() { 200 | // Open the specific plugin page in Community Plugins 201 | window.open('obsidian://show-plugin?id=habit-tracker-21'); 202 | } 203 | 204 | async checkForUpdates() { 205 | await this.performUpdateCheck() 206 | } 207 | 208 | async checkForUpdatesBackground() { 209 | const lastCheck = localStorage.getItem('habit-tracker-last-update-check') 210 | const now = Date.now() 211 | const dayInMs = 24 * 60 * 60 * 1000 212 | 213 | // Only check once per day for background checks 214 | if (lastCheck && (now - parseInt(lastCheck)) < dayInMs) { 215 | return 216 | } 217 | 218 | await this.performUpdateCheck() 219 | } 220 | 221 | async performUpdateCheck() { 222 | try { 223 | // Check GitHub releases for updates 224 | const response = await fetch('https://api.github.com/repos/zincplusplus/habit-tracker/releases/latest') 225 | if (!response.ok) throw new Error('Failed to fetch') 226 | 227 | const latestRelease = await response.json() 228 | const latestVersion = latestRelease.tag_name.replace('v', '') 229 | const currentVersion = this.manifest.version 230 | 231 | // Store check timestamp 232 | localStorage.setItem('habit-tracker-last-update-check', Date.now().toString()) 233 | 234 | console.log('Debug - latestVersion:', latestVersion) 235 | console.log('Debug - currentVersion:', currentVersion) 236 | const isNewer = this.isNewerVersion(latestVersion, currentVersion) 237 | console.log('Debug - isNewerVersion result:', isNewer) 238 | 239 | if (isNewer) { 240 | localStorage.setItem('habit-tracker-update-available', latestVersion) 241 | console.log('Debug - Stored update available:', latestVersion) 242 | } else { 243 | console.log('Debug - No update needed, removing localStorage entry') 244 | localStorage.removeItem('habit-tracker-update-available') 245 | } 246 | } catch (error) { 247 | console.log('Update check failed:', error) 248 | } 249 | } 250 | 251 | isNewerVersion(latest: string, current: string): boolean { 252 | const parseVersion = (v: string) => v.split('.').map(Number) 253 | const latestParts = parseVersion(latest) 254 | const currentParts = parseVersion(current) 255 | 256 | for (let i = 0; i < Math.max(latestParts.length, currentParts.length); i++) { 257 | const l = latestParts[i] || 0 258 | const c = currentParts[i] || 0 259 | if (l > c) return true 260 | if (l < c) return false 261 | } 262 | return false 263 | } 264 | 265 | editBlock(codeBlock) { 266 | // Find the edit button at the same DOM level as the action bar 267 | const editButton = codeBlock.querySelector('.edit-block-button') 268 | 269 | if (editButton) { 270 | editButton.click() 271 | } else { 272 | // throw an error ehre, also visible to the user, maybe notice??? 273 | } 274 | } 275 | 276 | onunload() { 277 | // window.location.reload(); 278 | } 279 | } 280 | 281 | class HabitTrackerSettingTab extends PluginSettingTab { 282 | plugin: HabitTracker21; 283 | 284 | constructor(app: App, plugin: HabitTracker21) { 285 | super(app, plugin); 286 | this.plugin = plugin; 287 | } 288 | 289 | display(): void { 290 | const {containerEl} = this; 291 | 292 | containerEl.empty(); 293 | 294 | containerEl.createEl('h3', {text: `${this.plugin.manifest.name} Settings`}); 295 | 296 | // General Settings Section 297 | let generalHeader = containerEl.createEl('h4', {text: 'General Settings'}); 298 | generalHeader.style.marginBottom = '0'; 299 | const generalDesc = containerEl.createEl('div', { 300 | cls: 'setting-item-description', 301 | text: 'These apply to all trackers and can be overridden either in the codeblock or in the habit tracker file.' 302 | }); 303 | generalDesc.style.marginBottom = '15px'; 304 | generalDesc.style.fontSize = '0.85em'; 305 | generalDesc.style.color = 'var(--text-muted)'; 306 | 307 | new Setting(containerEl) 308 | .setName('Default path') 309 | .setDesc('Default path for habits (folder or file). Can be overridden with "path" in code blocks.') 310 | .addDropdown(dropdown => { 311 | // Get all folders in the vault 312 | const folders = this.app.vault.getAllLoadedFiles() 313 | .filter(file => 'children' in file && file.children !== undefined) // Only folders 314 | .map(folder => folder.path) 315 | .sort(); 316 | 317 | // Add each folder as an option 318 | folders.forEach(folderPath => { 319 | dropdown.addOption(folderPath, folderPath); 320 | }); 321 | 322 | // Set current value 323 | dropdown.setValue(this.plugin.settings.path); 324 | 325 | // Handle changes 326 | dropdown.onChange(async (value) => { 327 | this.plugin.settings.path = value; 328 | await this.plugin.saveSettings(); 329 | }); 330 | }); 331 | 332 | new Setting(containerEl) 333 | .setName('Days to show') 334 | .setDesc('Number of days to display in the habit tracker. Can be overridden with "daysToShow" in code blocks.') 335 | .addText(text => text 336 | .setValue(this.plugin.settings.daysToShow.toString()) 337 | .onChange(async (value) => { 338 | const numValue = parseInt(value); 339 | if (!isNaN(numValue) && numValue > 0) { 340 | this.plugin.settings.daysToShow = numValue; 341 | await this.plugin.saveSettings(); 342 | } 343 | })) 344 | .then(setting => { 345 | // Add number input attributes 346 | const inputEl = setting.controlEl.querySelector('input') as HTMLInputElement; 347 | if (inputEl) { 348 | inputEl.type = 'number'; 349 | inputEl.min = '1'; 350 | inputEl.step = '1'; 351 | } 352 | }); 353 | 354 | new Setting(containerEl) 355 | .setName('Default color') 356 | .setDesc('Default habit color (hex, RGB, or CSS color name). Can be overridden with "color" in code blocks or habit frontmatter.') 357 | .addText(text => text 358 | .setValue(this.plugin.settings.defaultColor) 359 | .setPlaceholder('#4CAF50 or green') 360 | .onChange(async (value) => { 361 | // Only save valid colors or empty string 362 | if (!value || isValidCSSColor(value)) { 363 | this.plugin.settings.defaultColor = value; 364 | await this.plugin.saveSettings(); 365 | } 366 | })); 367 | 368 | new Setting(containerEl) 369 | .setName('Show streaks') 370 | .setDesc('Display streak indicators and counts. Can be overridden with "showStreaks" in code blocks.') 371 | .addToggle(toggle => toggle 372 | .setValue(this.plugin.settings.showStreaks) 373 | .onChange(async (value) => { 374 | this.plugin.settings.showStreaks = value; 375 | await this.plugin.saveSettings(); 376 | })); 377 | 378 | new Setting(containerEl) 379 | .setName('Match line length') 380 | .setDesc('Make habit tracker match the width of the readable line length. Can be overridden with "matchLineLength" in code blocks.') 381 | .addToggle(toggle => toggle 382 | .setValue(this.plugin.settings.matchLineLength) 383 | .onChange(async (value) => { 384 | this.plugin.settings.matchLineLength = value; 385 | await this.plugin.saveSettings(); 386 | })); 387 | 388 | // Troubleshooting Section 389 | const troubleshootingHeader = containerEl.createEl('h4', {text: 'Troubleshooting'}); 390 | troubleshootingHeader.style.marginTop = '30px'; 391 | 392 | new Setting(containerEl) 393 | .setName('Debug mode') 394 | .setDesc('Enable debug output to console. Can be overridden with "debug" in code blocks.') 395 | .addToggle(toggle => toggle 396 | .setValue(this.plugin.settings.debug) 397 | .onChange(async (value) => { 398 | this.plugin.settings.debug = value; 399 | await this.plugin.saveSettings(); 400 | })); 401 | 402 | new Setting(containerEl) 403 | .setName('Reset settings') 404 | .setDesc('Reset all settings to their default values') 405 | .addButton(button => button 406 | .setButtonText('Reset to defaults') 407 | .setWarning() 408 | .onClick(async () => { 409 | // Reset to default settings 410 | this.plugin.settings = Object.assign({}, DEFAULT_SETTINGS); 411 | await this.plugin.saveSettings(); 412 | // Refresh the settings display 413 | this.display(); 414 | })); 415 | } 416 | } 417 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------