From 0c540b911a55f4c913440073a2f5b206d9317b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fr=C3=A9d=C3=A9ric=20Faust?= Date: Sat, 19 Mar 2022 16:56:06 -0400 Subject: [PATCH] Partial live preview support (#5) --- README.md | 5 +- docs/CHANGELOG.md | 28 ++ docs.md => docs/documentation.md | 0 esbuild.config.mjs | 43 +- manifest.json | 4 +- package-lock.json | 651 +++++++++++++++++++++++-------- package.json | 17 +- src/livePreviewPostProcessor.ts | 90 +++++ main.ts => src/main.ts | 63 ++- src/settings.ts | 25 ++ src/utils.ts | 37 ++ styles.css | 2 +- 12 files changed, 741 insertions(+), 224 deletions(-) create mode 100644 docs/CHANGELOG.md rename docs.md => docs/documentation.md (100%) create mode 100644 src/livePreviewPostProcessor.ts rename main.ts => src/main.ts (78%) create mode 100644 src/settings.ts create mode 100644 src/utils.ts diff --git a/README.md b/README.md index 3a41a59..e7d742f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ This plugin for [Obsidian](https://obsidian.md/) adds support for environment va ## Documentation -Check out the full documentation [here](docs.md). +- Check out the [full documentation](docs/documentation.md) +- Check out the [changelog](docs/CHANGELOG.md) ## Installation @@ -21,4 +22,4 @@ This plugin is not yet part of the community plugin list so it cannot be install If you find this plugin useful, please consider supporting my work: -[BuyMeACoffee](https://www.buymeacoffee.com/jffaust) \ No newline at end of file +[BuyMeACoffee](https://www.buymeacoffee.com/jffaust) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md new file mode 100644 index 0000000..f2befc2 --- /dev/null +++ b/docs/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.2.0] - 2022-03-19 +### Added +- Partial support for LivePreview mode +- Debug mode that will highlight LivePreview lines when enabled +- Command to open the plugin's settings. Open the command palette and search for `Manage variables` + + +## [0.1.0] - 2022-03-14 +### Added +- First implementation with support for Reading mode only +- Variables can be added, edited and deleted +- Variables can be configured to be vault-specific via the vault path property +- Toggle between showing all variables and only the ones that apply +- Filter shown variables +- Copy current vault path button +- Button to link to the documentation + + + +[0.2.0]: https://github.com/markdown-it/markdown-it/compare/0.2.0...0.1.0 +[0.1.0]: https://github.com/markdown-it/markdown-it/releases/tag/0.1.0 \ No newline at end of file diff --git a/docs.md b/docs/documentation.md similarity index 100% rename from docs.md rename to docs/documentation.md diff --git a/esbuild.config.mjs b/esbuild.config.mjs index f1fe201..7616974 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -3,7 +3,7 @@ import process from "process"; import builtins from 'builtin-modules' const banner = -`/* + `/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ @@ -15,32 +15,25 @@ esbuild.build({ banner: { js: banner, }, - entryPoints: ['main.ts'], + entryPoints: ['src/main.ts'], bundle: true, external: [ - 'obsidian', - 'electron', - '@codemirror/autocomplete', - '@codemirror/closebrackets', - '@codemirror/collab', - '@codemirror/commands', - '@codemirror/comment', - '@codemirror/fold', - '@codemirror/gutter', - '@codemirror/highlight', - '@codemirror/history', - '@codemirror/language', - '@codemirror/lint', - '@codemirror/matchbrackets', - '@codemirror/panel', - '@codemirror/rangeset', - '@codemirror/rectangular-selection', - '@codemirror/search', - '@codemirror/state', - '@codemirror/stream-parser', - '@codemirror/text', - '@codemirror/tooltip', - '@codemirror/view', + "obsidian", + "electron", + "codemirror", + "@codemirror/closebrackets", + "@codemirror/commands", + "@codemirror/fold", + "@codemirror/gutter", + "@codemirror/history", + "@codemirror/language", + "@codemirror/rangeset", + "@codemirror/rectangular-selection", + "@codemirror/search", + "@codemirror/state", + "@codemirror/stream-parser", + "@codemirror/text", + "@codemirror/view", ...builtins], format: 'cjs', watch: !prod, diff --git a/manifest.json b/manifest.json index 6e9b10f..e5dcd60 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,8 @@ { "id": "obsidian-variables", "name": "Variables", - "version": "0.1.1", - "minAppVersion": "0.12.0", + "version": "0.2.0", + "minAppVersion": "0.13.4", "description": "Plugin that adds support for variables in Obsidian.md", "author": "Jean-Frédéric Faust", "authorUrl": "https://github.com/jffaust", diff --git a/package-lock.json b/package-lock.json index d92fcfd..4d91c18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,52 +1,213 @@ { - "name": "obsidian-sample-plugin", - "version": "1.0.1", + "name": "obsidian-variables", + "version": "0.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "obsidian-sample-plugin", - "version": "1.0.1", + "name": "obsidian-variables", + "version": "0.1.1", "license": "MIT", "devDependencies": { + "@codemirror/autocomplete": "^0.19.9", + "@codemirror/commands": "^0.19.0", + "@codemirror/fold": "0.19.0", + "@codemirror/highlight": "^0.19.0", + "@codemirror/history": "^0.19.0", + "@codemirror/language": "^0.19.0", + "@codemirror/matchbrackets": "^0.19.0", + "@codemirror/panel": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/search": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/stream-parser": "https://github.com/lishid/stream-parser", + "@codemirror/view": "^0.19.0", "@types/node": "^16.11.6", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", "builtin-modules": "^3.2.0", "esbuild": "0.13.12", - "obsidian": "^0.13.26", + "obsidian": "^0.13.8", "tslib": "2.3.1", "typescript": "4.4.4" } }, - "node_modules/@codemirror/rangeset": { + "node_modules/@codemirror/autocomplete": { + "version": "0.19.14", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-0.19.14.tgz", + "integrity": "sha512-4PqJG7GGTePc+FQF387RFebDV4ERvKj23gQBmzNtu64ZSHlYEGulwP5EIIfulBiaWEmei9TYVaMFmTdNfofpRQ==", + "dev": true, + "dependencies": { + "@codemirror/language": "^0.19.0", + "@codemirror/state": "^0.19.4", + "@codemirror/text": "^0.19.2", + "@codemirror/tooltip": "^0.19.12", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0" + } + }, + "node_modules/@codemirror/commands": { + "version": "0.19.8", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-0.19.8.tgz", + "integrity": "sha512-65LIMSGUGGpY3oH6mzV46YWRrgao6NmfJ+AuC7jNz3K5NPnH6GCV1H5I6SwOFyVbkiygGyd0EFwrWqywTBD1aw==", + "dev": true, + "dependencies": { + "@codemirror/language": "^0.19.0", + "@codemirror/matchbrackets": "^0.19.0", + "@codemirror/state": "^0.19.2", + "@codemirror/text": "^0.19.6", + "@codemirror/view": "^0.19.22", + "@lezer/common": "^0.15.0" + } + }, + "node_modules/@codemirror/fold": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/fold/-/fold-0.19.0.tgz", + "integrity": "sha512-cHbr2hqKe2pMls1Ia1a4IwXly87ljpmvPUKkul6H/Uv9kCwpQLOP3dGMPXbMGm/1hGjBF/0wnc+m2iba9iJBTQ==", + "dev": true, + "dependencies": { + "@codemirror/gutter": "^0.19.0", + "@codemirror/language": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" + } + }, + "node_modules/@codemirror/gutter": { + "version": "0.19.9", + "resolved": "https://registry.npmjs.org/@codemirror/gutter/-/gutter-0.19.9.tgz", + "integrity": "sha512-PFrtmilahin1g6uL27aG5tM/rqR9DZzZYZsIrCXA5Uc2OFTFqx4owuhoU9hqfYxHp5ovfvBwQ+txFzqS4vog6Q==", + "dev": true, + "dependencies": { + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.23" + } + }, + "node_modules/@codemirror/highlight": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@codemirror/highlight/-/highlight-0.19.7.tgz", + "integrity": "sha512-3W32hBCY0pbbv/xidismw+RDMKuIag+fo4kZIbD7WoRj+Ttcaxjf+vP6RttRHXLaaqbWh031lTeON8kMlDhMYw==", + "dev": true, + "dependencies": { + "@codemirror/language": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.3", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0", + "style-mod": "^4.0.0" + } + }, + "node_modules/@codemirror/history": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@codemirror/history/-/history-0.19.2.tgz", + "integrity": "sha512-unhP4t3N2smzmHoo/Yio6ueWi+il8gm9VKrvi6wlcdGH5fOfVDNkmjHQ495SiR+EdOG35+3iNebSPYww0vN7ow==", + "dev": true, + "dependencies": { + "@codemirror/state": "^0.19.2", + "@codemirror/view": "^0.19.0" + } + }, + "node_modules/@codemirror/language": { "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.19.8.tgz", - "integrity": "sha512-1vusIkxSD0vK5KQ22JO/4Ejfww5268PgM/CpKNBSpTpWZEFlZbmOPyRiY4HXO2oEzOpypbA/walMiNInWnrT0Q==", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-0.19.8.tgz", + "integrity": "sha512-KhRne8qmzSKkaw+qhkwgNsPKxmThlyeJ3umfc33B9kJzVP7xhTkwX2MEPl0almM3brxMi+lPYx7gCPOy1gHsWw==", + "dev": true, + "dependencies": { + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.5", + "@lezer/lr": "^0.15.0" + } + }, + "node_modules/@codemirror/matchbrackets": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@codemirror/matchbrackets/-/matchbrackets-0.19.4.tgz", + "integrity": "sha512-VFkaOKPNudAA5sGP1zikRHCEKU0hjYmkKpr04pybUpQvfTvNJXlReCyP0rvH/1iEwAGPL990ZTT+QrLdu4MeEA==", + "dev": true, + "dependencies": { + "@codemirror/language": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0" + } + }, + "node_modules/@codemirror/panel": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@codemirror/panel/-/panel-0.19.1.tgz", + "integrity": "sha512-sYeOCMA3KRYxZYJYn5PNlt9yNsjy3zTNTrbYSfVgjgL9QomIVgOJWPO5hZ2sTN8lufO6lw0vTBsIPL9MSidmBg==", + "dev": true, + "dependencies": { + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" + } + }, + "node_modules/@codemirror/rangeset": { + "version": "0.19.9", + "resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.19.9.tgz", + "integrity": "sha512-V8YUuOvK+ew87Xem+71nKcqu1SXd5QROMRLMS/ljT5/3MCxtgrRie1Cvild0G/Z2f1fpWxzX78V0U4jjXBorBQ==", "dev": true, "dependencies": { "@codemirror/state": "^0.19.0" } }, - "node_modules/@codemirror/state": { + "node_modules/@codemirror/search": { "version": "0.19.9", - "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.9.tgz", - "integrity": "sha512-psOzDolKTZkx4CgUqhBQ8T8gBc0xN5z4gzed109aF6x7D7umpDRoimacI/O6d9UGuyl4eYuDCZmDFr2Rq7aGOw==", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-0.19.9.tgz", + "integrity": "sha512-h3MuwbUbiyOp6Np3IB5r4LH0w4inZvbtLO1Ipmz8RhElcGRiYr11Q6Bim8ocLfe08RmZT6B5EkTj1E8eNlugQQ==", + "dev": true, + "dependencies": { + "@codemirror/panel": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.3", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.34", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/state": { + "version": "0.19.6", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.6.tgz", + "integrity": "sha512-sqIQZE9VqwQj7D4c2oz9mfLhlT1ElAzGB5lO1lE33BPyrdNy1cJyCIOecT4cn4VeJOFrnjOeu+IftZ3zqdFETw==", "dev": true, "dependencies": { "@codemirror/text": "^0.19.0" } }, + "node_modules/@codemirror/stream-parser": { + "version": "0.19.6", + "resolved": "git+ssh://git@github.com/lishid/stream-parser.git#26c8edae7bdf63dc34d358d1de640bdd12e7b09f", + "dev": true, + "license": "MIT", + "dependencies": { + "@codemirror/language": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@lezer/common": "^0.15.0", + "@lezer/lr": "^0.15.0" + } + }, "node_modules/@codemirror/text": { "version": "0.19.6", "resolved": "https://registry.npmjs.org/@codemirror/text/-/text-0.19.6.tgz", "integrity": "sha512-T9jnREMIygx+TPC1bOuepz18maGq/92q2a+n4qTqObKwvNMg+8cMTslb8yxeEDEq7S3kpgGWxgO1UWbQRij0dA==", "dev": true }, + "node_modules/@codemirror/tooltip": { + "version": "0.19.16", + "resolved": "https://registry.npmjs.org/@codemirror/tooltip/-/tooltip-0.19.16.tgz", + "integrity": "sha512-zxKDHryUV5/RS45AQL+wOeN+i7/l81wK56OMnUPoTSzCWNITfxHn7BToDsjtrRKbzHqUxKYmBnn/4hPjpZ4WJQ==", + "dev": true, + "dependencies": { + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" + } + }, "node_modules/@codemirror/view": { - "version": "0.19.46", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.19.46.tgz", - "integrity": "sha512-gnIRJ4OrHt7RIC8q+NNOJeUy+nah6IOM/BPbS0uNnYPhfhpO938HCKbEE2CDLnD6LqcIBLD6u2xCKHYD9g5pTw==", + "version": "0.19.47", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.19.47.tgz", + "integrity": "sha512-SfbagKvJQl5dtt+9wYpo9sa3ZkMgUxTq+/hXDf0KVwIx+zu3cJIqfEm9xSx6yXkq7it7RsPGHaPasApNffF/8g==", "dev": true, "dependencies": { "@codemirror/rangeset": "^0.19.5", @@ -57,9 +218,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.0.tgz", - "integrity": "sha512-igm9SjJHNEJRiUnecP/1R5T3wKLEJ7pL6e2P+GUSfCd0dGjPYYZve08uzw8L2J8foVHFz+NGu12JxRcU2gGo6w==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.1.tgz", + "integrity": "sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ==", "dev": true, "peer": true, "dependencies": { @@ -67,7 +228,7 @@ "debug": "^4.3.2", "espree": "^9.3.1", "globals": "^13.9.0", - "ignore": "^4.0.6", + "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", "minimatch": "^3.0.4", @@ -77,16 +238,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@eslint/eslintrc/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true, - "peer": true, - "engines": { - "node": ">= 4" - } - }, "node_modules/@humanwhocodes/config-array": { "version": "0.9.5", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", @@ -109,6 +260,21 @@ "dev": true, "peer": true }, + "node_modules/@lezer/common": { + "version": "0.15.11", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-0.15.11.tgz", + "integrity": "sha512-vv0nSdIaVCRcJ8rPuDdsrNVfBOYe/4Szr/LhF929XyDmBndLDuWiCCHooGlGlJfzELyO608AyDhVsuX/ZG36NA==", + "dev": true + }, + "node_modules/@lezer/lr": { + "version": "0.15.8", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-0.15.8.tgz", + "integrity": "sha512-bM6oE6VQZ6hIFxDNKk8bKPa14hqFrV07J/vHGOeiAbJReIaQXmkVb6xQu4MR+JBTLa5arGRyAAjJe1qaQt3Uvg==", + "dev": true, + "dependencies": { + "@lezer/common": "^0.15.0" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -160,9 +326,9 @@ "dev": true }, "node_modules/@types/json-schema": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", - "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz", + "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==", "dev": true }, "node_modules/@types/node": { @@ -181,14 +347,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.14.0.tgz", - "integrity": "sha512-ir0wYI4FfFUDfLcuwKzIH7sMVA+db7WYen47iRSaCGl+HMAZI9fpBwfDo45ZALD3A45ZGyHWDNLhbg8tZrMX4w==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.15.0.tgz", + "integrity": "sha512-u6Db5JfF0Esn3tiAKELvoU5TpXVSkOpZ78cEGn/wXtT2RVqs2vkt4ge6N8cRCyw7YVKhmmLDbwI2pg92mlv7cA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.14.0", - "@typescript-eslint/type-utils": "5.14.0", - "@typescript-eslint/utils": "5.14.0", + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/type-utils": "5.15.0", + "@typescript-eslint/utils": "5.15.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -214,14 +380,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.14.0.tgz", - "integrity": "sha512-aHJN8/FuIy1Zvqk4U/gcO/fxeMKyoSv/rS46UXMXOJKVsLQ+iYPuXNbpbH7cBLcpSbmyyFbwrniLx5+kutu1pw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.15.0.tgz", + "integrity": "sha512-NGAYP/+RDM2sVfmKiKOCgJYPstAO40vPAgACoWPO/+yoYKSgAXIFaBKsV8P0Cc7fwKgvj27SjRNX4L7f4/jCKQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.14.0", - "@typescript-eslint/types": "5.14.0", - "@typescript-eslint/typescript-estree": "5.14.0", + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", "debug": "^4.3.2" }, "engines": { @@ -241,13 +407,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.14.0.tgz", - "integrity": "sha512-LazdcMlGnv+xUc5R4qIlqH0OWARyl2kaP8pVCS39qSL3Pd1F7mI10DbdXeARcE62sVQE4fHNvEqMWsypWO+yEw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.15.0.tgz", + "integrity": "sha512-EFiZcSKrHh4kWk0pZaa+YNJosvKE50EnmN4IfgjkA3bTHElPtYcd2U37QQkNTqwMCS7LXeDeZzEqnsOH8chjSg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.14.0", - "@typescript-eslint/visitor-keys": "5.14.0" + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -258,12 +424,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.14.0.tgz", - "integrity": "sha512-d4PTJxsqaUpv8iERTDSQBKUCV7Q5yyXjqXUl3XF7Sd9ogNLuKLkxz82qxokqQ4jXdTPZudWpmNtr/JjbbvUixw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.15.0.tgz", + "integrity": "sha512-KGeDoEQ7gHieLydujGEFLyLofipe9PIzfvA/41urz4hv+xVxPEbmMQonKSynZ0Ks2xDhJQ4VYjB3DnRiywvKDA==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.14.0", + "@typescript-eslint/utils": "5.15.0", "debug": "^4.3.2", "tsutils": "^3.21.0" }, @@ -284,9 +450,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.14.0.tgz", - "integrity": "sha512-BR6Y9eE9360LNnW3eEUqAg6HxS9Q35kSIs4rp4vNHRdfg0s+/PgHgskvu5DFTM7G5VKAVjuyaN476LCPrdA7Mw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.15.0.tgz", + "integrity": "sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -297,13 +463,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.14.0.tgz", - "integrity": "sha512-QGnxvROrCVtLQ1724GLTHBTR0lZVu13izOp9njRvMkCBgWX26PKvmMP8k82nmXBRD3DQcFFq2oj3cKDwr0FaUA==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.15.0.tgz", + "integrity": "sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.14.0", - "@typescript-eslint/visitor-keys": "5.14.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -324,15 +490,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.14.0.tgz", - "integrity": "sha512-EHwlII5mvUA0UsKYnVzySb/5EE/t03duUTweVy8Zqt3UQXBrpEVY144OTceFKaOe4xQXZJrkptCf7PjEBeGK4w==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.15.0.tgz", + "integrity": "sha512-081rWu2IPKOgTOhHUk/QfxuFog8m4wxW43sXNOMSCdh578tGJ1PAaWPsj42LOa7pguh173tNlMigsbrHvh/mtA==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.14.0", - "@typescript-eslint/types": "5.14.0", - "@typescript-eslint/typescript-estree": "5.14.0", + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -348,12 +514,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.14.0.tgz", - "integrity": "sha512-yL0XxfzR94UEkjBqyymMLgCBdojzEuy/eim7N9/RIcTNxpJudAcqsU8eRyfzBbcEzGoPWfdM3AGak3cN08WOIw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz", + "integrity": "sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.14.0", + "@typescript-eslint/types": "5.15.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -542,6 +708,12 @@ "dev": true, "peer": true }, + "node_modules/crelt": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.5.tgz", + "integrity": "sha512-+BO9wPPi+DWTDcNYhr/W90myha8ptzftZT+LwcmUbbok0rcP/fequmFYCw8NMoH7pkAZQzU78b3kYrlua5a9eA==", + "dev": true + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -558,9 +730,9 @@ } }, "node_modules/debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -870,13 +1042,13 @@ } }, "node_modules/eslint": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.10.0.tgz", - "integrity": "sha512-tcI1D9lfVec+R4LE1mNDnzoJ/f71Kl/9Cv4nG47jOueCMBrCCKYXr4AUVS7go6mWYGFD4+EoN6+eXSrEbRzXVw==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.11.0.tgz", + "integrity": "sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==", "dev": true, "peer": true, "dependencies": { - "@eslint/eslintrc": "^1.2.0", + "@eslint/eslintrc": "^1.2.1", "@humanwhocodes/config-array": "^0.9.2", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -1225,9 +1397,9 @@ } }, "node_modules/globals": { - "version": "13.12.1", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.1.tgz", - "integrity": "sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==", + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", "dev": true, "peer": true, "dependencies": { @@ -1479,9 +1651,9 @@ "peer": true }, "node_modules/obsidian": { - "version": "0.13.26", - "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-0.13.26.tgz", - "integrity": "sha512-7NLjrX8Yw5q3zROiOo52KUh4U0qEm3Oj5T62OhG/tbdHfq2/hqB2U93S/rquIseCbKUHnV4AVGIlYKGczvy8rg==", + "version": "0.13.30", + "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-0.13.30.tgz", + "integrity": "sha512-uAOrIyeHE9qYzg1Qjfpy/qlyLUFX9oyKWeHYO8NVDoI+pm5VUTMe7XWcsXPwb9iVsVmggVJcdV15Vqm9bljhxQ==", "dev": true, "dependencies": { "@codemirror/state": "^0.19.6", @@ -1924,34 +2096,181 @@ } }, "dependencies": { - "@codemirror/rangeset": { + "@codemirror/autocomplete": { + "version": "0.19.14", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-0.19.14.tgz", + "integrity": "sha512-4PqJG7GGTePc+FQF387RFebDV4ERvKj23gQBmzNtu64ZSHlYEGulwP5EIIfulBiaWEmei9TYVaMFmTdNfofpRQ==", + "dev": true, + "requires": { + "@codemirror/language": "^0.19.0", + "@codemirror/state": "^0.19.4", + "@codemirror/text": "^0.19.2", + "@codemirror/tooltip": "^0.19.12", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0" + } + }, + "@codemirror/commands": { + "version": "0.19.8", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-0.19.8.tgz", + "integrity": "sha512-65LIMSGUGGpY3oH6mzV46YWRrgao6NmfJ+AuC7jNz3K5NPnH6GCV1H5I6SwOFyVbkiygGyd0EFwrWqywTBD1aw==", + "dev": true, + "requires": { + "@codemirror/language": "^0.19.0", + "@codemirror/matchbrackets": "^0.19.0", + "@codemirror/state": "^0.19.2", + "@codemirror/text": "^0.19.6", + "@codemirror/view": "^0.19.22", + "@lezer/common": "^0.15.0" + } + }, + "@codemirror/fold": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/fold/-/fold-0.19.0.tgz", + "integrity": "sha512-cHbr2hqKe2pMls1Ia1a4IwXly87ljpmvPUKkul6H/Uv9kCwpQLOP3dGMPXbMGm/1hGjBF/0wnc+m2iba9iJBTQ==", + "dev": true, + "requires": { + "@codemirror/gutter": "^0.19.0", + "@codemirror/language": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" + } + }, + "@codemirror/gutter": { + "version": "0.19.9", + "resolved": "https://registry.npmjs.org/@codemirror/gutter/-/gutter-0.19.9.tgz", + "integrity": "sha512-PFrtmilahin1g6uL27aG5tM/rqR9DZzZYZsIrCXA5Uc2OFTFqx4owuhoU9hqfYxHp5ovfvBwQ+txFzqS4vog6Q==", + "dev": true, + "requires": { + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.23" + } + }, + "@codemirror/highlight": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@codemirror/highlight/-/highlight-0.19.7.tgz", + "integrity": "sha512-3W32hBCY0pbbv/xidismw+RDMKuIag+fo4kZIbD7WoRj+Ttcaxjf+vP6RttRHXLaaqbWh031lTeON8kMlDhMYw==", + "dev": true, + "requires": { + "@codemirror/language": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.3", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0", + "style-mod": "^4.0.0" + } + }, + "@codemirror/history": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@codemirror/history/-/history-0.19.2.tgz", + "integrity": "sha512-unhP4t3N2smzmHoo/Yio6ueWi+il8gm9VKrvi6wlcdGH5fOfVDNkmjHQ495SiR+EdOG35+3iNebSPYww0vN7ow==", + "dev": true, + "requires": { + "@codemirror/state": "^0.19.2", + "@codemirror/view": "^0.19.0" + } + }, + "@codemirror/language": { "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.19.8.tgz", - "integrity": "sha512-1vusIkxSD0vK5KQ22JO/4Ejfww5268PgM/CpKNBSpTpWZEFlZbmOPyRiY4HXO2oEzOpypbA/walMiNInWnrT0Q==", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-0.19.8.tgz", + "integrity": "sha512-KhRne8qmzSKkaw+qhkwgNsPKxmThlyeJ3umfc33B9kJzVP7xhTkwX2MEPl0almM3brxMi+lPYx7gCPOy1gHsWw==", + "dev": true, + "requires": { + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.5", + "@lezer/lr": "^0.15.0" + } + }, + "@codemirror/matchbrackets": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@codemirror/matchbrackets/-/matchbrackets-0.19.4.tgz", + "integrity": "sha512-VFkaOKPNudAA5sGP1zikRHCEKU0hjYmkKpr04pybUpQvfTvNJXlReCyP0rvH/1iEwAGPL990ZTT+QrLdu4MeEA==", + "dev": true, + "requires": { + "@codemirror/language": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0" + } + }, + "@codemirror/panel": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@codemirror/panel/-/panel-0.19.1.tgz", + "integrity": "sha512-sYeOCMA3KRYxZYJYn5PNlt9yNsjy3zTNTrbYSfVgjgL9QomIVgOJWPO5hZ2sTN8lufO6lw0vTBsIPL9MSidmBg==", + "dev": true, + "requires": { + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" + } + }, + "@codemirror/rangeset": { + "version": "0.19.9", + "resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.19.9.tgz", + "integrity": "sha512-V8YUuOvK+ew87Xem+71nKcqu1SXd5QROMRLMS/ljT5/3MCxtgrRie1Cvild0G/Z2f1fpWxzX78V0U4jjXBorBQ==", "dev": true, "requires": { "@codemirror/state": "^0.19.0" } }, - "@codemirror/state": { + "@codemirror/search": { "version": "0.19.9", - "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.9.tgz", - "integrity": "sha512-psOzDolKTZkx4CgUqhBQ8T8gBc0xN5z4gzed109aF6x7D7umpDRoimacI/O6d9UGuyl4eYuDCZmDFr2Rq7aGOw==", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-0.19.9.tgz", + "integrity": "sha512-h3MuwbUbiyOp6Np3IB5r4LH0w4inZvbtLO1Ipmz8RhElcGRiYr11Q6Bim8ocLfe08RmZT6B5EkTj1E8eNlugQQ==", + "dev": true, + "requires": { + "@codemirror/panel": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.3", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.34", + "crelt": "^1.0.5" + } + }, + "@codemirror/state": { + "version": "0.19.6", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.6.tgz", + "integrity": "sha512-sqIQZE9VqwQj7D4c2oz9mfLhlT1ElAzGB5lO1lE33BPyrdNy1cJyCIOecT4cn4VeJOFrnjOeu+IftZ3zqdFETw==", "dev": true, "requires": { "@codemirror/text": "^0.19.0" } }, + "@codemirror/stream-parser": { + "version": "git+ssh://git@github.com/lishid/stream-parser.git#26c8edae7bdf63dc34d358d1de640bdd12e7b09f", + "dev": true, + "from": "@codemirror/stream-parser@https://github.com/lishid/stream-parser", + "requires": { + "@codemirror/language": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@lezer/common": "^0.15.0", + "@lezer/lr": "^0.15.0" + } + }, "@codemirror/text": { "version": "0.19.6", "resolved": "https://registry.npmjs.org/@codemirror/text/-/text-0.19.6.tgz", "integrity": "sha512-T9jnREMIygx+TPC1bOuepz18maGq/92q2a+n4qTqObKwvNMg+8cMTslb8yxeEDEq7S3kpgGWxgO1UWbQRij0dA==", "dev": true }, + "@codemirror/tooltip": { + "version": "0.19.16", + "resolved": "https://registry.npmjs.org/@codemirror/tooltip/-/tooltip-0.19.16.tgz", + "integrity": "sha512-zxKDHryUV5/RS45AQL+wOeN+i7/l81wK56OMnUPoTSzCWNITfxHn7BToDsjtrRKbzHqUxKYmBnn/4hPjpZ4WJQ==", + "dev": true, + "requires": { + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" + } + }, "@codemirror/view": { - "version": "0.19.46", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.19.46.tgz", - "integrity": "sha512-gnIRJ4OrHt7RIC8q+NNOJeUy+nah6IOM/BPbS0uNnYPhfhpO938HCKbEE2CDLnD6LqcIBLD6u2xCKHYD9g5pTw==", + "version": "0.19.47", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.19.47.tgz", + "integrity": "sha512-SfbagKvJQl5dtt+9wYpo9sa3ZkMgUxTq+/hXDf0KVwIx+zu3cJIqfEm9xSx6yXkq7it7RsPGHaPasApNffF/8g==", "dev": true, "requires": { "@codemirror/rangeset": "^0.19.5", @@ -1962,9 +2281,9 @@ } }, "@eslint/eslintrc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.0.tgz", - "integrity": "sha512-igm9SjJHNEJRiUnecP/1R5T3wKLEJ7pL6e2P+GUSfCd0dGjPYYZve08uzw8L2J8foVHFz+NGu12JxRcU2gGo6w==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.1.tgz", + "integrity": "sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ==", "dev": true, "peer": true, "requires": { @@ -1972,20 +2291,11 @@ "debug": "^4.3.2", "espree": "^9.3.1", "globals": "^13.9.0", - "ignore": "^4.0.6", + "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true, - "peer": true - } } }, "@humanwhocodes/config-array": { @@ -2007,6 +2317,21 @@ "dev": true, "peer": true }, + "@lezer/common": { + "version": "0.15.11", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-0.15.11.tgz", + "integrity": "sha512-vv0nSdIaVCRcJ8rPuDdsrNVfBOYe/4Szr/LhF929XyDmBndLDuWiCCHooGlGlJfzELyO608AyDhVsuX/ZG36NA==", + "dev": true + }, + "@lezer/lr": { + "version": "0.15.8", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-0.15.8.tgz", + "integrity": "sha512-bM6oE6VQZ6hIFxDNKk8bKPa14hqFrV07J/vHGOeiAbJReIaQXmkVb6xQu4MR+JBTLa5arGRyAAjJe1qaQt3Uvg==", + "dev": true, + "requires": { + "@lezer/common": "^0.15.0" + } + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2049,9 +2374,9 @@ "dev": true }, "@types/json-schema": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", - "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz", + "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==", "dev": true }, "@types/node": { @@ -2070,14 +2395,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.14.0.tgz", - "integrity": "sha512-ir0wYI4FfFUDfLcuwKzIH7sMVA+db7WYen47iRSaCGl+HMAZI9fpBwfDo45ZALD3A45ZGyHWDNLhbg8tZrMX4w==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.15.0.tgz", + "integrity": "sha512-u6Db5JfF0Esn3tiAKELvoU5TpXVSkOpZ78cEGn/wXtT2RVqs2vkt4ge6N8cRCyw7YVKhmmLDbwI2pg92mlv7cA==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.14.0", - "@typescript-eslint/type-utils": "5.14.0", - "@typescript-eslint/utils": "5.14.0", + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/type-utils": "5.15.0", + "@typescript-eslint/utils": "5.15.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -2087,52 +2412,52 @@ } }, "@typescript-eslint/parser": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.14.0.tgz", - "integrity": "sha512-aHJN8/FuIy1Zvqk4U/gcO/fxeMKyoSv/rS46UXMXOJKVsLQ+iYPuXNbpbH7cBLcpSbmyyFbwrniLx5+kutu1pw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.15.0.tgz", + "integrity": "sha512-NGAYP/+RDM2sVfmKiKOCgJYPstAO40vPAgACoWPO/+yoYKSgAXIFaBKsV8P0Cc7fwKgvj27SjRNX4L7f4/jCKQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.14.0", - "@typescript-eslint/types": "5.14.0", - "@typescript-eslint/typescript-estree": "5.14.0", + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", "debug": "^4.3.2" } }, "@typescript-eslint/scope-manager": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.14.0.tgz", - "integrity": "sha512-LazdcMlGnv+xUc5R4qIlqH0OWARyl2kaP8pVCS39qSL3Pd1F7mI10DbdXeARcE62sVQE4fHNvEqMWsypWO+yEw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.15.0.tgz", + "integrity": "sha512-EFiZcSKrHh4kWk0pZaa+YNJosvKE50EnmN4IfgjkA3bTHElPtYcd2U37QQkNTqwMCS7LXeDeZzEqnsOH8chjSg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.14.0", - "@typescript-eslint/visitor-keys": "5.14.0" + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0" } }, "@typescript-eslint/type-utils": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.14.0.tgz", - "integrity": "sha512-d4PTJxsqaUpv8iERTDSQBKUCV7Q5yyXjqXUl3XF7Sd9ogNLuKLkxz82qxokqQ4jXdTPZudWpmNtr/JjbbvUixw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.15.0.tgz", + "integrity": "sha512-KGeDoEQ7gHieLydujGEFLyLofipe9PIzfvA/41urz4hv+xVxPEbmMQonKSynZ0Ks2xDhJQ4VYjB3DnRiywvKDA==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.14.0", + "@typescript-eslint/utils": "5.15.0", "debug": "^4.3.2", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.14.0.tgz", - "integrity": "sha512-BR6Y9eE9360LNnW3eEUqAg6HxS9Q35kSIs4rp4vNHRdfg0s+/PgHgskvu5DFTM7G5VKAVjuyaN476LCPrdA7Mw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.15.0.tgz", + "integrity": "sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.14.0.tgz", - "integrity": "sha512-QGnxvROrCVtLQ1724GLTHBTR0lZVu13izOp9njRvMkCBgWX26PKvmMP8k82nmXBRD3DQcFFq2oj3cKDwr0FaUA==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.15.0.tgz", + "integrity": "sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.14.0", - "@typescript-eslint/visitor-keys": "5.14.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -2141,26 +2466,26 @@ } }, "@typescript-eslint/utils": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.14.0.tgz", - "integrity": "sha512-EHwlII5mvUA0UsKYnVzySb/5EE/t03duUTweVy8Zqt3UQXBrpEVY144OTceFKaOe4xQXZJrkptCf7PjEBeGK4w==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.15.0.tgz", + "integrity": "sha512-081rWu2IPKOgTOhHUk/QfxuFog8m4wxW43sXNOMSCdh578tGJ1PAaWPsj42LOa7pguh173tNlMigsbrHvh/mtA==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.14.0", - "@typescript-eslint/types": "5.14.0", - "@typescript-eslint/typescript-estree": "5.14.0", + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/visitor-keys": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.14.0.tgz", - "integrity": "sha512-yL0XxfzR94UEkjBqyymMLgCBdojzEuy/eim7N9/RIcTNxpJudAcqsU8eRyfzBbcEzGoPWfdM3AGak3cN08WOIw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz", + "integrity": "sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.14.0", + "@typescript-eslint/types": "5.15.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -2297,6 +2622,12 @@ "dev": true, "peer": true }, + "crelt": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.5.tgz", + "integrity": "sha512-+BO9wPPi+DWTDcNYhr/W90myha8ptzftZT+LwcmUbbok0rcP/fequmFYCw8NMoH7pkAZQzU78b3kYrlua5a9eA==", + "dev": true + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2310,9 +2641,9 @@ } }, "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -2496,13 +2827,13 @@ "peer": true }, "eslint": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.10.0.tgz", - "integrity": "sha512-tcI1D9lfVec+R4LE1mNDnzoJ/f71Kl/9Cv4nG47jOueCMBrCCKYXr4AUVS7go6mWYGFD4+EoN6+eXSrEbRzXVw==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.11.0.tgz", + "integrity": "sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==", "dev": true, "peer": true, "requires": { - "@eslint/eslintrc": "^1.2.0", + "@eslint/eslintrc": "^1.2.1", "@humanwhocodes/config-array": "^0.9.2", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -2783,9 +3114,9 @@ } }, "globals": { - "version": "13.12.1", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.1.tgz", - "integrity": "sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==", + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", "dev": true, "peer": true, "requires": { @@ -2980,9 +3311,9 @@ "peer": true }, "obsidian": { - "version": "0.13.26", - "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-0.13.26.tgz", - "integrity": "sha512-7NLjrX8Yw5q3zROiOo52KUh4U0qEm3Oj5T62OhG/tbdHfq2/hqB2U93S/rquIseCbKUHnV4AVGIlYKGczvy8rg==", + "version": "0.13.30", + "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-0.13.30.tgz", + "integrity": "sha512-uAOrIyeHE9qYzg1Qjfpy/qlyLUFX9oyKWeHYO8NVDoI+pm5VUTMe7XWcsXPwb9iVsVmggVJcdV15Vqm9bljhxQ==", "dev": true, "requires": { "@codemirror/state": "^0.19.6", diff --git a/package.json b/package.json index b373c9a..6b38220 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-variables", - "version": "0.1.1", + "version": "0.2.0", "description": "Plugin that adds support for variables in Obsidian.md", "main": "main.js", "scripts": { @@ -12,12 +12,25 @@ "author": "Jean-Frédéric Faust", "license": "MIT", "devDependencies": { + "@codemirror/autocomplete": "^0.19.9", + "@codemirror/commands": "^0.19.0", + "@codemirror/fold": "0.19.0", + "@codemirror/highlight": "^0.19.0", + "@codemirror/history": "^0.19.0", + "@codemirror/language": "^0.19.0", + "@codemirror/matchbrackets": "^0.19.0", + "@codemirror/panel": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/search": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/stream-parser": "https://github.com/lishid/stream-parser", + "@codemirror/view": "^0.19.0", "@types/node": "^16.11.6", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", "builtin-modules": "^3.2.0", "esbuild": "0.13.12", - "obsidian": "^0.13.26", + "obsidian": "^0.13.8", "tslib": "2.3.1", "typescript": "4.4.4" } diff --git a/src/livePreviewPostProcessor.ts b/src/livePreviewPostProcessor.ts new file mode 100644 index 0000000..7d24adb --- /dev/null +++ b/src/livePreviewPostProcessor.ts @@ -0,0 +1,90 @@ +import { RangeSetBuilder } from "@codemirror/rangeset"; +import { Compartment, Extension } from "@codemirror/state"; +import { Decoration, DecorationSet, EditorView, PluginValue, ViewPlugin, ViewUpdate, WidgetType } from "@codemirror/view"; +import { editorLivePreviewField } from "obsidian"; +import VariablesPlugin from "./main"; +import { getLivePreviewRanges } from "./utils"; + +class LivePreviewPostProcessor implements PluginValue { + obsPlugin: VariablesPlugin; + decorations: DecorationSet = new RangeSetBuilder().finish(); + + constructor(view: EditorView, plugin: VariablesPlugin) { + this.obsPlugin = plugin; + } + + update(update: ViewUpdate) { + let builder = new RangeSetBuilder(); + if (update.state.field(editorLivePreviewField)) { + for (let { from, to } of getLivePreviewRanges(update.view)) { + if (this.obsPlugin.settings.debugMode) { + let fromLine = update.view.state.doc.lineAt(from) + builder.add(fromLine.from, fromLine.from, debugStripe); + } + + let substring = update.view.state.doc.sliceString(from, to) + if (!substring) continue; + + for (let i = 0; i < this.obsPlugin.settings.applicableVarIndexes.length; i++) { + + let idx = 0; + const varIndex = this.obsPlugin.settings.applicableVarIndexes[i]; + const variable = this.obsPlugin.settings.variables[varIndex]; + + do { + //could potentially use MatchDecorator to support regular expressions + //https://codemirror.net/6/docs/ref/#view.MatchDecorator + idx = substring.indexOf(variable.name, idx); + + if (idx >= 0) { + let start = from + idx; + let end = start + variable.name.length; + + let deco = Decoration.replace({ + widget: new VarWidget(variable.value) + }); + + builder.add(start, end, deco); + + idx += variable.name.length + 1; + } + } while (idx > 0); + } + } + } + this.decorations = builder.finish(); + } +} + +class VarWidget extends WidgetType { + constructor(readonly value: string) { super() } + + eq(other: VarWidget) { return other.value == this.value } + + // Ideally we can output a simple string but in the meantime, we use a span + // https://discuss.codemirror.net/t/can-a-replacing-decoration-generate-a-string-instead-of-an-htmlelement/4146 + toDOM() { + let wrap = document.createElement("span"); + wrap.innerHTML = this.value; + return wrap + } + + ignoreEvent() { return false } +} + +const debugTheme = EditorView.baseTheme({ + "&light .cm-debug": { backgroundColor: "#597f7f" }, + "&dark .cm-debug": { backgroundColor: "#597f7f" } +}); +const debugStripe = Decoration.line({ + attributes: { class: "cm-debug" } +}); + +export function livePreviewPostProcessorPlugin(plugin: VariablesPlugin): Extension { + return [ + debugTheme, + ViewPlugin.define(v => new LivePreviewPostProcessor(v, plugin), { + decorations: v => v.decorations + }) + ] +} \ No newline at end of file diff --git a/main.ts b/src/main.ts similarity index 78% rename from main.ts rename to src/main.ts index b56cc89..a029b5f 100644 --- a/main.ts +++ b/src/main.ts @@ -1,28 +1,7 @@ -import { App, debounce, FileSystemAdapter, Plugin, PluginSettingTab, Setting } from 'obsidian'; - -interface VarConfig { - vaultPath: string; - name: string; - value: string; -} - -interface VariablesPluginSettings { - filter: string; - variables: VarConfig[]; - showApplicableVars: boolean; - applicableVarIndexes: number[]; -} - -const DEFAULT_SETTINGS: VariablesPluginSettings = { - filter: "", - variables: [{ - vaultPath: "*", - name: "demo", - value: "swapped" - }], - showApplicableVars: false, - applicableVarIndexes: [0] -} +import { livePreviewPostProcessorPlugin } from './livePreviewPostProcessor'; +import { App, debounce, Plugin, PluginSettingTab, Setting } from 'obsidian'; +import { getVaultAbsolutePath } from './utils'; +import { DEFAULT_SETTINGS, VariablesPluginSettings } from './settings'; export default class VariablesPlugin extends Plugin { settings: VariablesPluginSettings; @@ -30,8 +9,20 @@ export default class VariablesPlugin extends Plugin { async onload() { await this.loadSettings(); + this.addSettingTab(new VariablesSettingTab(this.app, this)); + + this.addCommand({ + id: 'plugin-vars-manage-variables', + name: 'Manage variables', + callback: () => { + //@ts-expect-error, not exposed in obsidian.d.ts + this.app.setting.open(); + //@ts-expect-error, not exposed in obsidian.d.ts + this.app.setting.openTabById("obsidian-variables"); + } + }); + this.registerMarkdownPostProcessor((element, context) => { - console.log("Running MPP for element:" + element.getText()) for (let i = 0; i < this.settings.applicableVarIndexes.length; i++) { const variable = this.settings.variables[this.settings.applicableVarIndexes[i]]; @@ -39,7 +30,7 @@ export default class VariablesPlugin extends Plugin { } }); - this.addSettingTab(new VariablesSettingTab(this.app, this)); + this.registerEditorExtension(livePreviewPostProcessorPlugin(this)); } onunload() { @@ -55,10 +46,6 @@ export default class VariablesPlugin extends Plugin { } } -function getVaultAbsolutePath(app: App) { - return (this.app.vault.adapter as any).basePath; -} - class VariablesSettingTab extends PluginSettingTab { plugin: VariablesPlugin; debouncedRefresh = debounce(() => { this.display(); document.getElementById("plugin-vars-filter-input").focus(); }, 700, true); @@ -90,7 +77,7 @@ class VariablesSettingTab extends PluginSettingTab { .setTooltip("Open documentation on GitHub") .setIcon("help") .onClick(() => { - window.open("https://github.com/jffaust/obsidian-variables", '_blank'); + window.open("https://github.com/jffaust/obsidian-variables/docs/documentation.md", '_blank'); }) ) .addButton(btn => btn @@ -191,5 +178,17 @@ class VariablesSettingTab extends PluginSettingTab { } this.plugin.settings.applicableVarIndexes = Object.values(newIndexesMap); + + let debugMode = false; + for (let i = 0; i < this.plugin.settings.applicableVarIndexes.length; i++) { + + const varIndex = this.plugin.settings.applicableVarIndexes[i]; + const variable = this.plugin.settings.variables[varIndex]; + if (variable.name == "$DEBUG" && variable.value == "true") { + debugMode = true; + } + } + + this.plugin.settings.debugMode = debugMode; } } diff --git a/src/settings.ts b/src/settings.ts new file mode 100644 index 0000000..3ffb8fc --- /dev/null +++ b/src/settings.ts @@ -0,0 +1,25 @@ +export interface VarConfig { + vaultPath: string; + name: string; + value: string; +} + +export interface VariablesPluginSettings { + filter: string; + variables: VarConfig[]; + showApplicableVars: boolean; + applicableVarIndexes: number[]; + debugMode: boolean; +} + +export const DEFAULT_SETTINGS: VariablesPluginSettings = { + filter: "", + variables: [{ + vaultPath: "*", + name: "$var", + value: "swapped" + }], + showApplicableVars: false, + applicableVarIndexes: [0], + debugMode: false +} \ No newline at end of file diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..0f9e938 --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,37 @@ +import { EditorView } from "@codemirror/view"; +import { App } from "obsidian"; + +export function getVaultAbsolutePath(app: App) { + return (this.app.vault.adapter as any).basePath; +} + +export function getLivePreviewRanges(view: EditorView) { + + let selectedLines = new Set(); + for (let { from, to } of view.state.selection.ranges) { + //algo can likely be improved for large selections + for (let pos = from; pos <= to; pos++) { + let line = view.state.doc.lineAt(pos); + selectedLines.add(line.number); + } + } + + let livePreviewLines = new Set(); + for (let { from, to } of view.visibleRanges) { + for (let pos = from; pos <= to; pos++) { + + let line = view.state.doc.lineAt(pos); + if (!selectedLines.has(line.number)) { + livePreviewLines.add(line.number); + } + } + } + + let livePreviewRanges = []; + for (let lineNumber of livePreviewLines) { + let line = view.state.doc.line(lineNumber) + livePreviewRanges.push({ from: line.from, to: line.to }); + } + + return livePreviewRanges; +} \ No newline at end of file diff --git a/styles.css b/styles.css index 6dedc17..b2f660c 100644 --- a/styles.css +++ b/styles.css @@ -23,4 +23,4 @@ div.setting-item.plugin-vars-list div.setting-item-info { div.setting-item.plugin-vars-list div.setting-item-control input { flex: 1 1 auto; -} +} \ No newline at end of file