├── dist ├── interfaces.js ├── interfaces.d.ts ├── index.js ├── index.d.ts ├── utils.d.ts └── utils.js ├── CODEOWNERS ├── .gitignore ├── docs ├── assets │ ├── icons.png │ ├── widgets.png │ ├── icons@2x.png │ ├── widgets@2x.png │ ├── highlight.css │ ├── search.js │ ├── style.css │ ├── icons.css │ └── main.js ├── .nojekyll ├── index.html └── classes │ └── RenderedMarkdownModal.html ├── src ├── interfaces.ts ├── index.ts └── utils.ts ├── jest.config.js ├── .github └── pull_request_template.md ├── tsconfig.json ├── tests ├── browser_dependent.test.ts └── util.test.ts ├── LICENSE ├── __mocks__ └── obsidian.ts ├── package.json ├── README.md └── CHANGELOG.md /dist/interfaces.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @obsidian-community/community-lib -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Intellij 2 | *.iml 3 | .idea 4 | 5 | # npm 6 | node_modules 7 | package-lock.json 8 | yarn.lock -------------------------------------------------------------------------------- /docs/assets/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obsidian-community/obsidian-community-lib/HEAD/docs/assets/icons.png -------------------------------------------------------------------------------- /docs/assets/widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obsidian-community/obsidian-community-lib/HEAD/docs/assets/widgets.png -------------------------------------------------------------------------------- /src/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface ResolvedLinks { 2 | [from: string]: { 3 | [to: string]: number; 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /docs/assets/icons@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obsidian-community/obsidian-community-lib/HEAD/docs/assets/icons@2x.png -------------------------------------------------------------------------------- /docs/assets/widgets@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obsidian-community/obsidian-community-lib/HEAD/docs/assets/widgets@2x.png -------------------------------------------------------------------------------- /dist/interfaces.d.ts: -------------------------------------------------------------------------------- 1 | export interface ResolvedLinks { 2 | [from: string]: { 3 | [to: string]: number; 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ 2 | module.exports = { 3 | preset: 'ts-jest', 4 | testEnvironment: 'node', 5 | }; -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | - [ ] I agree to the contribution guidelines laid out [here](https://github.com/obsidian-community/obsidian-community-lib#contributing) in the readme. 2 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "ESNext", 4 | "lib": [ 5 | "dom", 6 | "es2018" 7 | ], 8 | "target": "ES2018", 9 | "declaration": true, 10 | "outDir": "./dist", 11 | "moduleResolution": "Node", 12 | "esModuleInterop": true 13 | }, 14 | "include": ["src/**/*"] 15 | } 16 | -------------------------------------------------------------------------------- /tests/browser_dependent.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @jest-environment jsdom 3 | */ 4 | 5 | import { App } from "obsidian"; 6 | import * as ocl from "../src/index"; 7 | 8 | window.app = new App(); 9 | 10 | describe("getSelectionFromCurrFile", () => { 11 | test("returns selection From Window", async () => { 12 | expect(typeof await ocl.getSelectionFromCurrFile()).toBe("string"); 13 | }); 14 | }); -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | export { addAllFeatherIcons, addFeatherIcon, base64ToArrayBuffer, getAvailablePathForAttachments, wait, copy, getSelectionFromCurrFile, getSelectionFromEditor, hoverPreview, isInVault, createNewMDNote, openOrSwitch, isLinked, isResolved, addRenderedMarkdownButton, RenderedMarkdownModal, openView, saveViewSide, addMD, stripMD, resolvedLinksComplete, waitForResolvedLinks, splitAtYaml, getActiveFileContent, } from "./utils"; 2 | -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | export { addAllFeatherIcons, addFeatherIcon, base64ToArrayBuffer, getAvailablePathForAttachments, wait, copy, getSelectionFromCurrFile, getSelectionFromEditor, hoverPreview, isInVault, createNewMDNote, openOrSwitch, isLinked, isResolved, addRenderedMarkdownButton, RenderedMarkdownModal, openView, saveViewSide, addMD, stripMD, resolvedLinksComplete, waitForResolvedLinks, splitAtYaml, getActiveFileContent, } from "./utils"; 2 | export { ResolvedLinks } from "./interfaces"; 3 | -------------------------------------------------------------------------------- /docs/assets/highlight.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --light-code-background: #FFFFFF; 3 | --dark-code-background: #1E1E1E; 4 | } 5 | 6 | @media (prefers-color-scheme: light) { :root { 7 | --code-background: var(--light-code-background); 8 | } } 9 | 10 | @media (prefers-color-scheme: dark) { :root { 11 | --code-background: var(--dark-code-background); 12 | } } 13 | 14 | body.light { 15 | --code-background: var(--light-code-background); 16 | } 17 | 18 | body.dark { 19 | --code-background: var(--dark-code-background); 20 | } 21 | 22 | pre, code { background: var(--code-background); } 23 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export { 2 | addAllFeatherIcons, 3 | addFeatherIcon, 4 | base64ToArrayBuffer, 5 | getAvailablePathForAttachments, 6 | wait, 7 | copy, 8 | getSelectionFromCurrFile, 9 | getSelectionFromEditor, 10 | hoverPreview, 11 | isInVault, 12 | createNewMDNote, 13 | openOrSwitch, 14 | isLinked, 15 | isResolved, 16 | addRenderedMarkdownButton, 17 | RenderedMarkdownModal, 18 | openView, 19 | saveViewSide, 20 | addMD, 21 | stripMD, 22 | resolvedLinksComplete, 23 | waitForResolvedLinks, 24 | splitAtYaml, 25 | getActiveFileContent, 26 | } from "./utils"; 27 | 28 | export { ResolvedLinks } from "./interfaces"; 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2021 SkepticMystic 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 4 | 5 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 6 | -------------------------------------------------------------------------------- /__mocks__/obsidian.ts: -------------------------------------------------------------------------------- 1 | /* Based on https://github.com/blacksmithgu/obsidian-dataview/tree/master/__mocks__ with some additions*/ 2 | 3 | import { EventEmitter } from "events"; 4 | 5 | /** Basic obsidian abstraction for any file or folder in a vault. */ 6 | export abstract class TAbstractFile { 7 | /** 8 | * @public 9 | */ 10 | vault: Vault; 11 | /** 12 | * @public 13 | */ 14 | path: string; 15 | /** 16 | * @public 17 | */ 18 | name: string; 19 | /** 20 | * @public 21 | */ 22 | parent: TFolder; 23 | } 24 | 25 | /** Tracks file created/modified time as well as file system size. */ 26 | export interface FileStats { 27 | /** @public */ 28 | ctime: number; 29 | /** @public */ 30 | mtime: number; 31 | /** @public */ 32 | size: number; 33 | } 34 | 35 | /** A regular file in the vault. */ 36 | export class TFile extends TAbstractFile { 37 | stat: FileStats; 38 | basename: string; 39 | extension: string; 40 | } 41 | 42 | /** A folder in the vault. */ 43 | export class TFolder extends TAbstractFile { 44 | children: TAbstractFile[]; 45 | 46 | isRoot(): boolean { 47 | return false; 48 | } 49 | } 50 | 51 | export class Vault extends EventEmitter { 52 | getFiles() { 53 | return []; 54 | } 55 | trigger(name: string, ...data: any[]): void { 56 | this.emit(name, ...data); 57 | } 58 | async cachedRead(file: TFile): Promise { 59 | return new Promise((resolve) => resolve("Cached File Contents")); 60 | } 61 | } 62 | 63 | export class Component { 64 | registerEvent() {} 65 | } 66 | 67 | /* Additions: */ 68 | 69 | export class Modal { 70 | 71 | } 72 | 73 | export class Editor { 74 | somethingSelected(): boolean { 75 | return Math.random() < 0.5; 76 | } 77 | 78 | getSelection(): string { 79 | return "Current selection"; 80 | } 81 | 82 | getValue(): string { 83 | return "Whole Document"; 84 | } 85 | } 86 | 87 | export class App { 88 | workspace = { 89 | getActiveFile() { 90 | return new TFile(); 91 | } 92 | } 93 | 94 | vault = new Vault(); 95 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "obsidian-community-lib", 3 | "version": "2.0.1", 4 | "description": "Commonly used functions in Obsidian plugins", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "files": [ 8 | "/dist" 9 | ], 10 | "scripts": { 11 | "test": "jest", 12 | "compile": "tsc && git commit -am \"chore: :package: Compile\"", 13 | "docs": "npx typedoc ./src/utils.ts && git commit -am \"chore: :memo: Update docs site\"", 14 | "all": "npm run test && npm run compile && npm run docs && npm run release", 15 | "release": "standard-version" 16 | }, 17 | "standard-version": { 18 | "t": "", 19 | "types": [ 20 | { 21 | "type": "feat", 22 | "section": "Features" 23 | }, 24 | { 25 | "type": "fix", 26 | "section": "Bug Fixes" 27 | }, 28 | { 29 | "type": "docs", 30 | "section": "Documentation" 31 | } 32 | ], 33 | "header": "## Obsidian Community Lib Changelog" 34 | }, 35 | "repository": { 36 | "type": "git", 37 | "url": "git+https://github.com/obsidian-community/obsidian-community-lib.git" 38 | }, 39 | "keywords": [ 40 | "obsidianmd" 41 | ], 42 | "author": "SkepticMystic", 43 | "license": "ISC", 44 | "bugs": { 45 | "url": "https://github.com/obsidian-community/obsidian-community-lib/issues" 46 | }, 47 | "homepage": "https://github.com/obsidian-community/obsidian-community-lib#readme", 48 | "devDependencies": { 49 | "@types/events": "^3.0.0", 50 | "@types/feather-icons": "^4.29.1", 51 | "@types/jest": "^29.5.4", 52 | "events": "^3.3.0", 53 | "jest": "^29.6.4", 54 | "jest-environment-jsdom": "^29.6.4", 55 | "standard-version": "^9.3.2", 56 | "ts-jest": "^29.1.1", 57 | "ts-node": "^10.7.0", 58 | "typedoc": "^0.25.0", 59 | "typescript": "^5.2.2" 60 | }, 61 | "dependencies": { 62 | "feather-icons": "^4.28.0", 63 | "obsidian": "^1.4.4" 64 | } 65 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![npm](https://img.shields.io/npm/v/obsidian-community-lib?color=purple) 2 | 3 | # Obsidian Community Lib 4 | 5 | This is a community-maintaned library of commonly used functions when developing Obsidian plugins. 6 | 7 | To use the library in your plugin: 8 | 9 | 1. Install it using `npm i obsidian-community-lib`, 10 | 2. Then grab functions out of the library using `import { function } from "obsidian-community-lib"`. 11 | 12 | **Read more about the included methods [here](https://obsidian-community.github.io/obsidian-community-lib/modules.html).** 13 | 14 | ## Contributing 15 | 16 | > **Disclaimer**: By contributing to this repository, you grant the maintainer an irrevocable license to use the contribution under the license specified in the `LICENSE` file found in the root of this repository. 17 | > The maintainer of this project can choose to change the license, or transfer maintainer status at any time. 18 | > Every contributor must not infringe any copyright in their contribution. 19 | 20 | This library is very much made for everyone to use and contribute to. If you would like to add a function or edit existing functions, please submit a pull request with your changes. 21 | 22 | To add new functions, go to `src/utils.ts` and add your code as an exported function. 23 | You can also add an entirely new file under `src` to better organise everything! 24 | 25 | Then, go to `src/index.ts` and export your functions from the appropriate file. See `src/index.ts` for examples of how to do this. 26 | 27 | ### Conventional Commits 28 | 29 | In your commit messages, it is highly encouraged for you to use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format. This helps keep everything standardised, and allows us to automatically create a changelog file using the commit messages. 30 | 31 | VS Code has a conventional commits extension you can use to make this even easier! 32 | 33 | ![](https://i.imgur.com/9TXVdwA.png) 34 | 35 | ### TS Doc 36 | 37 | In order to make your functions more useable for others, please consider using [TS Doc](https://tsdoc.org) to document your code in a standardised way. 38 | 39 | This will show a nicely formatted description of your function when a user hovers over it: 40 | 41 | ![](https://i.imgur.com/VOPAybr.png) 42 | 43 | VS Code has an extension to automate alot of this process based on the type declarations in the function definition: 44 | 45 | ![image](https://user-images.githubusercontent.com/70717676/138588097-9c4601f7-234d-409d-8cf1-d49722ebe47d.png) 46 | -------------------------------------------------------------------------------- /tests/util.test.ts: -------------------------------------------------------------------------------- 1 | import { Editor } from "../__mocks__/obsidian"; 2 | import * as ocl from "../src/index"; 3 | 4 | describe("wait", () => { 5 | test("actually waits atleast 1000ms", async () => { 6 | const start = new Date().getTime(); 7 | await ocl.wait(1000); 8 | const elapsed = new Date().getTime() - start; 9 | expect(elapsed).toBeGreaterThanOrEqual(1000); 10 | }); 11 | 12 | test("actually waits atleast 50ms", async () => { 13 | const start = new Date().getTime(); 14 | await ocl.wait(50); 15 | const elapsed = new Date().getTime() - start; 16 | expect(elapsed).toBeGreaterThanOrEqual(50); 17 | }); 18 | }); 19 | 20 | describe("getSelectionFromEditor", () => { 21 | test("returns string", () => { 22 | //@ts-expect-error 23 | expect(typeof ocl.getSelectionFromEditor(new Editor())).toEqual("string"); 24 | }); 25 | }); 26 | 27 | describe("addMD", () => { 28 | test("Doesn't add duplicate .md to end of filename", () => { 29 | expect(ocl.addMD("filename.md")).toEqual("filename.md"); 30 | }); 31 | 32 | test("Does add .md to end of filename", () => { 33 | expect(ocl.addMD("filename")).toEqual("filename.md"); 34 | }); 35 | 36 | test("Does add .md to end of filename", () => { 37 | expect(ocl.addMD("filenamemd")).toEqual("filenamemd.md"); 38 | }); 39 | 40 | test("Does add .md to end of filename", () => { 41 | expect(ocl.addMD(".md")).toEqual(".md"); 42 | }); 43 | 44 | test("Doesn't add .md to end of filename when .MD is present", () => { 45 | expect(ocl.addMD("filename.MD")).toEqual("filename.MD"); 46 | }); 47 | }); 48 | 49 | describe("stripMD", () => { 50 | test("If .md isn't present, return the same string", () => { 51 | expect(ocl.stripMD("base_.md_name")).toEqual("base_.md_name"); 52 | }); 53 | 54 | test("If .md is present, strip it", () => { 55 | expect(ocl.stripMD("filename.md")).toEqual("filename"); 56 | }); 57 | 58 | test("If .MD is present, strip it", () => { 59 | expect(ocl.stripMD("filename.MD")).toEqual("filename"); 60 | }); 61 | 62 | test("If .md is not at the end, don't strip it", () => { 63 | expect(ocl.stripMD("file_.md_name.md")).toEqual("file_.md_name"); 64 | }); 65 | }); 66 | 67 | describe("splitAtYaml", () => { 68 | test("Properly splits Yaml and Note (Yaml present)", () => { 69 | const [yaml, note] = ocl.splitAtYaml(`--- 70 | tags: ["Test"] 71 | aliases: ["asdf"] 72 | --- 73 | 74 | # Note 75 | 76 | Lorem *ipsum* 77 | `); 78 | expect(yaml).toEqual(`--- 79 | tags: ["Test"] 80 | aliases: ["asdf"] 81 | ---`); 82 | expect(note).toEqual(` 83 | 84 | # Note 85 | 86 | Lorem *ipsum* 87 | `) 88 | }); 89 | 90 | test("Properly splits Yaml and note (Yaml not present)", () => { 91 | const[yaml, note] = ocl.splitAtYaml("# Note\nLorem *ipsum*"); 92 | expect(yaml).toEqual(""); 93 | expect(note).toEqual("# Note\nLorem *ipsum*") 94 | }); 95 | }); -------------------------------------------------------------------------------- /docs/assets/search.js: -------------------------------------------------------------------------------- 1 | window.searchData = {"kinds":{"64":"Function","128":"Class","512":"Constructor","1024":"Property","2048":"Method"},"rows":[{"id":0,"kind":64,"name":"wait","url":"modules.html#wait","classes":"tsd-kind-function"},{"id":1,"kind":64,"name":"addAllFeatherIcons","url":"modules.html#addAllFeatherIcons","classes":"tsd-kind-function"},{"id":2,"kind":64,"name":"addFeatherIcon","url":"modules.html#addFeatherIcon","classes":"tsd-kind-function"},{"id":3,"kind":64,"name":"base64ToArrayBuffer","url":"modules.html#base64ToArrayBuffer","classes":"tsd-kind-function"},{"id":4,"kind":64,"name":"getAvailablePathForAttachments","url":"modules.html#getAvailablePathForAttachments","classes":"tsd-kind-function"},{"id":5,"kind":64,"name":"copy","url":"modules.html#copy","classes":"tsd-kind-function"},{"id":6,"kind":64,"name":"getSelectionFromEditor","url":"modules.html#getSelectionFromEditor","classes":"tsd-kind-function"},{"id":7,"kind":64,"name":"getSelectionFromCurrFile","url":"modules.html#getSelectionFromCurrFile","classes":"tsd-kind-function"},{"id":8,"kind":64,"name":"hoverPreview","url":"modules.html#hoverPreview","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":9,"kind":64,"name":"createNewMDNote","url":"modules.html#createNewMDNote","classes":"tsd-kind-function"},{"id":10,"kind":64,"name":"openOrSwitch","url":"modules.html#openOrSwitch","classes":"tsd-kind-function"},{"id":11,"kind":64,"name":"isLinked","url":"modules.html#isLinked","classes":"tsd-kind-function"},{"id":12,"kind":64,"name":"isResolved","url":"modules.html#isResolved","classes":"tsd-kind-function"},{"id":13,"kind":64,"name":"openView","url":"modules.html#openView","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":14,"kind":64,"name":"saveViewSide","url":"modules.html#saveViewSide","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":15,"kind":64,"name":"addRenderedMarkdownButton","url":"modules.html#addRenderedMarkdownButton","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":16,"kind":64,"name":"resolvedLinksComplete","url":"modules.html#resolvedLinksComplete","classes":"tsd-kind-function"},{"id":17,"kind":64,"name":"waitForResolvedLinks","url":"modules.html#waitForResolvedLinks","classes":"tsd-kind-function"},{"id":18,"kind":64,"name":"splitAtYaml","url":"modules.html#splitAtYaml","classes":"tsd-kind-function"},{"id":19,"kind":64,"name":"getActiveFileContent","url":"modules.html#getActiveFileContent","classes":"tsd-kind-function"},{"id":20,"kind":64,"name":"isInVault","url":"modules.html#isInVault","classes":"tsd-kind-function"},{"id":21,"kind":64,"name":"addMD","url":"modules.html#addMD","classes":"tsd-kind-function"},{"id":22,"kind":64,"name":"stripMD","url":"modules.html#stripMD","classes":"tsd-kind-function"},{"id":23,"kind":128,"name":"RenderedMarkdownModal","url":"classes/RenderedMarkdownModal.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":24,"kind":512,"name":"constructor","url":"classes/RenderedMarkdownModal.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter tsd-is-overwrite","parent":"RenderedMarkdownModal"},{"id":25,"kind":1024,"name":"plugin","url":"classes/RenderedMarkdownModal.html#plugin","classes":"tsd-kind-property tsd-parent-kind-class","parent":"RenderedMarkdownModal"},{"id":26,"kind":1024,"name":"source","url":"classes/RenderedMarkdownModal.html#source","classes":"tsd-kind-property tsd-parent-kind-class","parent":"RenderedMarkdownModal"},{"id":27,"kind":1024,"name":"fetch","url":"classes/RenderedMarkdownModal.html#fetch","classes":"tsd-kind-property tsd-parent-kind-class","parent":"RenderedMarkdownModal"},{"id":28,"kind":2048,"name":"onOpen","url":"classes/RenderedMarkdownModal.html#onOpen","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-overwrite","parent":"RenderedMarkdownModal"},{"id":29,"kind":2048,"name":"onClose","url":"classes/RenderedMarkdownModal.html#onClose","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-overwrite","parent":"RenderedMarkdownModal"}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,30.285]],["parent/0",[]],["name/1",[1,30.285]],["parent/1",[]],["name/2",[2,30.285]],["parent/2",[]],["name/3",[3,30.285]],["parent/3",[]],["name/4",[4,30.285]],["parent/4",[]],["name/5",[5,30.285]],["parent/5",[]],["name/6",[6,30.285]],["parent/6",[]],["name/7",[7,30.285]],["parent/7",[]],["name/8",[8,30.285]],["parent/8",[]],["name/9",[9,30.285]],["parent/9",[]],["name/10",[10,30.285]],["parent/10",[]],["name/11",[11,30.285]],["parent/11",[]],["name/12",[12,30.285]],["parent/12",[]],["name/13",[13,30.285]],["parent/13",[]],["name/14",[14,30.285]],["parent/14",[]],["name/15",[15,30.285]],["parent/15",[]],["name/16",[16,30.285]],["parent/16",[]],["name/17",[17,30.285]],["parent/17",[]],["name/18",[18,30.285]],["parent/18",[]],["name/19",[19,30.285]],["parent/19",[]],["name/20",[20,30.285]],["parent/20",[]],["name/21",[21,30.285]],["parent/21",[]],["name/22",[22,30.285]],["parent/22",[]],["name/23",[23,14.191]],["parent/23",[]],["name/24",[24,30.285]],["parent/24",[23,0.538]],["name/25",[25,30.285]],["parent/25",[23,0.538]],["name/26",[26,30.285]],["parent/26",[23,0.538]],["name/27",[27,30.285]],["parent/27",[23,0.538]],["name/28",[28,30.285]],["parent/28",[23,0.538]],["name/29",[29,30.285]],["parent/29",[23,0.538]]],"invertedIndex":[["addallfeathericons",{"_index":1,"name":{"1":{}},"parent":{}}],["addfeathericon",{"_index":2,"name":{"2":{}},"parent":{}}],["addmd",{"_index":21,"name":{"21":{}},"parent":{}}],["addrenderedmarkdownbutton",{"_index":15,"name":{"15":{}},"parent":{}}],["base64toarraybuffer",{"_index":3,"name":{"3":{}},"parent":{}}],["constructor",{"_index":24,"name":{"24":{}},"parent":{}}],["copy",{"_index":5,"name":{"5":{}},"parent":{}}],["createnewmdnote",{"_index":9,"name":{"9":{}},"parent":{}}],["fetch",{"_index":27,"name":{"27":{}},"parent":{}}],["getactivefilecontent",{"_index":19,"name":{"19":{}},"parent":{}}],["getavailablepathforattachments",{"_index":4,"name":{"4":{}},"parent":{}}],["getselectionfromcurrfile",{"_index":7,"name":{"7":{}},"parent":{}}],["getselectionfromeditor",{"_index":6,"name":{"6":{}},"parent":{}}],["hoverpreview",{"_index":8,"name":{"8":{}},"parent":{}}],["isinvault",{"_index":20,"name":{"20":{}},"parent":{}}],["islinked",{"_index":11,"name":{"11":{}},"parent":{}}],["isresolved",{"_index":12,"name":{"12":{}},"parent":{}}],["onclose",{"_index":29,"name":{"29":{}},"parent":{}}],["onopen",{"_index":28,"name":{"28":{}},"parent":{}}],["openorswitch",{"_index":10,"name":{"10":{}},"parent":{}}],["openview",{"_index":13,"name":{"13":{}},"parent":{}}],["plugin",{"_index":25,"name":{"25":{}},"parent":{}}],["renderedmarkdownmodal",{"_index":23,"name":{"23":{}},"parent":{"24":{},"25":{},"26":{},"27":{},"28":{},"29":{}}}],["resolvedlinkscomplete",{"_index":16,"name":{"16":{}},"parent":{}}],["saveviewside",{"_index":14,"name":{"14":{}},"parent":{}}],["source",{"_index":26,"name":{"26":{}},"parent":{}}],["splitatyaml",{"_index":18,"name":{"18":{}},"parent":{}}],["stripmd",{"_index":22,"name":{"22":{}},"parent":{}}],["wait",{"_index":0,"name":{"0":{}},"parent":{}}],["waitforresolvedlinks",{"_index":17,"name":{"17":{}},"parent":{}}]],"pipeline":[]}} -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | obsidian-community-lib
Options
All
  • Public
  • Public/Protected
  • All
Menu

obsidian-community-lib

npm

2 | 3 | 4 |

Obsidian Community Lib

5 |
6 |

This is a community-maintaned library of commonly used functions when developing Obsidian plugins.

7 |

To use the library in your plugin:

8 |
    9 |
  1. Install it using npm i obsidian-community-lib,
  2. 10 |
  3. Then grab functions out of the library using import { function } from "obsidian-community-lib".
  4. 11 |
12 |

Read more about the included methods here.

13 | 14 | 15 |

Contributing

16 |
17 |
18 |

Disclaimer: By contributing to this repository, you grant the maintainer an irrevocable license to use the contribution under the license specified in the LICENSE file found in the root of this repository. 19 | The maintainer of this project can choose to change the license, or transfer maintainer status at any time. 20 | Every contributor must not infringe any copyright in their contribution.

21 |
22 |

This library is very much made for everyone to use and contribute to. If you would like to add a function or edit existing functions, please submit a pull request with your changes.

23 |

To add new functions, go to src/utils.ts and add your code as an exported function. 24 | You can also add an entirely new file under src to better organise everything!

25 |

Then, go to src/index.ts and export your functions from the appropriate file. See src/index.ts for examples of how to do this.

26 | 27 | 28 |

Conventional Commits

29 |
30 |

In your commit messages, it is highly encouraged for you to use the Conventional Commits format. This helps keep everything standardised, and allows us to automatically create a changelog file using the commit messages.

31 |

VS Code has a conventional commits extension you can use to make this even easier!

32 |

33 | 34 | 35 |

TS Doc

36 |
37 |

In order to make your functions more useable for others, please consider using TS Doc to document your code in a standardised way.

38 |

This will show a nicely formatted description of your function when a user hovers over it:

39 |

40 |

VS Code has an extension to automate alot of this process based on the type declarations in the function definition:

41 |

image

42 |

Generated using TypeDoc

-------------------------------------------------------------------------------- /dist/utils.d.ts: -------------------------------------------------------------------------------- 1 | import { Constructor, Editor, ItemView, Modal, Plugin, TFile } from "obsidian"; 2 | import { ResolvedLinks } from "./interfaces"; 3 | /** 4 | * You can await this Function to delay execution 5 | * 6 | * @param delay The delay in ms 7 | */ 8 | export declare function wait(delay: number): Promise; 9 | /** 10 | * Adds all official Feather Icons to Obsidian. 11 | * https://feathericons.com/ 12 | * 13 | * @param attr SVG Attributes for the Icon. The default should work for most usecases. 14 | * 15 | * @deprecated As of Obsidian 0.13.27 this is no longer needed, because Obsidian ships with `lucide`, a maintained fork of feather. (https://lucide.dev/) 16 | */ 17 | export declare function addAllFeatherIcons(attr?: { 18 | viewBox: string; 19 | width: string; 20 | height: string; 21 | }): void; 22 | /** 23 | * Adds a specific Feather Icon to Obsidian. 24 | * 25 | * @param name official Name of the Icon (https://feathericons.com/) 26 | * @param attr SVG Attributes for the Icon. The default should work for most usecases. 27 | * @returns {string} Icon name 28 | * 29 | * @deprecated As of Obsidian 0.13.27 this is no longer needed, because Obsidian ships with `lucide`, a maintained fork of feather. (https://lucide.dev/) 30 | */ 31 | export declare function addFeatherIcon(name: string, attr?: { 32 | viewBox: string; 33 | width: string; 34 | height: string; 35 | }): string | void; 36 | /** 37 | * Convert a base64 String to an ArrayBuffer. 38 | * You can then use the ArrayBuffer to save the asset to disk. 39 | * 40 | * @param base64 base64 string to be converted. 41 | * @returns ArrayBuffer 42 | * @deprecated Obsidian offers it's own method as of 0.14.5 43 | */ 44 | export declare function base64ToArrayBuffer(base64: string): ArrayBuffer; 45 | /** 46 | * This is a helper method for an undocumented API of Obsidian. 47 | * 48 | * @param fileName The Filename for your Attachment 49 | * @param format The Fileformat of your Attachment 50 | * @param sourceFile The Sourcefile from where the Attachment gets added, this is needed because the Attachment Folder might be different based on where it gets inserted. 51 | * @returns The Attachment Path 52 | */ 53 | export declare function getAvailablePathForAttachments(fileName: string, format: string, sourceFile: TFile): string; 54 | /** 55 | * Copy `content` to the users clipboard. 56 | * 57 | * @param {string} content The content to be copied to clipboard. 58 | * @param {() => any} success The callback to run when text is successfully copied. Default throws a new `Notice` 59 | * @param {(reason?) => any} failure The callback to run when text was not able to be copied. Default throws a new `Notice`, and console logs the error.` 60 | */ 61 | export declare function copy(content: string, success?: () => any, failure?: (reason?: any) => any): Promise; 62 | /** 63 | * Given an editor, check if something is selected and return that selection, otherwise return the entire content of the editor 64 | * @param {Editor} editor 65 | */ 66 | export declare function getSelectionFromEditor(editor: Editor): string; 67 | /** 68 | * Check if something is selected in the current file and return that selection, otherwise return the entire content of the current file. 69 | * @param {boolean} [cached=true] Use `cachedRead` or `read`. `cachedRead` by default. 70 | * @returns {string | null} `null` if not focussed on a markdown file 71 | */ 72 | export declare function getSelectionFromCurrFile(cached?: boolean): Promise; 73 | /** 74 | * Check if `noteName` is the name of a note that exists in the vault. 75 | * @param {string} noteName Basename of the note to search for. 76 | * @param {string} [sourcePath=""] Optional file path to start searching from. Default is the current file. 77 | * @returns boolean 78 | */ 79 | export declare const isInVault: (noteName: string, sourcePath?: string) => boolean; 80 | /** 81 | * When hovering a link going to `to`, show the Obsidian hover-preview of that note. 82 | * 83 | * You probably have to hold down `Ctrl` when hovering the link for the preview to appear! 84 | * @param {MouseEvent} event 85 | * @param {YourView} view The view with the link being hovered 86 | * @param {string} to The basename of the note to preview. 87 | * @template YourView The ViewType of your view 88 | * @returns void 89 | */ 90 | export declare function hoverPreview(event: MouseEvent, view: YourView, to: string): void; 91 | /** 92 | * Create a new markdown note named `newName` in the user's preffered new-note-folder. 93 | * @param {string} newName Name of new note (with or without '.md') 94 | * @param {string} [currFilePath=""] File path of the current note. Use an empty string if there is no active file. 95 | * @returns {Promise} new TFile 96 | */ 97 | export declare function createNewMDNote(newName: string, currFilePath?: string): Promise; 98 | /** 99 | * Add '.md' to `noteName` if it isn't already there. 100 | * @param {string} noteName with or without '.md' on the end. 101 | * @returns {string} noteName with '.md' on the end. 102 | */ 103 | export declare const addMD: (noteName: string) => string; 104 | /** 105 | * Strip '.md' off the end of a note name to get its basename. 106 | * 107 | * Works with the edgecase where a note has '.md' in its basename: `Obsidian.md.md`, for example. 108 | * @param {string} noteName with or without '.md' on the end. 109 | * @returns {string} noteName without '.md' 110 | */ 111 | export declare const stripMD: (noteName: string) => string; 112 | /** 113 | * When clicking a link, check if that note is already open in another leaf, and switch to that leaf, if so. Otherwise, open the note in a new pane. 114 | * @param {string} dest Name of note to open. If you want to open a non-md note, be sure to add the file extension. 115 | * @param {MouseEvent} event 116 | * @param {{createNewFile:boolean}} [options={createNewFile:true}] Whether or not to create `dest` file if it doesn't exist. If `false`, simply return from the function. 117 | * @returns Promise 118 | */ 119 | export declare function openOrSwitch(dest: string, event: MouseEvent, options?: { 120 | createNewFile: boolean; 121 | }): Promise; 122 | /** 123 | * Given a list of resolved links from app.metadataCache, check if `from` has a link to `to` 124 | * @param {ResolvedLinks} resolvedLinks 125 | * @param {string} from Note name with link leaving (With or without '.md') 126 | * @param {string} to Note name with link arriving (With or without '.md') 127 | * @param {boolean} [directed=true] Only check if `from` has a link to `to`. If not directed, check in both directions 128 | */ 129 | export declare function isLinked(resolvedLinks: ResolvedLinks, from: string, to: string, directed?: boolean): boolean; 130 | /** 131 | * Check if the link `from` → `to` is resolved or not. 132 | * @param {string} to 133 | * @param {string} from 134 | * @returns boolean 135 | */ 136 | export declare function isResolved(to: string, from: string): boolean; 137 | /** 138 | * Open your view on the chosen `side` if it isn't already open 139 | * @param {string} viewType 140 | * @param {Constructor} viewClass The class constructor of your view 141 | * @param {"left"|"right"} [side="right"] 142 | * @returns {Promise} The opened view 143 | */ 144 | export declare function openView(viewType: string, viewClass: Constructor, side?: "left" | "right"): Promise; 145 | /** 146 | * Check which side of the workspace your `viewType` is on, and save it into `plugin.settings[settingName]`. 147 | * 148 | * **Tip**: Run this function on `plugin.unload` to save the last side your view was on when closing, then {@link openView} on the same side it was last. 149 | * @param {YourPlugin} plugin 150 | * @param {string} viewType 151 | * @param {string} settingName 152 | * @returns {"left" | "right"} `side` 153 | */ 154 | export declare function saveViewSide(plugin: YourPlugin, viewType: string, settingName: string): Promise<"left" | "right">; 155 | /** 156 | * A Modal used in {@link addRenderedMarkdownButton} to display rendered markdown from a raw string, or fetched from a provided url. 157 | * 158 | * ![](https://i.imgur.com/NMwM50E.png) 159 | * @param {YourPlugin} plugin 160 | * @param {string} source Raw markdown content or url to find raw markdown. 161 | * @param {boolean} fetch True → fetch markdown from `source` as url. False → `source` is already a markdown string. 162 | */ 163 | export declare class RenderedMarkdownModal extends Modal { 164 | plugin: YourPlugin; 165 | source: string; 166 | fetch: boolean; 167 | constructor(plugin: YourPlugin, source: string, fetch: boolean); 168 | onOpen(): Promise; 169 | onClose(): void; 170 | } 171 | /** 172 | * Add a button to an HTMLELement, which, when clicked, pops up a {@link RenderedMarkdownModal} showing rendered markdown. 173 | * 174 | * Use `fetch` to indicate whether the markdown string needs to be fetched, or if it has been provided as a string already. 175 | * 176 | * ![](https://i.imgur.com/Hi4gyyv.png) 177 | * @param {YourPlugin} plugin 178 | * @param {HTMLElement} containerEl HTMLElement to add the button to 179 | * @param {string} source Raw markdown content or url to find raw markdown. 180 | * @param {boolean} fetch True → fetch markdown from `source` as url. False → `source` is already a markdown string. 181 | * @param {string} displayText Text to display in the button. 182 | */ 183 | export declare function addRenderedMarkdownButton(plugin: YourPlugin, containerEl: HTMLElement, source: string, fetch: boolean, displayText: string): void; 184 | /** 185 | * Check if `app.metadataCache.ResolvedLinks` have fully initalised. 186 | * 187 | * Used with {@link waitForResolvedLinks}. 188 | * @param {number} noFiles Number of files in your vault. 189 | * @returns {boolean} 190 | */ 191 | export declare function resolvedLinksComplete(noFiles: number): boolean; 192 | /** 193 | * Wait for `app.metadataCache.ResolvedLinks` to have fully initialised. 194 | * @param {number} [delay=1000] Number of milliseconds to wait between each check. 195 | * @param {number} [max=50] Maximum number of iterations to check before throwing an error and breaking out of the loop. 196 | */ 197 | export declare function waitForResolvedLinks(delay?: number, max?: number): Promise; 198 | /** 199 | * Check if the content of a note has YAML. If so, return an array of the YAML and the rest of the note. If not, return `['', content]` 200 | * @param {string} content 201 | */ 202 | export declare function splitAtYaml(content: string): [string, string]; 203 | /** 204 | * 205 | * @param {boolean} cached Return cached file content **or** return what's on disk. 206 | * @returns 207 | */ 208 | export declare function getActiveFileContent(cached?: boolean): Promise; 209 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Obsidian Community Lib Changelog 2 | ### [2.0.1](https://github.com/obsidian-community/obsidian-community-lib/compare/2.0.0...2.0.1) (2022-04-20) 3 | 4 | ## [2.0.0](https://github.com/obsidian-community/obsidian-community-lib/compare/1.4.2...2.0.0) (2022-04-20) 5 | 6 | 7 | ### Features 8 | 9 | * :alien: Remove dependency to app as it is now globally accessible ([8dcd393](https://github.com/obsidian-community/obsidian-community-lib/commit/8dcd393b83034d7c576344ef38dea0df0a30e1f3)) 10 | 11 | ## [1.5.0](https://github.com/obsidian-community/obsidian-community-lib/compare/1.4.1...1.5.0) (2022-04-19) 12 | 13 | 14 | ### Features 15 | 16 | * :alien: Remove dependency to app as it is now globally accessible ([8dcd393](https://github.com/obsidian-community/obsidian-community-lib/commit/8dcd393b83034d7c576344ef38dea0df0a30e1f3)) 17 | 18 | 19 | ### Documentation 20 | 21 | * :wastebasket: Deprecate `addFeatherIcon` and `addAllFeatherIcons` because Obsidian now ships a full Icon Library ([#28](https://github.com/obsidian-community/obsidian-community-lib/issues/28)) ([0d929b5](https://github.com/obsidian-community/obsidian-community-lib/commit/0d929b5c88fc064c699d927dd7627ec0254f8180)) 22 | 23 | ### [1.4.2](https://github.com/obsidian-community/obsidian-community-lib/compare/1.4.1...1.4.2) (2022-03-02) 24 | 25 | 26 | ### Documentation 27 | 28 | * :wastebasket: Deprecate `addFeatherIcon` and `addAllFeatherIcons` because Obsidian now ships a full Icon Library ([#28](https://github.com/obsidian-community/obsidian-community-lib/issues/28)) ([0d929b5](https://github.com/obsidian-community/obsidian-community-lib/commit/0d929b5c88fc064c699d927dd7627ec0254f8180)) 29 | 30 | ### [1.4.1](https://github.com/obsidian-community/obsidian-community-lib/compare/1.4.0...1.4.1) (2021-12-19) 31 | 32 | 33 | ### Bug Fixes 34 | 35 | * :bug: Better startsWithYaml checking ([4a36ed5](https://github.com/obsidian-community/obsidian-community-lib/commit/4a36ed5b331e0283ec0d8ca9d87941703ce8014f)) 36 | 37 | ## [1.4.0](https://github.com/obsidian-community/obsidian-community-lib/compare/1.3.0...1.4.0) (2021-12-19) 38 | 39 | 40 | ### Features 41 | 42 | * :sparkles: New function + simplifications ([d16a41d](https://github.com/obsidian-community/obsidian-community-lib/commit/d16a41d86928a2b21b38e5010b467e025e8303d4)) 43 | * :sparkles: splitAtYaml function ([7a9b0c5](https://github.com/obsidian-community/obsidian-community-lib/commit/7a9b0c592f9d05e11005f19c36d8f9f412324bed)) 44 | 45 | ## [1.3.0](https://github.com/obsidian-community/obsidian-community-lib/compare/1.2.0...1.3.0) (2021-11-17) 46 | 47 | 48 | ### Features 49 | 50 | * :sparkles: openOrSwitch all file extensions ([1c8c6ea](https://github.com/obsidian-community/obsidian-community-lib/commit/1c8c6eafd772158ba118137be43cb8b667c5bf48)) 51 | 52 | 53 | ### Bug Fixes 54 | 55 | * :bug: addMD to noteName when checking if isResolved ([3e37f66](https://github.com/obsidian-community/obsidian-community-lib/commit/3e37f66a4a65433324f848170e455306cce5f15a)) 56 | 57 | ## [1.2.0](https://github.com/obsidian-community/obsidian-community-lib/compare/1.1.1...1.2.0) (2021-11-12) 58 | 59 | 60 | ### Features 61 | 62 | * :sparkles: openView returns opened view ([07eeede](https://github.com/obsidian-community/obsidian-community-lib/commit/07eeede6fc81250f38335b4dac0ac63aacc39d7a)) 63 | 64 | 65 | ### Bug Fixes 66 | 67 | * :bug: openOrSwitch incorrect logic checking if user wants to createNewFile ([4c3040c](https://github.com/obsidian-community/obsidian-community-lib/commit/4c3040cdaab4185752d09ced4765891b020df58c)) 68 | 69 | ### [1.1.1](https://github.com/obsidian-community/obsidian-community-lib/compare/1.1.0...1.1.1) (2021-11-09) 70 | 71 | 72 | ### Bug Fixes 73 | 74 | * :bug: Was adding'.md' to new files twice ([f97ccf6](https://github.com/obsidian-community/obsidian-community-lib/commit/f97ccf696989ac133e081665de13a8c3de230c35)) 75 | 76 | ## [1.1.0](https://github.com/obsidian-community/obsidian-community-lib/compare/1.0.2...1.1.0) (2021-11-04) 77 | 78 | 79 | ### Features 80 | 81 | * :sparkles: unresolvedQ ([5e6cf7e](https://github.com/obsidian-community/obsidian-community-lib/commit/5e6cf7ebc748f044ca32aefc8b32f241db48c5c1)) 82 | 83 | ### [1.0.2](https://github.com/obsidian-community/obsidian-community-lib/compare/1.0.1...1.0.2) (2021-11-04) 84 | 85 | 86 | ### Bug Fixes 87 | 88 | * :bug: dropMD dropped in the wrong cases ([4f012b7](https://github.com/obsidian-community/obsidian-community-lib/commit/4f012b776d1aece5dd801f453efddc74976c2808)) 89 | 90 | ### [1.0.1](https://github.com/obsidian-community/obsidian-community-lib/compare/1.0.0...1.0.1) (2021-11-02) 91 | 92 | 93 | ### Bug Fixes 94 | 95 | * :bug: Change `npm run docs` to a `chore` type, not `docs` ([1c4387a](https://github.com/obsidian-community/obsidian-community-lib/commit/1c4387a0a6d2b596dbe6e7eeb1deac50af3988a7)) 96 | * :bug: hoverPreview doesn't work without `to` ([d8d1651](https://github.com/obsidian-community/obsidian-community-lib/commit/d8d1651b31ef74f367f331b3aae3885cbabdb67f)) 97 | * :bug: Wrong package name in changelog! ([21d74a7](https://github.com/obsidian-community/obsidian-community-lib/commit/21d74a749a676a9cb2e5d0dce0afc52b23e5c253)) 98 | 99 | 100 | ### Documentation 101 | 102 | * :memo: Remove unused `Documentation` headers ([3ebe64a](https://github.com/obsidian-community/obsidian-community-lib/commit/3ebe64ac8d301747fc2d9202b1ee9ec9fe244e97)) 103 | 104 | ## [1.0.0](https://github.com/obsidian-community/obsidian-community-lib/compare/0.1.3...1.0.0) (2021-11-02) 105 | 106 | ### Features 107 | 108 | - :sparkles: Extend functionality of `RenderedMarkdownModal` ([08027ca](https://github.com/obsidian-community/obsidian-community-lib/commit/08027ca6970fe83d5d4a0ab615eca81b81b3f03e)) 109 | 110 | ### Documentation 111 | 112 | - :memo: RenderedMarkdownModal docs ([3c2ed65](https://github.com/obsidian-community/obsidian-community-lib/commit/3c2ed653a589c29b5809203f88163a86cac54fe2)) 113 | 114 | ### [0.1.3](https://github.com/obsidian-community/obsidian-community-lib/compare/0.1.2...0.1.3) (2021-11-01) 115 | 116 | ### Features 117 | 118 | - :sparkles: Function: waitForResolvedLinks ([1e5e4df](https://github.com/obsidian-community/obsidian-community-lib/commit/1e5e4dffa2cf6361f8aade1bb949ea8cf41782ca)) 119 | 120 | ### [0.1.2](https://github.com/obsidian-community/obsidian-community-lib/compare/0.1.1...0.1.2) (2021-11-01) 121 | 122 | ### Features 123 | 124 | - :sparkles: Two util functions: stripMD + addMD ([1b3d7ac](https://github.com/obsidian-community/obsidian-community-lib/commit/1b3d7ac670d917df9a347f5eeaa21d5172581ded)) 125 | 126 | ### Bug Fixes 127 | 128 | - :bug: Fix [#17](https://github.com/obsidian-community/obsidian-community-lib/issues/17): openOrSwitch shouldn't need an open md note to work ([3fabd62](https://github.com/obsidian-community/obsidian-community-lib/commit/3fabd62d98f26a46b9d9726179966785296e2647)) 129 | 130 | ### [0.1.1](https://github.com/obsidian-community/obsidian-community-lib/compare/0.1.0...0.1.1) (2021-10-30) 131 | 132 | ### Bug Fixes 133 | 134 | - :bug: Only saveViewSide if leaf of `viewType` is open ([3b2eb58](https://github.com/obsidian-community/obsidian-community-lib/commit/3b2eb58ece49ca1f28645dd12621c639cd9d2050)) 135 | 136 | ### Documentation 137 | 138 | ## [0.1.0](https://github.com/obsidian-community/obsidian-community-lib/compare/0.0.19...0.1.0) (2021-10-30) 139 | 140 | ### Features 141 | 142 | - :sparkles: Not necessary to pass in `to` to `hoverPreview` if the `event.target.innerText` is already the `linkText` ([5ce91cc](https://github.com/obsidian-community/obsidian-community-lib/commit/5ce91cc5a9e7c65b8bafebf06a1d752207dd21e6)) 143 | - :sparkles: openView + saveViewSide ([6dc48c6](https://github.com/obsidian-community/obsidian-community-lib/commit/6dc48c6c123578a8bbd474231f68517f428ddbb2)) 144 | 145 | ### [0.0.19](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.17...0.0.19) (2021-10-28) 146 | 147 | ### Features 148 | 149 | - :sparkles: addChanglogButton and ChanglogModal ([895747e](https://github.com/SkepticMystic/obsidian-community-lib/commit/895747e6c19daae8eca69bb6166bd19ce48c1616)) 150 | - :sparkles: Return featherIcon name ([29f2fb9](https://github.com/SkepticMystic/obsidian-community-lib/commit/29f2fb95b1a29e86113cd8294457438e3876721b)) 151 | 152 | ### [0.0.18](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.17...0.0.18) (2021-10-27) 153 | 154 | ### Features 155 | 156 | - :sparkles: addChanglogButton and ChanglogModal ([895747e](https://github.com/SkepticMystic/obsidian-community-lib/commit/895747e6c19daae8eca69bb6166bd19ce48c1616)) 157 | - :sparkles: Return featherIcon name ([29f2fb9](https://github.com/SkepticMystic/obsidian-community-lib/commit/29f2fb95b1a29e86113cd8294457438e3876721b)) 158 | 159 | ### [0.0.17](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.16...0.0.17) (2021-10-26) 160 | 161 | ### Features 162 | 163 | - :sparkles: Add directed option to linkedQ ([ab10d2d](https://github.com/SkepticMystic/obsidian-community-lib/commit/ab10d2dc2b351ed2c89c0492b45991f5cf1ec3ea)) 164 | 165 | ### Bug Fixes 166 | 167 | - :bug: Remove module override ([c8a781e](https://github.com/SkepticMystic/obsidian-community-lib/commit/c8a781ed9e29121596a841d45a3870976540972d)) 168 | 169 | ### [0.0.16](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.15...0.0.16) (2021-10-25) 170 | 171 | ### Features 172 | 173 | - :sparkles: createNewNote function ([745acb4](https://github.com/SkepticMystic/obsidian-community-lib/commit/745acb47a8722beae4c23fa42ef2040bb919c5bf)) 174 | - :sparkles: Expand vault interface ([0fa320a](https://github.com/SkepticMystic/obsidian-community-lib/commit/0fa320a6ffad6a2b3224b3a9121e3030c51d1358)) 175 | - :sparkles: linkedQ function ([7973df2](https://github.com/SkepticMystic/obsidian-community-lib/commit/7973df2c88d153b0eabc1186bac5e7e9ffe25127)) 176 | 177 | ### Bug Fixes 178 | 179 | - :bug: createwNewMDNote: Append '.md' to `newName` if not present ([e797c85](https://github.com/SkepticMystic/obsidian-community-lib/commit/e797c85f1f61079526b6d498733d3241d2e77369)) 180 | - :bug: Remove redundant declaration ([176fa8e](https://github.com/SkepticMystic/obsidian-community-lib/commit/176fa8e6d3ec9410e374bd52bdb2227d1f0fcdb0)) 181 | 182 | ### [0.0.15](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.14...0.0.15) (2021-10-24) 183 | 184 | ### Bug Fixes 185 | 186 | - :bug: Check if leaf.view instanceof MarkdownView to confirm view.file exists ([007e474](https://github.com/SkepticMystic/obsidian-community-lib/commit/007e474b943b1664ab523b5dc365837268168c0c)) 187 | 188 | ### [0.0.14](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.13...0.0.14) (2021-10-24) 189 | 190 | ### [0.0.13](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.12...0.0.13) (2021-10-24) 191 | 192 | ### [0.0.12](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.11...0.0.12) (2021-10-24) 193 | 194 | ### Features 195 | 196 | - :sparkles: Add my functions ([14ab90e](https://github.com/SkepticMystic/obsidian-community-lib/commit/14ab90e56ba0a4eb2559d92be0d37762362543b2)) 197 | - :sparkles: Attempt to extend obsidian module ([e8e3d58](https://github.com/SkepticMystic/obsidian-community-lib/commit/e8e3d587db20287c69746cc56e35db7faaa211d4)) 198 | 199 | ### [0.0.11](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.10...0.0.11) (2021-10-24) 200 | 201 | ### [0.0.10](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.9...0.0.10) (2021-10-24) 202 | 203 | ### [0.0.9](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.8...0.0.9) (2021-10-24) 204 | 205 | ### [0.0.8](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.7...0.0.8) (2021-10-24) 206 | 207 | ### Features 208 | 209 | - :rocket: Add my often used Methods ([4956509](https://github.com/SkepticMystic/obsidian-community-lib/commit/4956509fb5f4a3fb62544b2977f1de9bc3bf543d)) 210 | 211 | ### Bug Fixes 212 | 213 | - add yarn.lock to gitignore ([9e1d37d](https://github.com/SkepticMystic/obsidian-community-lib/commit/9e1d37d3d3f19375e0c4fb4259a719472c934d01)) 214 | 215 | ### [0.0.7](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.6...0.0.7) (2021-10-24) 216 | 217 | ### [0.0.6](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.5...0.0.6) (2021-10-24) 218 | 219 | ### [0.0.5](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.4...0.0.5) (2021-10-24) 220 | 221 | ### Features 222 | 223 | - :sparkles: Add `copy` function ([91b28ea](https://github.com/SkepticMystic/obsidian-community-lib/commit/91b28eae5a12c7d925efe6f7f7e7c60851d89761)) 224 | 225 | ### [0.0.3](https://github.com/SkepticMystic/obsidian-community-lib/compare/0.0.4...0.0.3) (2021-10-24) 226 | 227 | ### 0.0.2 (2021-10-24) 228 | 229 | ### Features 230 | 231 | - :sparkles: Add standard-version ([acbf022](https://github.com/SkepticMystic/obsidian-community-lib/commit/acbf02260a41206f4c7ec5a4c86d7b77b70be3e4)) 232 | - :sparkles: init package! ([d2f7897](https://github.com/SkepticMystic/obsidian-community-lib/commit/d2f7897bd02726ff6947d9c9dadbd12d88c4d9ea)) 233 | -------------------------------------------------------------------------------- /dist/utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This module contains various utility functions commonly used in Obsidian plugins. 3 | * @module obsidian-community-lib 4 | */ 5 | import * as feather from "feather-icons"; 6 | import { addIcon, MarkdownRenderer, MarkdownView, Modal, normalizePath, Notice, request, TFile, } from "obsidian"; 7 | /** 8 | * You can await this Function to delay execution 9 | * 10 | * @param delay The delay in ms 11 | */ 12 | export async function wait(delay) { 13 | return new Promise((resolve) => setTimeout(resolve, delay)); 14 | } 15 | /** 16 | * Adds all official Feather Icons to Obsidian. 17 | * https://feathericons.com/ 18 | * 19 | * @param attr SVG Attributes for the Icon. The default should work for most usecases. 20 | * 21 | * @deprecated As of Obsidian 0.13.27 this is no longer needed, because Obsidian ships with `lucide`, a maintained fork of feather. (https://lucide.dev/) 22 | */ 23 | export function addAllFeatherIcons(attr = { viewBox: "0 0 24 24", width: "100", height: "100" }) { 24 | Object.values(feather.icons).forEach((i) => { 25 | const svg = i.toSvg(attr); 26 | addIcon(`feather-${i.name}`, svg); 27 | }); 28 | } 29 | /** 30 | * Adds a specific Feather Icon to Obsidian. 31 | * 32 | * @param name official Name of the Icon (https://feathericons.com/) 33 | * @param attr SVG Attributes for the Icon. The default should work for most usecases. 34 | * @returns {string} Icon name 35 | * 36 | * @deprecated As of Obsidian 0.13.27 this is no longer needed, because Obsidian ships with `lucide`, a maintained fork of feather. (https://lucide.dev/) 37 | */ 38 | export function addFeatherIcon(name, attr = { viewBox: "0 0 24 24", width: "100", height: "100" }) { 39 | if (feather.icons[name]) { 40 | const iconName = `feather-${name}`; 41 | addIcon(iconName, feather.icons[name].toSvg(attr)); 42 | return iconName; 43 | } 44 | else { 45 | throw Error(`This Icon (${name}) doesn't exist in the Feather Library.`); 46 | } 47 | } 48 | /** 49 | * Convert a base64 String to an ArrayBuffer. 50 | * You can then use the ArrayBuffer to save the asset to disk. 51 | * 52 | * @param base64 base64 string to be converted. 53 | * @returns ArrayBuffer 54 | * @deprecated Obsidian offers it's own method as of 0.14.5 55 | */ 56 | export function base64ToArrayBuffer(base64) { 57 | const binary_string = window.atob(base64); 58 | const len = binary_string.length; 59 | let bytes = new Uint8Array(len); 60 | for (let i = 0; i < len; i++) { 61 | bytes[i] = binary_string.charCodeAt(i); 62 | } 63 | return bytes.buffer; 64 | } 65 | /** 66 | * This is a helper method for an undocumented API of Obsidian. 67 | * 68 | * @param fileName The Filename for your Attachment 69 | * @param format The Fileformat of your Attachment 70 | * @param sourceFile The Sourcefile from where the Attachment gets added, this is needed because the Attachment Folder might be different based on where it gets inserted. 71 | * @returns The Attachment Path 72 | */ 73 | export function getAvailablePathForAttachments(fileName, format, sourceFile) { 74 | //@ts-expect-error 75 | return app.vault.getAvailablePathForAttachments(fileName, format, sourceFile); 76 | } 77 | /** 78 | * Copy `content` to the users clipboard. 79 | * 80 | * @param {string} content The content to be copied to clipboard. 81 | * @param {() => any} success The callback to run when text is successfully copied. Default throws a new `Notice` 82 | * @param {(reason?) => any} failure The callback to run when text was not able to be copied. Default throws a new `Notice`, and console logs the error.` 83 | */ 84 | export async function copy(content, success = () => new Notice("Copied to clipboard"), failure = (reason) => { 85 | new Notice("Could not copy to clipboard"); 86 | console.log({ reason }); 87 | }) { 88 | await navigator.clipboard.writeText(content).then(success, failure); 89 | } 90 | /** 91 | * Given an editor, check if something is selected and return that selection, otherwise return the entire content of the editor 92 | * @param {Editor} editor 93 | */ 94 | export function getSelectionFromEditor(editor) { 95 | if (editor.somethingSelected()) 96 | return editor.getSelection(); 97 | else 98 | return editor.getValue(); 99 | } 100 | /** 101 | * Check if something is selected in the current file and return that selection, otherwise return the entire content of the current file. 102 | * @param {boolean} [cached=true] Use `cachedRead` or `read`. `cachedRead` by default. 103 | * @returns {string | null} `null` if not focussed on a markdown file 104 | */ 105 | export async function getSelectionFromCurrFile(cached = true) { 106 | var _a; 107 | const text = (_a = window === null || window === void 0 ? void 0 : window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString(); 108 | if (text) 109 | return text; 110 | else 111 | return await getActiveFileContent(cached); 112 | } 113 | /** 114 | * Check if `noteName` is the name of a note that exists in the vault. 115 | * @param {string} noteName Basename of the note to search for. 116 | * @param {string} [sourcePath=""] Optional file path to start searching from. Default is the current file. 117 | * @returns boolean 118 | */ 119 | export const isInVault = (noteName, sourcePath = "") => !!app.metadataCache.getFirstLinkpathDest(noteName, sourcePath); 120 | /** 121 | * When hovering a link going to `to`, show the Obsidian hover-preview of that note. 122 | * 123 | * You probably have to hold down `Ctrl` when hovering the link for the preview to appear! 124 | * @param {MouseEvent} event 125 | * @param {YourView} view The view with the link being hovered 126 | * @param {string} to The basename of the note to preview. 127 | * @template YourView The ViewType of your view 128 | * @returns void 129 | */ 130 | export function hoverPreview(event, view, to) { 131 | const targetEl = event.target; 132 | app.workspace.trigger("hover-link", { 133 | event, 134 | source: view.getViewType(), 135 | hoverParent: view, 136 | targetEl, 137 | linktext: to, 138 | }); 139 | } 140 | /** 141 | * Create a new markdown note named `newName` in the user's preffered new-note-folder. 142 | * @param {string} newName Name of new note (with or without '.md') 143 | * @param {string} [currFilePath=""] File path of the current note. Use an empty string if there is no active file. 144 | * @returns {Promise} new TFile 145 | */ 146 | export async function createNewMDNote(newName, currFilePath = "") { 147 | const newFileFolder = app.fileManager.getNewFileParent(currFilePath).path; 148 | const newFilePath = normalizePath(`${newFileFolder}${newFileFolder === "/" ? "" : "/"}${addMD(newName)}`); 149 | return await app.vault.create(newFilePath, ""); 150 | } 151 | /** 152 | * Add '.md' to `noteName` if it isn't already there. 153 | * @param {string} noteName with or without '.md' on the end. 154 | * @returns {string} noteName with '.md' on the end. 155 | */ 156 | export const addMD = (noteName) => { 157 | return noteName.match(/\.MD$|\.md$/m) ? noteName : noteName + ".md"; 158 | }; 159 | /** 160 | * Strip '.md' off the end of a note name to get its basename. 161 | * 162 | * Works with the edgecase where a note has '.md' in its basename: `Obsidian.md.md`, for example. 163 | * @param {string} noteName with or without '.md' on the end. 164 | * @returns {string} noteName without '.md' 165 | */ 166 | export const stripMD = (noteName) => { 167 | if (noteName.match(/\.MD$|\.md$/m)) { 168 | return noteName.split(/\.MD$|\.md$/m).slice(0, -1).join(".md"); 169 | } 170 | else 171 | return noteName; 172 | }; 173 | /** 174 | * When clicking a link, check if that note is already open in another leaf, and switch to that leaf, if so. Otherwise, open the note in a new pane. 175 | * @param {string} dest Name of note to open. If you want to open a non-md note, be sure to add the file extension. 176 | * @param {MouseEvent} event 177 | * @param {{createNewFile:boolean}} [options={createNewFile:true}] Whether or not to create `dest` file if it doesn't exist. If `false`, simply return from the function. 178 | * @returns Promise 179 | */ 180 | export async function openOrSwitch(dest, event, options = { createNewFile: true }) { 181 | const { workspace } = app; 182 | let destFile = app.metadataCache.getFirstLinkpathDest(dest, ""); 183 | // If dest doesn't exist, make it 184 | if (!destFile && options.createNewFile) { 185 | destFile = await createNewMDNote(dest); 186 | } 187 | else if (!destFile && !options.createNewFile) 188 | return; 189 | // Check if it's already open 190 | const leavesWithDestAlreadyOpen = []; 191 | // For all open leaves, if the leave's basename is equal to the link destination, rather activate that leaf instead of opening it in two panes 192 | workspace.iterateAllLeaves((leaf) => { 193 | var _a; 194 | if (leaf.view instanceof MarkdownView) { 195 | const file = (_a = leaf.view) === null || _a === void 0 ? void 0 : _a.file; 196 | if (file && file.basename + "." + file.extension === dest) { 197 | leavesWithDestAlreadyOpen.push(leaf); 198 | } 199 | } 200 | }); 201 | // Rather switch to it if it is open 202 | if (leavesWithDestAlreadyOpen.length > 0) { 203 | workspace.setActiveLeaf(leavesWithDestAlreadyOpen[0]); 204 | } 205 | else { 206 | // @ts-ignore 207 | const mode = app.vault.getConfig("defaultViewMode"); 208 | const leaf = event.ctrlKey || event.getModifierState("Meta") 209 | ? workspace.splitActiveLeaf() 210 | : workspace.getUnpinnedLeaf(); 211 | //@ts-expect-error 212 | await leaf.openFile(destFile, { active: true, mode }); 213 | } 214 | } 215 | /** 216 | * Given a list of resolved links from app.metadataCache, check if `from` has a link to `to` 217 | * @param {ResolvedLinks} resolvedLinks 218 | * @param {string} from Note name with link leaving (With or without '.md') 219 | * @param {string} to Note name with link arriving (With or without '.md') 220 | * @param {boolean} [directed=true] Only check if `from` has a link to `to`. If not directed, check in both directions 221 | */ 222 | export function isLinked(resolvedLinks, from, to, directed = true) { 223 | var _a, _b; 224 | from = addMD(from); 225 | to = addMD(to); 226 | const fromTo = (_a = resolvedLinks[from]) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(to); 227 | if (!fromTo && !directed) { 228 | const toFrom = (_b = resolvedLinks[to]) === null || _b === void 0 ? void 0 : _b.hasOwnProperty(from); 229 | return toFrom; 230 | } 231 | else 232 | return fromTo; 233 | } 234 | /** 235 | * Check if the link `from` → `to` is resolved or not. 236 | * @param {string} to 237 | * @param {string} from 238 | * @returns boolean 239 | */ 240 | export function isResolved(to, from) { 241 | var _a; 242 | const { resolvedLinks } = app.metadataCache; 243 | return ((_a = resolvedLinks === null || resolvedLinks === void 0 ? void 0 : resolvedLinks[addMD(from)]) === null || _a === void 0 ? void 0 : _a[addMD(to)]) > 0; 244 | } 245 | /** 246 | * Open your view on the chosen `side` if it isn't already open 247 | * @param {string} viewType 248 | * @param {Constructor} viewClass The class constructor of your view 249 | * @param {"left"|"right"} [side="right"] 250 | * @returns {Promise} The opened view 251 | */ 252 | export async function openView(viewType, viewClass, side = "right") { 253 | let leaf = null; 254 | for (leaf of app.workspace.getLeavesOfType(viewType)) { 255 | if (leaf.view instanceof viewClass) { 256 | return leaf.view; 257 | } 258 | await leaf.setViewState({ type: "empty" }); 259 | break; 260 | } 261 | leaf = 262 | (leaf !== null && leaf !== void 0 ? leaf : side === "right") 263 | ? app.workspace.getRightLeaf(false) 264 | : app.workspace.getLeftLeaf(false); 265 | await leaf.setViewState({ 266 | type: viewType, 267 | active: true, 268 | }); 269 | return leaf.view; 270 | } 271 | /** 272 | * Check which side of the workspace your `viewType` is on, and save it into `plugin.settings[settingName]`. 273 | * 274 | * **Tip**: Run this function on `plugin.unload` to save the last side your view was on when closing, then {@link openView} on the same side it was last. 275 | * @param {YourPlugin} plugin 276 | * @param {string} viewType 277 | * @param {string} settingName 278 | * @returns {"left" | "right"} `side` 279 | */ 280 | export async function saveViewSide(plugin, viewType, settingName) { 281 | const leaf = app.workspace.getLeavesOfType(viewType)[0]; 282 | if (!leaf) { 283 | console.info(`Obsidian-Community-Lib: No instance of '${viewType}' open, cannot save side`); 284 | return; 285 | } 286 | //@ts-ignore 287 | const side = leaf.getRoot().side; 288 | //@ts-ignore 289 | plugin.settings[settingName] = side; 290 | //@ts-ignore 291 | await plugin.saveSettings(); 292 | return side; 293 | } 294 | /** 295 | * A Modal used in {@link addRenderedMarkdownButton} to display rendered markdown from a raw string, or fetched from a provided url. 296 | * 297 | * ![](https://i.imgur.com/NMwM50E.png) 298 | * @param {YourPlugin} plugin 299 | * @param {string} source Raw markdown content or url to find raw markdown. 300 | * @param {boolean} fetch True → fetch markdown from `source` as url. False → `source` is already a markdown string. 301 | */ 302 | export class RenderedMarkdownModal extends Modal { 303 | constructor(plugin, source, fetch) { 304 | super(app); 305 | this.plugin = plugin; 306 | this.source = source; 307 | this.fetch = fetch; 308 | } 309 | async onOpen() { 310 | let { contentEl, source, plugin, fetch } = this; 311 | let content = source; 312 | if (fetch) { 313 | contentEl.createDiv({ text: `Waiting for content from: '${source}'` }); 314 | content = await request({ url: source }); 315 | contentEl.empty(); 316 | } 317 | const logDiv = contentEl.createDiv({ cls: "OCL-RenderedMarkdownModal" }); 318 | MarkdownRenderer.renderMarkdown(content, logDiv, "", plugin); 319 | } 320 | onClose() { 321 | this.contentEl.empty(); 322 | } 323 | } 324 | /** 325 | * Add a button to an HTMLELement, which, when clicked, pops up a {@link RenderedMarkdownModal} showing rendered markdown. 326 | * 327 | * Use `fetch` to indicate whether the markdown string needs to be fetched, or if it has been provided as a string already. 328 | * 329 | * ![](https://i.imgur.com/Hi4gyyv.png) 330 | * @param {YourPlugin} plugin 331 | * @param {HTMLElement} containerEl HTMLElement to add the button to 332 | * @param {string} source Raw markdown content or url to find raw markdown. 333 | * @param {boolean} fetch True → fetch markdown from `source` as url. False → `source` is already a markdown string. 334 | * @param {string} displayText Text to display in the button. 335 | */ 336 | export function addRenderedMarkdownButton(plugin, containerEl, source, fetch, displayText) { 337 | containerEl.createEl("button", { text: displayText }, (but) => but.onClickEvent(() => { 338 | new RenderedMarkdownModal(plugin, source, fetch).open(); 339 | })); 340 | } 341 | /** 342 | * Check if `app.metadataCache.ResolvedLinks` have fully initalised. 343 | * 344 | * Used with {@link waitForResolvedLinks}. 345 | * @param {number} noFiles Number of files in your vault. 346 | * @returns {boolean} 347 | */ 348 | export function resolvedLinksComplete(noFiles) { 349 | const { resolvedLinks } = app.metadataCache; 350 | return Object.keys(resolvedLinks).length === noFiles; 351 | } 352 | /** 353 | * Wait for `app.metadataCache.ResolvedLinks` to have fully initialised. 354 | * @param {number} [delay=1000] Number of milliseconds to wait between each check. 355 | * @param {number} [max=50] Maximum number of iterations to check before throwing an error and breaking out of the loop. 356 | */ 357 | export async function waitForResolvedLinks(delay = 1000, max = 50) { 358 | const noFiles = app.vault.getMarkdownFiles().length; 359 | let i = 0; 360 | while (!resolvedLinksComplete(noFiles) && i < max) { 361 | await wait(delay); 362 | i++; 363 | } 364 | if (i === max) { 365 | throw Error("Obsidian-Community-Lib: ResolvedLinks did not finish initialising. `max` iterations was reached first."); 366 | } 367 | } 368 | /** 369 | * Check if the content of a note has YAML. If so, return an array of the YAML and the rest of the note. If not, return `['', content]` 370 | * @param {string} content 371 | */ 372 | export function splitAtYaml(content) { 373 | if (!/^---\n/.test(content)) 374 | return ["", content]; 375 | else { 376 | const splits = content.split("---"); 377 | return [ 378 | splits.slice(0, 2).join("---") + "---", 379 | splits.slice(2).join("---"), 380 | ]; 381 | } 382 | } 383 | /** 384 | * 385 | * @param {boolean} cached Return cached file content **or** return what's on disk. 386 | * @returns 387 | */ 388 | export async function getActiveFileContent(cached = true) { 389 | const currFile = app.workspace.getActiveFile(); 390 | if (!(currFile instanceof TFile)) 391 | return null; 392 | if (cached) 393 | return await app.vault.cachedRead(currFile); 394 | else 395 | return await app.vault.read(currFile); 396 | } 397 | -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This module contains various utility functions commonly used in Obsidian plugins. 3 | * @module obsidian-community-lib 4 | */ 5 | import * as feather from "feather-icons"; 6 | import { 7 | addIcon, 8 | Constructor, 9 | Editor, 10 | ItemView, 11 | MarkdownRenderer, 12 | MarkdownView, 13 | Modal, 14 | normalizePath, 15 | Notice, 16 | Plugin, 17 | request, 18 | TFile, 19 | WorkspaceLeaf, 20 | } from "obsidian"; 21 | import { ResolvedLinks } from "./interfaces"; 22 | 23 | /** 24 | * You can await this Function to delay execution 25 | * 26 | * @param delay The delay in ms 27 | */ 28 | export async function wait(delay: number): Promise { 29 | return new Promise((resolve) => setTimeout(resolve, delay)); 30 | } 31 | 32 | /** 33 | * Adds all official Feather Icons to Obsidian. 34 | * https://feathericons.com/ 35 | * 36 | * @param attr SVG Attributes for the Icon. The default should work for most usecases. 37 | * 38 | * @deprecated As of Obsidian 0.13.27 this is no longer needed, because Obsidian ships with `lucide`, a maintained fork of feather. (https://lucide.dev/) 39 | */ 40 | export function addAllFeatherIcons( 41 | attr = { viewBox: "0 0 24 24", width: "100", height: "100" } 42 | ): void { 43 | Object.values(feather.icons).forEach((i) => { 44 | const svg = i.toSvg(attr); 45 | addIcon(`feather-${i.name}`, svg); 46 | }); 47 | } 48 | 49 | /** 50 | * Adds a specific Feather Icon to Obsidian. 51 | * 52 | * @param name official Name of the Icon (https://feathericons.com/) 53 | * @param attr SVG Attributes for the Icon. The default should work for most usecases. 54 | * @returns {string} Icon name 55 | * 56 | * @deprecated As of Obsidian 0.13.27 this is no longer needed, because Obsidian ships with `lucide`, a maintained fork of feather. (https://lucide.dev/) 57 | */ 58 | export function addFeatherIcon( 59 | name: string, 60 | attr = { viewBox: "0 0 24 24", width: "100", height: "100" } 61 | ): string | void { 62 | if (feather.icons[name]) { 63 | const iconName = `feather-${name}`; 64 | addIcon(iconName, feather.icons[name].toSvg(attr)); 65 | return iconName; 66 | } else { 67 | throw Error(`This Icon (${name}) doesn't exist in the Feather Library.`); 68 | } 69 | } 70 | 71 | /** 72 | * Convert a base64 String to an ArrayBuffer. 73 | * You can then use the ArrayBuffer to save the asset to disk. 74 | * 75 | * @param base64 base64 string to be converted. 76 | * @returns ArrayBuffer 77 | * @deprecated Obsidian offers it's own method as of 0.14.5 78 | */ 79 | export function base64ToArrayBuffer(base64: string): ArrayBuffer { 80 | const binary_string = window.atob(base64); 81 | const len = binary_string.length; 82 | let bytes = new Uint8Array(len); 83 | for (let i = 0; i < len; i++) { 84 | bytes[i] = binary_string.charCodeAt(i); 85 | } 86 | return bytes.buffer; 87 | } 88 | 89 | /** 90 | * This is a helper method for an undocumented API of Obsidian. 91 | * 92 | * @param fileName The Filename for your Attachment 93 | * @param format The Fileformat of your Attachment 94 | * @param sourceFile The Sourcefile from where the Attachment gets added, this is needed because the Attachment Folder might be different based on where it gets inserted. 95 | * @returns The Attachment Path 96 | */ 97 | export function getAvailablePathForAttachments( 98 | fileName: string, 99 | format: string, 100 | sourceFile: TFile 101 | ): string { 102 | //@ts-expect-error 103 | return app.vault.getAvailablePathForAttachments(fileName, format, sourceFile); 104 | } 105 | 106 | /** 107 | * Copy `content` to the users clipboard. 108 | * 109 | * @param {string} content The content to be copied to clipboard. 110 | * @param {() => any} success The callback to run when text is successfully copied. Default throws a new `Notice` 111 | * @param {(reason?) => any} failure The callback to run when text was not able to be copied. Default throws a new `Notice`, and console logs the error.` 112 | */ 113 | export async function copy( 114 | content: string, 115 | success: () => any = () => new Notice("Copied to clipboard"), 116 | failure: (reason?: any) => any = (reason) => { 117 | new Notice("Could not copy to clipboard"); 118 | console.log({ reason }); 119 | } 120 | ) { 121 | await navigator.clipboard.writeText(content).then(success, failure); 122 | } 123 | 124 | /** 125 | * Given an editor, check if something is selected and return that selection, otherwise return the entire content of the editor 126 | * @param {Editor} editor 127 | */ 128 | export function getSelectionFromEditor(editor: Editor): string { 129 | if (editor.somethingSelected()) return editor.getSelection(); 130 | else return editor.getValue(); 131 | } 132 | 133 | /** 134 | * Check if something is selected in the current file and return that selection, otherwise return the entire content of the current file. 135 | * @param {boolean} [cached=true] Use `cachedRead` or `read`. `cachedRead` by default. 136 | * @returns {string | null} `null` if not focussed on a markdown file 137 | */ 138 | export async function getSelectionFromCurrFile( 139 | cached: boolean = true 140 | ): Promise { 141 | const text = window?.getSelection()?.toString(); 142 | if (text) return text; 143 | else return await getActiveFileContent(cached); 144 | } 145 | 146 | /** 147 | * Check if `noteName` is the name of a note that exists in the vault. 148 | * @param {string} noteName Basename of the note to search for. 149 | * @param {string} [sourcePath=""] Optional file path to start searching from. Default is the current file. 150 | * @returns boolean 151 | */ 152 | export const isInVault = ( 153 | noteName: string, 154 | sourcePath: string = "" 155 | ): boolean => !!app.metadataCache.getFirstLinkpathDest(noteName, sourcePath); 156 | 157 | /** 158 | * When hovering a link going to `to`, show the Obsidian hover-preview of that note. 159 | * 160 | * You probably have to hold down `Ctrl` when hovering the link for the preview to appear! 161 | * @param {MouseEvent} event 162 | * @param {YourView} view The view with the link being hovered 163 | * @param {string} to The basename of the note to preview. 164 | * @template YourView The ViewType of your view 165 | * @returns void 166 | */ 167 | export function hoverPreview( 168 | event: MouseEvent, 169 | view: YourView, 170 | to: string 171 | ): void { 172 | const targetEl = event.target as HTMLElement; 173 | 174 | app.workspace.trigger("hover-link", { 175 | event, 176 | source: view.getViewType(), 177 | hoverParent: view, 178 | targetEl, 179 | linktext: to, 180 | }); 181 | } 182 | 183 | /** 184 | * Create a new markdown note named `newName` in the user's preffered new-note-folder. 185 | * @param {string} newName Name of new note (with or without '.md') 186 | * @param {string} [currFilePath=""] File path of the current note. Use an empty string if there is no active file. 187 | * @returns {Promise} new TFile 188 | */ 189 | export async function createNewMDNote( 190 | newName: string, 191 | currFilePath: string = "" 192 | ): Promise { 193 | const newFileFolder = app.fileManager.getNewFileParent(currFilePath).path; 194 | const newFilePath = normalizePath( 195 | `${newFileFolder}${newFileFolder === "/" ? "" : "/"}${addMD(newName)}` 196 | ); 197 | return await app.vault.create(newFilePath, ""); 198 | } 199 | 200 | /** 201 | * Add '.md' to `noteName` if it isn't already there. 202 | * @param {string} noteName with or without '.md' on the end. 203 | * @returns {string} noteName with '.md' on the end. 204 | */ 205 | export const addMD = (noteName: string): string => { 206 | return noteName.match(/\.MD$|\.md$/m) ? noteName : noteName + ".md"; 207 | }; 208 | 209 | /** 210 | * Strip '.md' off the end of a note name to get its basename. 211 | * 212 | * Works with the edgecase where a note has '.md' in its basename: `Obsidian.md.md`, for example. 213 | * @param {string} noteName with or without '.md' on the end. 214 | * @returns {string} noteName without '.md' 215 | */ 216 | export const stripMD = (noteName: string): string => { 217 | if (noteName.match(/\.MD$|\.md$/m)) { 218 | return noteName.split(/\.MD$|\.md$/m).slice(0, -1).join(".md"); 219 | } else return noteName; 220 | }; 221 | 222 | /** 223 | * When clicking a link, check if that note is already open in another leaf, and switch to that leaf, if so. Otherwise, open the note in a new pane. 224 | * @param {string} dest Name of note to open. If you want to open a non-md note, be sure to add the file extension. 225 | * @param {MouseEvent} event 226 | * @param {{createNewFile:boolean}} [options={createNewFile:true}] Whether or not to create `dest` file if it doesn't exist. If `false`, simply return from the function. 227 | * @returns Promise 228 | */ 229 | export async function openOrSwitch( 230 | dest: string, 231 | event: MouseEvent, 232 | options: { 233 | createNewFile: boolean; 234 | } = { createNewFile: true } 235 | ): Promise { 236 | const { workspace } = app; 237 | let destFile = app.metadataCache.getFirstLinkpathDest(dest, ""); 238 | 239 | // If dest doesn't exist, make it 240 | if (!destFile && options.createNewFile) { 241 | destFile = await createNewMDNote(dest); 242 | } else if (!destFile && !options.createNewFile) return; 243 | 244 | // Check if it's already open 245 | const leavesWithDestAlreadyOpen: WorkspaceLeaf[] = []; 246 | // For all open leaves, if the leave's basename is equal to the link destination, rather activate that leaf instead of opening it in two panes 247 | workspace.iterateAllLeaves((leaf) => { 248 | if (leaf.view instanceof MarkdownView) { 249 | const file = leaf.view?.file; 250 | if (file && file.basename + "." + file.extension === dest) { 251 | leavesWithDestAlreadyOpen.push(leaf); 252 | } 253 | } 254 | }); 255 | 256 | // Rather switch to it if it is open 257 | if (leavesWithDestAlreadyOpen.length > 0) { 258 | workspace.setActiveLeaf(leavesWithDestAlreadyOpen[0]); 259 | } else { 260 | // @ts-ignore 261 | const mode = app.vault.getConfig("defaultViewMode") as string; 262 | const leaf = 263 | event.ctrlKey || event.getModifierState("Meta") 264 | ? workspace.getLeaf(true) 265 | : workspace.getLeaf(false); 266 | 267 | //@ts-expect-error 268 | await leaf.openFile(destFile, { active: true, mode }); 269 | } 270 | } 271 | 272 | /** 273 | * Given a list of resolved links from app.metadataCache, check if `from` has a link to `to` 274 | * @param {ResolvedLinks} resolvedLinks 275 | * @param {string} from Note name with link leaving (With or without '.md') 276 | * @param {string} to Note name with link arriving (With or without '.md') 277 | * @param {boolean} [directed=true] Only check if `from` has a link to `to`. If not directed, check in both directions 278 | */ 279 | export function isLinked( 280 | resolvedLinks: ResolvedLinks, 281 | from: string, 282 | to: string, 283 | directed: boolean = true 284 | ) { 285 | from = addMD(from); 286 | to = addMD(to); 287 | 288 | const fromTo = resolvedLinks[from]?.hasOwnProperty(to); 289 | if (!fromTo && !directed) { 290 | const toFrom = resolvedLinks[to]?.hasOwnProperty(from); 291 | return toFrom; 292 | } else return fromTo; 293 | } 294 | 295 | /** 296 | * Check if the link `from` → `to` is resolved or not. 297 | * @param {string} to 298 | * @param {string} from 299 | * @returns boolean 300 | */ 301 | export function isResolved(to: string, from: string): boolean { 302 | const { resolvedLinks } = app.metadataCache; 303 | return resolvedLinks?.[addMD(from)]?.[addMD(to)] > 0; 304 | } 305 | 306 | /** 307 | * Open your view on the chosen `side` if it isn't already open 308 | * @param {string} viewType 309 | * @param {Constructor} viewClass The class constructor of your view 310 | * @param {"left"|"right"} [side="right"] 311 | * @returns {Promise} The opened view 312 | */ 313 | export async function openView( 314 | viewType: string, 315 | viewClass: Constructor, 316 | side: "left" | "right" = "right" 317 | ): Promise { 318 | let leaf: WorkspaceLeaf = null; 319 | for (leaf of app.workspace.getLeavesOfType(viewType)) { 320 | if (leaf.view instanceof viewClass) { 321 | return leaf.view; 322 | } 323 | await leaf.setViewState({ type: "empty" }); 324 | break; 325 | } 326 | 327 | leaf = 328 | leaf ?? side === "right" 329 | ? app.workspace.getRightLeaf(false) 330 | : app.workspace.getLeftLeaf(false); 331 | 332 | await leaf.setViewState({ 333 | type: viewType, 334 | active: true, 335 | }); 336 | 337 | return leaf.view as YourView; 338 | } 339 | /** 340 | * Check which side of the workspace your `viewType` is on, and save it into `plugin.settings[settingName]`. 341 | * 342 | * **Tip**: Run this function on `plugin.unload` to save the last side your view was on when closing, then {@link openView} on the same side it was last. 343 | * @param {YourPlugin} plugin 344 | * @param {string} viewType 345 | * @param {string} settingName 346 | * @returns {"left" | "right"} `side` 347 | */ 348 | export async function saveViewSide( 349 | plugin: YourPlugin, 350 | viewType: string, 351 | settingName: string 352 | ): Promise<"left" | "right"> { 353 | const leaf = app.workspace.getLeavesOfType(viewType)[0]; 354 | if (!leaf) { 355 | console.info( 356 | `Obsidian-Community-Lib: No instance of '${viewType}' open, cannot save side` 357 | ); 358 | return; 359 | } 360 | //@ts-ignore 361 | const side: "left" | "right" = leaf.getRoot().side; 362 | //@ts-ignore 363 | plugin.settings[settingName] = side; 364 | //@ts-ignore 365 | await plugin.saveSettings(); 366 | return side; 367 | } 368 | 369 | /** 370 | * A Modal used in {@link addRenderedMarkdownButton} to display rendered markdown from a raw string, or fetched from a provided url. 371 | * 372 | * ![](https://i.imgur.com/NMwM50E.png) 373 | * @param {YourPlugin} plugin 374 | * @param {string} source Raw markdown content or url to find raw markdown. 375 | * @param {boolean} fetch True → fetch markdown from `source` as url. False → `source` is already a markdown string. 376 | */ 377 | export class RenderedMarkdownModal extends Modal { 378 | plugin: YourPlugin; 379 | source: string; 380 | fetch: boolean; 381 | 382 | constructor(plugin: YourPlugin, source: string, fetch: boolean) { 383 | super(app); 384 | this.plugin = plugin; 385 | this.source = source; 386 | this.fetch = fetch; 387 | } 388 | 389 | async onOpen() { 390 | let { contentEl, source, plugin, fetch } = this; 391 | let content: string = source; 392 | if (fetch) { 393 | contentEl.createDiv({ text: `Waiting for content from: '${source}'` }); 394 | content = await request({ url: source }); 395 | contentEl.empty(); 396 | } 397 | const logDiv = contentEl.createDiv({ cls: "OCL-RenderedMarkdownModal" }); 398 | MarkdownRenderer.render(app, content, logDiv, "", plugin); 399 | } 400 | 401 | onClose() { 402 | this.contentEl.empty(); 403 | } 404 | } 405 | 406 | /** 407 | * Add a button to an HTMLELement, which, when clicked, pops up a {@link RenderedMarkdownModal} showing rendered markdown. 408 | * 409 | * Use `fetch` to indicate whether the markdown string needs to be fetched, or if it has been provided as a string already. 410 | * 411 | * ![](https://i.imgur.com/Hi4gyyv.png) 412 | * @param {YourPlugin} plugin 413 | * @param {HTMLElement} containerEl HTMLElement to add the button to 414 | * @param {string} source Raw markdown content or url to find raw markdown. 415 | * @param {boolean} fetch True → fetch markdown from `source` as url. False → `source` is already a markdown string. 416 | * @param {string} displayText Text to display in the button. 417 | */ 418 | export function addRenderedMarkdownButton( 419 | plugin: YourPlugin, 420 | containerEl: HTMLElement, 421 | source: string, 422 | fetch: boolean, 423 | displayText: string 424 | ) { 425 | containerEl.createEl("button", { text: displayText }, (but) => 426 | but.onClickEvent(() => { 427 | new RenderedMarkdownModal(plugin, source, fetch).open(); 428 | }) 429 | ); 430 | } 431 | /** 432 | * Check if `app.metadataCache.ResolvedLinks` have fully initalised. 433 | * 434 | * Used with {@link waitForResolvedLinks}. 435 | * @param {number} noFiles Number of files in your vault. 436 | * @returns {boolean} 437 | */ 438 | export function resolvedLinksComplete(noFiles: number): boolean { 439 | const { resolvedLinks } = app.metadataCache; 440 | return Object.keys(resolvedLinks).length === noFiles; 441 | } 442 | 443 | /** 444 | * Wait for `app.metadataCache.ResolvedLinks` to have fully initialised. 445 | * @param {number} [delay=1000] Number of milliseconds to wait between each check. 446 | * @param {number} [max=50] Maximum number of iterations to check before throwing an error and breaking out of the loop. 447 | */ 448 | export async function waitForResolvedLinks( 449 | delay: number = 1000, 450 | max: number = 50 451 | ) { 452 | const noFiles = app.vault.getMarkdownFiles().length; 453 | let i = 0; 454 | while (!resolvedLinksComplete(noFiles) && i < max) { 455 | await wait(delay); 456 | i++; 457 | } 458 | if (i === max) { 459 | throw Error( 460 | "Obsidian-Community-Lib: ResolvedLinks did not finish initialising. `max` iterations was reached first." 461 | ); 462 | } 463 | } 464 | 465 | /** 466 | * Check if the content of a note has YAML. If so, return an array of the YAML and the rest of the note. If not, return `['', content]` 467 | * @param {string} content 468 | */ 469 | export function splitAtYaml(content: string): [string, string] { 470 | if (!/^---\n/.test(content)) return ["", content]; 471 | else { 472 | const splits = content.split("---"); 473 | return [ 474 | splits.slice(0, 2).join("---") + "---", 475 | splits.slice(2).join("---"), 476 | ]; 477 | } 478 | } 479 | 480 | /** 481 | * 482 | * @param {boolean} cached Return cached file content **or** return what's on disk. 483 | * @returns 484 | */ 485 | export async function getActiveFileContent( 486 | cached = true 487 | ): Promise { 488 | const currFile = app.workspace.getActiveFile(); 489 | if (!(currFile instanceof TFile)) return null; 490 | if (cached) return await app.vault.cachedRead(currFile); 491 | else return await app.vault.read(currFile); 492 | } 493 | -------------------------------------------------------------------------------- /docs/classes/RenderedMarkdownModal.html: -------------------------------------------------------------------------------- 1 | RenderedMarkdownModal | obsidian-community-lib
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RenderedMarkdownModal<YourPlugin>

2 |

A Modal used in addRenderedMarkdownButton to display rendered markdown from a raw string, or fetched from a provided url.

3 |

4 |
param plugin
param source

Raw markdown content or url to find raw markdown.

5 |
param fetch

True → fetch markdown from source as url. False → source is already a markdown string.

6 |

Type parameters

  • YourPlugin: Plugin

Hierarchy

  • Modal
    • RenderedMarkdownModal

Index

Constructors

constructor

  • new RenderedMarkdownModal<YourPlugin>(plugin: YourPlugin, source: string, fetch: boolean): RenderedMarkdownModal<YourPlugin>
  • Type parameters

    • YourPlugin: Plugin_2<YourPlugin>

    Parameters

    • plugin: YourPlugin
    • source: string
    • fetch: boolean

    Returns RenderedMarkdownModal<YourPlugin>

Properties

app

app: App

containerEl

containerEl: HTMLElement

contentEl

contentEl: HTMLElement

fetch

fetch: boolean

modalEl

modalEl: HTMLElement

plugin

plugin: YourPlugin

scope

scope: Scope

shouldRestoreSelection

shouldRestoreSelection: boolean

source

source: string

titleEl

titleEl: HTMLElement

Methods

close

  • close(): void
  • Returns void

onClose

  • onClose(): void

onOpen

  • onOpen(): Promise<void>

open

  • open(): void
  • Returns void

Legend

  • Property
  • Method

Settings

Theme

Generated using TypeDoc

-------------------------------------------------------------------------------- /docs/assets/style.css: -------------------------------------------------------------------------------- 1 | @import url("./icons.css"); 2 | 3 | :root { 4 | /* Light */ 5 | --light-color-background: #fcfcfc; 6 | --light-color-secondary-background: #fff; 7 | --light-color-text: #222; 8 | --light-color-text-aside: #707070; 9 | --light-color-link: #4da6ff; 10 | --light-color-menu-divider: #eee; 11 | --light-color-menu-divider-focus: #000; 12 | --light-color-menu-label: #707070; 13 | --light-color-panel: var(--light-color-secondary-background); 14 | --light-color-panel-divider: #eee; 15 | --light-color-comment-tag: #707070; 16 | --light-color-comment-tag-text: #fff; 17 | --light-color-ts: #9600ff; 18 | --light-color-ts-interface: #647f1b; 19 | --light-color-ts-enum: #937210; 20 | --light-color-ts-class: #0672de; 21 | --light-color-ts-private: #707070; 22 | --light-color-toolbar: #fff; 23 | --light-color-toolbar-text: #333; 24 | --light-icon-filter: invert(0); 25 | --light-external-icon: url("data:image/svg+xml;utf8,"); 26 | 27 | /* Dark */ 28 | --dark-color-background: #36393f; 29 | --dark-color-secondary-background: #2f3136; 30 | --dark-color-text: #ffffff; 31 | --dark-color-text-aside: #e6e4e4; 32 | --dark-color-link: #00aff4; 33 | --dark-color-menu-divider: #eee; 34 | --dark-color-menu-divider-focus: #000; 35 | --dark-color-menu-label: #707070; 36 | --dark-color-panel: var(--dark-color-secondary-background); 37 | --dark-color-panel-divider: #818181; 38 | --dark-color-comment-tag: #dcddde; 39 | --dark-color-comment-tag-text: #2f3136; 40 | --dark-color-ts: #c97dff; 41 | --dark-color-ts-interface: #9cbe3c; 42 | --dark-color-ts-enum: #d6ab29; 43 | --dark-color-ts-class: #3695f3; 44 | --dark-color-ts-private: #e2e2e2; 45 | --dark-color-toolbar: #34373c; 46 | --dark-color-toolbar-text: #ffffff; 47 | --dark-icon-filter: invert(1); 48 | --dark-external-icon: url("data:image/svg+xml;utf8,"); 49 | } 50 | 51 | @media (prefers-color-scheme: light) { 52 | :root { 53 | --color-background: var(--light-color-background); 54 | --color-secondary-background: var(--light-color-secondary-background); 55 | --color-text: var(--light-color-text); 56 | --color-text-aside: var(--light-color-text-aside); 57 | --color-link: var(--light-color-link); 58 | --color-menu-divider: var(--light-color-menu-divider); 59 | --color-menu-divider-focus: var(--light-color-menu-divider-focus); 60 | --color-menu-label: var(--light-color-menu-label); 61 | --color-panel: var(--light-color-panel); 62 | --color-panel-divider: var(--light-color-panel-divider); 63 | --color-comment-tag: var(--light-color-comment-tag); 64 | --color-comment-tag-text: var(--light-color-comment-tag-text); 65 | --color-ts: var(--light-color-ts); 66 | --color-ts-interface: var(--light-color-ts-interface); 67 | --color-ts-enum: var(--light-color-ts-enum); 68 | --color-ts-class: var(--light-color-ts-class); 69 | --color-ts-private: var(--light-color-ts-private); 70 | --color-toolbar: var(--light-color-toolbar); 71 | --color-toolbar-text: var(--light-color-toolbar-text); 72 | --icon-filter: var(--light-icon-filter); 73 | --external-icon: var(--light-external-icon); 74 | } 75 | } 76 | 77 | @media (prefers-color-scheme: dark) { 78 | :root { 79 | --color-background: var(--dark-color-background); 80 | --color-secondary-background: var(--dark-color-secondary-background); 81 | --color-text: var(--dark-color-text); 82 | --color-text-aside: var(--dark-color-text-aside); 83 | --color-link: var(--dark-color-link); 84 | --color-menu-divider: var(--dark-color-menu-divider); 85 | --color-menu-divider-focus: var(--dark-color-menu-divider-focus); 86 | --color-menu-label: var(--dark-color-menu-label); 87 | --color-panel: var(--dark-color-panel); 88 | --color-panel-divider: var(--dark-color-panel-divider); 89 | --color-comment-tag: var(--dark-color-comment-tag); 90 | --color-comment-tag-text: var(--dark-color-comment-tag-text); 91 | --color-ts: var(--dark-color-ts); 92 | --color-ts-interface: var(--dark-color-ts-interface); 93 | --color-ts-enum: var(--dark-color-ts-enum); 94 | --color-ts-class: var(--dark-color-ts-class); 95 | --color-ts-private: var(--dark-color-ts-private); 96 | --color-toolbar: var(--dark-color-toolbar); 97 | --color-toolbar-text: var(--dark-color-toolbar-text); 98 | --icon-filter: var(--dark-icon-filter); 99 | --external-icon: var(--dark-external-icon); 100 | } 101 | } 102 | 103 | body { 104 | margin: 0; 105 | } 106 | 107 | body.light { 108 | --color-background: var(--light-color-background); 109 | --color-secondary-background: var(--light-color-secondary-background); 110 | --color-text: var(--light-color-text); 111 | --color-text-aside: var(--light-color-text-aside); 112 | --color-link: var(--light-color-link); 113 | --color-menu-divider: var(--light-color-menu-divider); 114 | --color-menu-divider-focus: var(--light-color-menu-divider-focus); 115 | --color-menu-label: var(--light-color-menu-label); 116 | --color-panel: var(--light-color-panel); 117 | --color-panel-divider: var(--light-color-panel-divider); 118 | --color-comment-tag: var(--light-color-comment-tag); 119 | --color-comment-tag-text: var(--light-color-comment-tag-text); 120 | --color-ts: var(--light-color-ts); 121 | --color-ts-interface: var(--light-color-ts-interface); 122 | --color-ts-enum: var(--light-color-ts-enum); 123 | --color-ts-class: var(--light-color-ts-class); 124 | --color-ts-private: var(--light-color-ts-private); 125 | --color-toolbar: var(--light-color-toolbar); 126 | --color-toolbar-text: var(--light-color-toolbar-text); 127 | --icon-filter: var(--light-icon-filter); 128 | --external-icon: var(--light-external-icon); 129 | } 130 | 131 | body.dark { 132 | --color-background: var(--dark-color-background); 133 | --color-secondary-background: var(--dark-color-secondary-background); 134 | --color-text: var(--dark-color-text); 135 | --color-text-aside: var(--dark-color-text-aside); 136 | --color-link: var(--dark-color-link); 137 | --color-menu-divider: var(--dark-color-menu-divider); 138 | --color-menu-divider-focus: var(--dark-color-menu-divider-focus); 139 | --color-menu-label: var(--dark-color-menu-label); 140 | --color-panel: var(--dark-color-panel); 141 | --color-panel-divider: var(--dark-color-panel-divider); 142 | --color-comment-tag: var(--dark-color-comment-tag); 143 | --color-comment-tag-text: var(--dark-color-comment-tag-text); 144 | --color-ts: var(--dark-color-ts); 145 | --color-ts-interface: var(--dark-color-ts-interface); 146 | --color-ts-enum: var(--dark-color-ts-enum); 147 | --color-ts-class: var(--dark-color-ts-class); 148 | --color-ts-private: var(--dark-color-ts-private); 149 | --color-toolbar: var(--dark-color-toolbar); 150 | --color-toolbar-text: var(--dark-color-toolbar-text); 151 | --icon-filter: var(--dark-icon-filter); 152 | --external-icon: var(--dark-external-icon); 153 | } 154 | 155 | h1 { 156 | font-size: 2em; 157 | margin: 0.67em 0; 158 | } 159 | 160 | h2 { 161 | font-size: 1.5em; 162 | margin: 0.83em 0; 163 | } 164 | 165 | h3 { 166 | font-size: 1.17em; 167 | margin: 1em 0; 168 | } 169 | 170 | h4, 171 | .tsd-index-panel h3 { 172 | font-size: 1em; 173 | margin: 1.33em 0; 174 | } 175 | 176 | h5 { 177 | font-size: 0.83em; 178 | margin: 1.67em 0; 179 | } 180 | 181 | h6 { 182 | font-size: 0.67em; 183 | margin: 2.33em 0; 184 | } 185 | 186 | pre { 187 | white-space: pre; 188 | white-space: pre-wrap; 189 | word-wrap: break-word; 190 | } 191 | 192 | dl, 193 | menu, 194 | ol, 195 | ul { 196 | margin: 1em 0; 197 | } 198 | 199 | dd { 200 | margin: 0 0 0 40px; 201 | } 202 | 203 | .container { 204 | max-width: 1200px; 205 | margin: 0 auto; 206 | padding: 0 40px; 207 | } 208 | @media (max-width: 640px) { 209 | .container { 210 | padding: 0 20px; 211 | } 212 | } 213 | 214 | .container-main { 215 | padding-bottom: 200px; 216 | } 217 | 218 | .row { 219 | display: flex; 220 | position: relative; 221 | margin: 0 -10px; 222 | } 223 | .row:after { 224 | visibility: hidden; 225 | display: block; 226 | content: ""; 227 | clear: both; 228 | height: 0; 229 | } 230 | 231 | .col-4, 232 | .col-8 { 233 | box-sizing: border-box; 234 | float: left; 235 | padding: 0 10px; 236 | } 237 | 238 | .col-4 { 239 | width: 33.3333333333%; 240 | } 241 | .col-8 { 242 | width: 66.6666666667%; 243 | } 244 | 245 | ul.tsd-descriptions > li > :first-child, 246 | .tsd-panel > :first-child, 247 | .col-8 > :first-child, 248 | .col-4 > :first-child, 249 | ul.tsd-descriptions > li > :first-child > :first-child, 250 | .tsd-panel > :first-child > :first-child, 251 | .col-8 > :first-child > :first-child, 252 | .col-4 > :first-child > :first-child, 253 | ul.tsd-descriptions > li > :first-child > :first-child > :first-child, 254 | .tsd-panel > :first-child > :first-child > :first-child, 255 | .col-8 > :first-child > :first-child > :first-child, 256 | .col-4 > :first-child > :first-child > :first-child { 257 | margin-top: 0; 258 | } 259 | ul.tsd-descriptions > li > :last-child, 260 | .tsd-panel > :last-child, 261 | .col-8 > :last-child, 262 | .col-4 > :last-child, 263 | ul.tsd-descriptions > li > :last-child > :last-child, 264 | .tsd-panel > :last-child > :last-child, 265 | .col-8 > :last-child > :last-child, 266 | .col-4 > :last-child > :last-child, 267 | ul.tsd-descriptions > li > :last-child > :last-child > :last-child, 268 | .tsd-panel > :last-child > :last-child > :last-child, 269 | .col-8 > :last-child > :last-child > :last-child, 270 | .col-4 > :last-child > :last-child > :last-child { 271 | margin-bottom: 0; 272 | } 273 | 274 | @keyframes fade-in { 275 | from { 276 | opacity: 0; 277 | } 278 | to { 279 | opacity: 1; 280 | } 281 | } 282 | @keyframes fade-out { 283 | from { 284 | opacity: 1; 285 | visibility: visible; 286 | } 287 | to { 288 | opacity: 0; 289 | } 290 | } 291 | @keyframes fade-in-delayed { 292 | 0% { 293 | opacity: 0; 294 | } 295 | 33% { 296 | opacity: 0; 297 | } 298 | 100% { 299 | opacity: 1; 300 | } 301 | } 302 | @keyframes fade-out-delayed { 303 | 0% { 304 | opacity: 1; 305 | visibility: visible; 306 | } 307 | 66% { 308 | opacity: 0; 309 | } 310 | 100% { 311 | opacity: 0; 312 | } 313 | } 314 | @keyframes shift-to-left { 315 | from { 316 | transform: translate(0, 0); 317 | } 318 | to { 319 | transform: translate(-25%, 0); 320 | } 321 | } 322 | @keyframes unshift-to-left { 323 | from { 324 | transform: translate(-25%, 0); 325 | } 326 | to { 327 | transform: translate(0, 0); 328 | } 329 | } 330 | @keyframes pop-in-from-right { 331 | from { 332 | transform: translate(100%, 0); 333 | } 334 | to { 335 | transform: translate(0, 0); 336 | } 337 | } 338 | @keyframes pop-out-to-right { 339 | from { 340 | transform: translate(0, 0); 341 | visibility: visible; 342 | } 343 | to { 344 | transform: translate(100%, 0); 345 | } 346 | } 347 | body { 348 | background: var(--color-background); 349 | font-family: "Segoe UI", sans-serif; 350 | font-size: 16px; 351 | color: var(--color-text); 352 | } 353 | 354 | a { 355 | color: var(--color-link); 356 | text-decoration: none; 357 | } 358 | a:hover { 359 | text-decoration: underline; 360 | } 361 | a.external[target="_blank"] { 362 | background-image: var(--external-icon); 363 | background-position: top 3px right; 364 | background-repeat: no-repeat; 365 | padding-right: 13px; 366 | } 367 | 368 | code, 369 | pre { 370 | font-family: Menlo, Monaco, Consolas, "Courier New", monospace; 371 | padding: 0.2em; 372 | margin: 0; 373 | font-size: 14px; 374 | } 375 | 376 | pre { 377 | padding: 10px; 378 | } 379 | pre code { 380 | padding: 0; 381 | font-size: 100%; 382 | } 383 | 384 | blockquote { 385 | margin: 1em 0; 386 | padding-left: 1em; 387 | border-left: 4px solid gray; 388 | } 389 | 390 | .tsd-typography { 391 | line-height: 1.333em; 392 | } 393 | .tsd-typography ul { 394 | list-style: square; 395 | padding: 0 0 0 20px; 396 | margin: 0; 397 | } 398 | .tsd-typography h4, 399 | .tsd-typography .tsd-index-panel h3, 400 | .tsd-index-panel .tsd-typography h3, 401 | .tsd-typography h5, 402 | .tsd-typography h6 { 403 | font-size: 1em; 404 | margin: 0; 405 | } 406 | .tsd-typography h5, 407 | .tsd-typography h6 { 408 | font-weight: normal; 409 | } 410 | .tsd-typography p, 411 | .tsd-typography ul, 412 | .tsd-typography ol { 413 | margin: 1em 0; 414 | } 415 | 416 | @media (min-width: 901px) and (max-width: 1024px) { 417 | html .col-content { 418 | width: 72%; 419 | } 420 | html .col-menu { 421 | width: 28%; 422 | } 423 | html .tsd-navigation { 424 | padding-left: 10px; 425 | } 426 | } 427 | @media (max-width: 900px) { 428 | html .col-content { 429 | float: none; 430 | width: 100%; 431 | } 432 | html .col-menu { 433 | position: fixed !important; 434 | overflow: auto; 435 | -webkit-overflow-scrolling: touch; 436 | z-index: 1024; 437 | top: 0 !important; 438 | bottom: 0 !important; 439 | left: auto !important; 440 | right: 0 !important; 441 | width: 100%; 442 | padding: 20px 20px 0 0; 443 | max-width: 450px; 444 | visibility: hidden; 445 | background-color: var(--color-panel); 446 | transform: translate(100%, 0); 447 | } 448 | html .col-menu > *:last-child { 449 | padding-bottom: 20px; 450 | } 451 | html .overlay { 452 | content: ""; 453 | display: block; 454 | position: fixed; 455 | z-index: 1023; 456 | top: 0; 457 | left: 0; 458 | right: 0; 459 | bottom: 0; 460 | background-color: rgba(0, 0, 0, 0.75); 461 | visibility: hidden; 462 | } 463 | 464 | .to-has-menu .overlay { 465 | animation: fade-in 0.4s; 466 | } 467 | 468 | .to-has-menu :is(header, footer, .col-content) { 469 | animation: shift-to-left 0.4s; 470 | } 471 | 472 | .to-has-menu .col-menu { 473 | animation: pop-in-from-right 0.4s; 474 | } 475 | 476 | .from-has-menu .overlay { 477 | animation: fade-out 0.4s; 478 | } 479 | 480 | .from-has-menu :is(header, footer, .col-content) { 481 | animation: unshift-to-left 0.4s; 482 | } 483 | 484 | .from-has-menu .col-menu { 485 | animation: pop-out-to-right 0.4s; 486 | } 487 | 488 | .has-menu body { 489 | overflow: hidden; 490 | } 491 | .has-menu .overlay { 492 | visibility: visible; 493 | } 494 | .has-menu :is(header, footer, .col-content) { 495 | transform: translate(-25%, 0); 496 | } 497 | .has-menu .col-menu { 498 | visibility: visible; 499 | transform: translate(0, 0); 500 | display: grid; 501 | grid-template-rows: auto 1fr; 502 | max-height: 100vh; 503 | } 504 | .has-menu .tsd-navigation { 505 | max-height: 100%; 506 | } 507 | } 508 | 509 | .tsd-page-title { 510 | padding: 70px 0 20px 0; 511 | margin: 0 0 40px 0; 512 | background: var(--color-panel); 513 | box-shadow: 0 0 5px rgba(0, 0, 0, 0.35); 514 | } 515 | .tsd-page-title h1 { 516 | margin: 0; 517 | } 518 | 519 | .tsd-breadcrumb { 520 | margin: 0; 521 | padding: 0; 522 | color: var(--color-text-aside); 523 | } 524 | .tsd-breadcrumb a { 525 | color: var(--color-text-aside); 526 | text-decoration: none; 527 | } 528 | .tsd-breadcrumb a:hover { 529 | text-decoration: underline; 530 | } 531 | .tsd-breadcrumb li { 532 | display: inline; 533 | } 534 | .tsd-breadcrumb li:after { 535 | content: " / "; 536 | } 537 | 538 | dl.tsd-comment-tags { 539 | overflow: hidden; 540 | } 541 | dl.tsd-comment-tags dt { 542 | float: left; 543 | padding: 1px 5px; 544 | margin: 0 10px 0 0; 545 | border-radius: 4px; 546 | border: 1px solid var(--color-comment-tag); 547 | color: var(--color-comment-tag); 548 | font-size: 0.8em; 549 | font-weight: normal; 550 | } 551 | dl.tsd-comment-tags dd { 552 | margin: 0 0 10px 0; 553 | } 554 | dl.tsd-comment-tags dd:before, 555 | dl.tsd-comment-tags dd:after { 556 | display: table; 557 | content: " "; 558 | } 559 | dl.tsd-comment-tags dd pre, 560 | dl.tsd-comment-tags dd:after { 561 | clear: both; 562 | } 563 | dl.tsd-comment-tags p { 564 | margin: 0; 565 | } 566 | 567 | .tsd-panel.tsd-comment .lead { 568 | font-size: 1.1em; 569 | line-height: 1.333em; 570 | margin-bottom: 2em; 571 | } 572 | .tsd-panel.tsd-comment .lead:last-child { 573 | margin-bottom: 0; 574 | } 575 | 576 | .toggle-protected .tsd-is-private { 577 | display: none; 578 | } 579 | 580 | .toggle-public .tsd-is-private, 581 | .toggle-public .tsd-is-protected, 582 | .toggle-public .tsd-is-private-protected { 583 | display: none; 584 | } 585 | 586 | .toggle-inherited .tsd-is-inherited { 587 | display: none; 588 | } 589 | 590 | .toggle-externals .tsd-is-external { 591 | display: none; 592 | } 593 | 594 | #tsd-filter { 595 | position: relative; 596 | display: inline-block; 597 | height: 40px; 598 | vertical-align: bottom; 599 | } 600 | .no-filter #tsd-filter { 601 | display: none; 602 | } 603 | #tsd-filter .tsd-filter-group { 604 | display: inline-block; 605 | height: 40px; 606 | vertical-align: bottom; 607 | white-space: nowrap; 608 | } 609 | #tsd-filter input { 610 | display: none; 611 | } 612 | @media (max-width: 900px) { 613 | #tsd-filter .tsd-filter-group { 614 | display: block; 615 | position: absolute; 616 | top: 40px; 617 | right: 20px; 618 | height: auto; 619 | background-color: var(--color-panel); 620 | visibility: hidden; 621 | transform: translate(50%, 0); 622 | box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); 623 | } 624 | .has-options #tsd-filter .tsd-filter-group { 625 | visibility: visible; 626 | } 627 | .to-has-options #tsd-filter .tsd-filter-group { 628 | animation: fade-in 0.2s; 629 | } 630 | .from-has-options #tsd-filter .tsd-filter-group { 631 | animation: fade-out 0.2s; 632 | } 633 | #tsd-filter label, 634 | #tsd-filter .tsd-select { 635 | display: block; 636 | padding-right: 20px; 637 | } 638 | } 639 | 640 | footer { 641 | border-top: 1px solid var(--color-panel-divider); 642 | background-color: var(--color-panel); 643 | } 644 | footer:after { 645 | content: ""; 646 | display: table; 647 | } 648 | footer.with-border-bottom { 649 | border-bottom: 1px solid var(--color-panel-divider); 650 | } 651 | footer .tsd-legend-group { 652 | font-size: 0; 653 | } 654 | footer .tsd-legend { 655 | display: inline-block; 656 | width: 25%; 657 | padding: 0; 658 | font-size: 16px; 659 | list-style: none; 660 | line-height: 1.333em; 661 | vertical-align: top; 662 | } 663 | @media (max-width: 900px) { 664 | footer .tsd-legend { 665 | width: 50%; 666 | } 667 | } 668 | 669 | .tsd-hierarchy { 670 | list-style: square; 671 | padding: 0 0 0 20px; 672 | margin: 0; 673 | } 674 | .tsd-hierarchy .target { 675 | font-weight: bold; 676 | } 677 | 678 | .tsd-index-panel .tsd-index-content { 679 | margin-bottom: -30px !important; 680 | } 681 | .tsd-index-panel .tsd-index-section { 682 | margin-bottom: 30px !important; 683 | } 684 | .tsd-index-panel h3 { 685 | margin: 0 -20px 10px -20px; 686 | padding: 0 20px 10px 20px; 687 | border-bottom: 1px solid var(--color-panel-divider); 688 | } 689 | .tsd-index-panel ul.tsd-index-list { 690 | -webkit-column-count: 3; 691 | -moz-column-count: 3; 692 | -ms-column-count: 3; 693 | -o-column-count: 3; 694 | column-count: 3; 695 | -webkit-column-gap: 20px; 696 | -moz-column-gap: 20px; 697 | -ms-column-gap: 20px; 698 | -o-column-gap: 20px; 699 | column-gap: 20px; 700 | padding: 0; 701 | list-style: none; 702 | line-height: 1.333em; 703 | } 704 | @media (max-width: 900px) { 705 | .tsd-index-panel ul.tsd-index-list { 706 | -webkit-column-count: 1; 707 | -moz-column-count: 1; 708 | -ms-column-count: 1; 709 | -o-column-count: 1; 710 | column-count: 1; 711 | } 712 | } 713 | @media (min-width: 901px) and (max-width: 1024px) { 714 | .tsd-index-panel ul.tsd-index-list { 715 | -webkit-column-count: 2; 716 | -moz-column-count: 2; 717 | -ms-column-count: 2; 718 | -o-column-count: 2; 719 | column-count: 2; 720 | } 721 | } 722 | .tsd-index-panel ul.tsd-index-list li { 723 | -webkit-page-break-inside: avoid; 724 | -moz-page-break-inside: avoid; 725 | -ms-page-break-inside: avoid; 726 | -o-page-break-inside: avoid; 727 | page-break-inside: avoid; 728 | } 729 | .tsd-index-panel a, 730 | .tsd-index-panel .tsd-parent-kind-module a { 731 | color: var(--color-ts); 732 | } 733 | .tsd-index-panel .tsd-parent-kind-interface a { 734 | color: var(--color-ts-interface); 735 | } 736 | .tsd-index-panel .tsd-parent-kind-enum a { 737 | color: var(--color-ts-enum); 738 | } 739 | .tsd-index-panel .tsd-parent-kind-class a { 740 | color: var(--color-ts-class); 741 | } 742 | .tsd-index-panel .tsd-kind-module a { 743 | color: var(--color-ts); 744 | } 745 | .tsd-index-panel .tsd-kind-interface a { 746 | color: var(--color-ts-interface); 747 | } 748 | .tsd-index-panel .tsd-kind-enum a { 749 | color: var(--color-ts-enum); 750 | } 751 | .tsd-index-panel .tsd-kind-class a { 752 | color: var(--color-ts-class); 753 | } 754 | .tsd-index-panel .tsd-is-private a { 755 | color: var(--color-ts-private); 756 | } 757 | 758 | .tsd-flag { 759 | display: inline-block; 760 | padding: 1px 5px; 761 | border-radius: 4px; 762 | color: var(--color-comment-tag-text); 763 | background-color: var(--color-comment-tag); 764 | text-indent: 0; 765 | font-size: 14px; 766 | font-weight: normal; 767 | } 768 | 769 | .tsd-anchor { 770 | position: absolute; 771 | top: -100px; 772 | } 773 | 774 | .tsd-member { 775 | position: relative; 776 | } 777 | .tsd-member .tsd-anchor + h3 { 778 | margin-top: 0; 779 | margin-bottom: 0; 780 | border-bottom: none; 781 | } 782 | .tsd-member [data-tsd-kind] { 783 | color: var(--color-ts); 784 | } 785 | .tsd-member [data-tsd-kind="Interface"] { 786 | color: var(--color-ts-interface); 787 | } 788 | .tsd-member [data-tsd-kind="Enum"] { 789 | color: var(--color-ts-enum); 790 | } 791 | .tsd-member [data-tsd-kind="Class"] { 792 | color: var(--color-ts-class); 793 | } 794 | .tsd-member [data-tsd-kind="Private"] { 795 | color: var(--color-ts-private); 796 | } 797 | 798 | .tsd-navigation { 799 | margin: 0 0 0 40px; 800 | } 801 | .tsd-navigation a { 802 | display: block; 803 | padding-top: 2px; 804 | padding-bottom: 2px; 805 | border-left: 2px solid transparent; 806 | color: var(--color-text); 807 | text-decoration: none; 808 | transition: border-left-color 0.1s; 809 | } 810 | .tsd-navigation a:hover { 811 | text-decoration: underline; 812 | } 813 | .tsd-navigation ul { 814 | margin: 0; 815 | padding: 0; 816 | list-style: none; 817 | } 818 | .tsd-navigation li { 819 | padding: 0; 820 | } 821 | 822 | .tsd-navigation.primary { 823 | padding-bottom: 40px; 824 | } 825 | .tsd-navigation.primary a { 826 | display: block; 827 | padding-top: 6px; 828 | padding-bottom: 6px; 829 | } 830 | .tsd-navigation.primary ul li a { 831 | padding-left: 5px; 832 | } 833 | .tsd-navigation.primary ul li li a { 834 | padding-left: 25px; 835 | } 836 | .tsd-navigation.primary ul li li li a { 837 | padding-left: 45px; 838 | } 839 | .tsd-navigation.primary ul li li li li a { 840 | padding-left: 65px; 841 | } 842 | .tsd-navigation.primary ul li li li li li a { 843 | padding-left: 85px; 844 | } 845 | .tsd-navigation.primary ul li li li li li li a { 846 | padding-left: 105px; 847 | } 848 | .tsd-navigation.primary > ul { 849 | border-bottom: 1px solid var(--color-panel-divider); 850 | } 851 | .tsd-navigation.primary li { 852 | border-top: 1px solid var(--color-panel-divider); 853 | } 854 | .tsd-navigation.primary li.current > a { 855 | font-weight: bold; 856 | } 857 | .tsd-navigation.primary li.label span { 858 | display: block; 859 | padding: 20px 0 6px 5px; 860 | color: var(--color-menu-label); 861 | } 862 | .tsd-navigation.primary li.globals + li > span, 863 | .tsd-navigation.primary li.globals + li > a { 864 | padding-top: 20px; 865 | } 866 | 867 | .tsd-navigation.secondary { 868 | max-height: calc(100vh - 1rem - 40px); 869 | overflow: auto; 870 | position: sticky; 871 | top: calc(0.5rem + 40px); 872 | transition: 0.3s; 873 | } 874 | .tsd-navigation.secondary.tsd-navigation--toolbar-hide { 875 | max-height: calc(100vh - 1rem); 876 | top: 0.5rem; 877 | } 878 | .tsd-navigation.secondary ul { 879 | transition: opacity 0.2s; 880 | } 881 | .tsd-navigation.secondary ul li a { 882 | padding-left: 25px; 883 | } 884 | .tsd-navigation.secondary ul li li a { 885 | padding-left: 45px; 886 | } 887 | .tsd-navigation.secondary ul li li li a { 888 | padding-left: 65px; 889 | } 890 | .tsd-navigation.secondary ul li li li li a { 891 | padding-left: 85px; 892 | } 893 | .tsd-navigation.secondary ul li li li li li a { 894 | padding-left: 105px; 895 | } 896 | .tsd-navigation.secondary ul li li li li li li a { 897 | padding-left: 125px; 898 | } 899 | .tsd-navigation.secondary ul.current a { 900 | border-left-color: var(--color-panel-divider); 901 | } 902 | .tsd-navigation.secondary li.focus > a, 903 | .tsd-navigation.secondary ul.current li.focus > a { 904 | border-left-color: var(--color-menu-divider-focus); 905 | } 906 | .tsd-navigation.secondary li.current { 907 | margin-top: 20px; 908 | margin-bottom: 20px; 909 | border-left-color: var(--color-panel-divider); 910 | } 911 | .tsd-navigation.secondary li.current > a { 912 | font-weight: bold; 913 | } 914 | 915 | @media (min-width: 901px) { 916 | .menu-sticky-wrap { 917 | position: static; 918 | } 919 | } 920 | 921 | .tsd-panel { 922 | margin: 20px 0; 923 | padding: 20px; 924 | background-color: var(--color-panel); 925 | box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); 926 | } 927 | .tsd-panel:empty { 928 | display: none; 929 | } 930 | .tsd-panel > h1, 931 | .tsd-panel > h2, 932 | .tsd-panel > h3 { 933 | margin: 1.5em -20px 10px -20px; 934 | padding: 0 20px 10px 20px; 935 | border-bottom: 1px solid var(--color-panel-divider); 936 | } 937 | .tsd-panel > h1.tsd-before-signature, 938 | .tsd-panel > h2.tsd-before-signature, 939 | .tsd-panel > h3.tsd-before-signature { 940 | margin-bottom: 0; 941 | border-bottom: 0; 942 | } 943 | .tsd-panel table { 944 | display: block; 945 | width: 100%; 946 | overflow: auto; 947 | margin-top: 10px; 948 | word-break: normal; 949 | word-break: keep-all; 950 | border-collapse: collapse; 951 | } 952 | .tsd-panel table th { 953 | font-weight: bold; 954 | } 955 | .tsd-panel table th, 956 | .tsd-panel table td { 957 | padding: 6px 13px; 958 | border: 1px solid var(--color-panel-divider); 959 | } 960 | .tsd-panel table tr { 961 | background: var(--color-background); 962 | } 963 | .tsd-panel table tr:nth-child(even) { 964 | background: var(--color-secondary-background); 965 | } 966 | 967 | .tsd-panel-group { 968 | margin: 60px 0; 969 | } 970 | .tsd-panel-group > h1, 971 | .tsd-panel-group > h2, 972 | .tsd-panel-group > h3 { 973 | padding-left: 20px; 974 | padding-right: 20px; 975 | } 976 | 977 | #tsd-search { 978 | transition: background-color 0.2s; 979 | } 980 | #tsd-search .title { 981 | position: relative; 982 | z-index: 2; 983 | } 984 | #tsd-search .field { 985 | position: absolute; 986 | left: 0; 987 | top: 0; 988 | right: 40px; 989 | height: 40px; 990 | } 991 | #tsd-search .field input { 992 | box-sizing: border-box; 993 | position: relative; 994 | top: -50px; 995 | z-index: 1; 996 | width: 100%; 997 | padding: 0 10px; 998 | opacity: 0; 999 | outline: 0; 1000 | border: 0; 1001 | background: transparent; 1002 | color: var(--color-text); 1003 | } 1004 | #tsd-search .field label { 1005 | position: absolute; 1006 | overflow: hidden; 1007 | right: -40px; 1008 | } 1009 | #tsd-search .field input, 1010 | #tsd-search .title { 1011 | transition: opacity 0.2s; 1012 | } 1013 | #tsd-search .results { 1014 | position: absolute; 1015 | visibility: hidden; 1016 | top: 40px; 1017 | width: 100%; 1018 | margin: 0; 1019 | padding: 0; 1020 | list-style: none; 1021 | box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); 1022 | } 1023 | #tsd-search .results li { 1024 | padding: 0 10px; 1025 | background-color: var(--color-background); 1026 | } 1027 | #tsd-search .results li:nth-child(even) { 1028 | background-color: var(--color-panel); 1029 | } 1030 | #tsd-search .results li.state { 1031 | display: none; 1032 | } 1033 | #tsd-search .results li.current, 1034 | #tsd-search .results li:hover { 1035 | background-color: var(--color-panel-divider); 1036 | } 1037 | #tsd-search .results a { 1038 | display: block; 1039 | } 1040 | #tsd-search .results a:before { 1041 | top: 10px; 1042 | } 1043 | #tsd-search .results span.parent { 1044 | color: var(--color-text-aside); 1045 | font-weight: normal; 1046 | } 1047 | #tsd-search.has-focus { 1048 | background-color: var(--color-panel-divider); 1049 | } 1050 | #tsd-search.has-focus .field input { 1051 | top: 0; 1052 | opacity: 1; 1053 | } 1054 | #tsd-search.has-focus .title { 1055 | z-index: 0; 1056 | opacity: 0; 1057 | } 1058 | #tsd-search.has-focus .results { 1059 | visibility: visible; 1060 | } 1061 | #tsd-search.loading .results li.state.loading { 1062 | display: block; 1063 | } 1064 | #tsd-search.failure .results li.state.failure { 1065 | display: block; 1066 | } 1067 | 1068 | .tsd-signature { 1069 | margin: 0 0 1em 0; 1070 | padding: 10px; 1071 | border: 1px solid var(--color-panel-divider); 1072 | font-family: Menlo, Monaco, Consolas, "Courier New", monospace; 1073 | font-size: 14px; 1074 | overflow-x: auto; 1075 | } 1076 | .tsd-signature.tsd-kind-icon { 1077 | padding-left: 30px; 1078 | } 1079 | .tsd-signature.tsd-kind-icon:before { 1080 | top: 10px; 1081 | left: 10px; 1082 | } 1083 | .tsd-panel > .tsd-signature { 1084 | margin-left: -20px; 1085 | margin-right: -20px; 1086 | border-width: 1px 0; 1087 | } 1088 | .tsd-panel > .tsd-signature.tsd-kind-icon { 1089 | padding-left: 40px; 1090 | } 1091 | .tsd-panel > .tsd-signature.tsd-kind-icon:before { 1092 | left: 20px; 1093 | } 1094 | 1095 | .tsd-signature-symbol { 1096 | color: var(--color-text-aside); 1097 | font-weight: normal; 1098 | } 1099 | 1100 | .tsd-signature-type { 1101 | font-style: italic; 1102 | font-weight: normal; 1103 | } 1104 | 1105 | .tsd-signatures { 1106 | padding: 0; 1107 | margin: 0 0 1em 0; 1108 | border: 1px solid var(--color-panel-divider); 1109 | } 1110 | .tsd-signatures .tsd-signature { 1111 | margin: 0; 1112 | border-width: 1px 0 0 0; 1113 | transition: background-color 0.1s; 1114 | } 1115 | .tsd-signatures .tsd-signature:first-child { 1116 | border-top-width: 0; 1117 | } 1118 | .tsd-signatures .tsd-signature.current { 1119 | background-color: var(--color-panel-divider); 1120 | } 1121 | .tsd-signatures.active > .tsd-signature { 1122 | cursor: pointer; 1123 | } 1124 | .tsd-panel > .tsd-signatures { 1125 | margin-left: -20px; 1126 | margin-right: -20px; 1127 | border-width: 1px 0; 1128 | } 1129 | .tsd-panel > .tsd-signatures .tsd-signature.tsd-kind-icon { 1130 | padding-left: 40px; 1131 | } 1132 | .tsd-panel > .tsd-signatures .tsd-signature.tsd-kind-icon:before { 1133 | left: 20px; 1134 | } 1135 | .tsd-panel > a.anchor + .tsd-signatures { 1136 | border-top-width: 0; 1137 | margin-top: -20px; 1138 | } 1139 | 1140 | ul.tsd-descriptions { 1141 | position: relative; 1142 | overflow: hidden; 1143 | padding: 0; 1144 | list-style: none; 1145 | } 1146 | ul.tsd-descriptions.active > .tsd-description { 1147 | display: none; 1148 | } 1149 | ul.tsd-descriptions.active > .tsd-description.current { 1150 | display: block; 1151 | } 1152 | ul.tsd-descriptions.active > .tsd-description.fade-in { 1153 | animation: fade-in-delayed 0.3s; 1154 | } 1155 | ul.tsd-descriptions.active > .tsd-description.fade-out { 1156 | animation: fade-out-delayed 0.3s; 1157 | position: absolute; 1158 | display: block; 1159 | top: 0; 1160 | left: 0; 1161 | right: 0; 1162 | opacity: 0; 1163 | visibility: hidden; 1164 | } 1165 | ul.tsd-descriptions h4, 1166 | ul.tsd-descriptions .tsd-index-panel h3, 1167 | .tsd-index-panel ul.tsd-descriptions h3 { 1168 | font-size: 16px; 1169 | margin: 1em 0 0.5em 0; 1170 | } 1171 | 1172 | ul.tsd-parameters, 1173 | ul.tsd-type-parameters { 1174 | list-style: square; 1175 | margin: 0; 1176 | padding-left: 20px; 1177 | } 1178 | ul.tsd-parameters > li.tsd-parameter-signature, 1179 | ul.tsd-type-parameters > li.tsd-parameter-signature { 1180 | list-style: none; 1181 | margin-left: -20px; 1182 | } 1183 | ul.tsd-parameters h5, 1184 | ul.tsd-type-parameters h5 { 1185 | font-size: 16px; 1186 | margin: 1em 0 0.5em 0; 1187 | } 1188 | ul.tsd-parameters .tsd-comment, 1189 | ul.tsd-type-parameters .tsd-comment { 1190 | margin-top: -0.5em; 1191 | } 1192 | 1193 | .tsd-sources { 1194 | font-size: 14px; 1195 | color: var(--color-text-aside); 1196 | margin: 0 0 1em 0; 1197 | } 1198 | .tsd-sources a { 1199 | color: var(--color-text-aside); 1200 | text-decoration: underline; 1201 | } 1202 | .tsd-sources ul, 1203 | .tsd-sources p { 1204 | margin: 0 !important; 1205 | } 1206 | .tsd-sources ul { 1207 | list-style: none; 1208 | padding: 0; 1209 | } 1210 | 1211 | .tsd-page-toolbar { 1212 | position: fixed; 1213 | z-index: 1; 1214 | top: 0; 1215 | left: 0; 1216 | width: 100%; 1217 | height: 40px; 1218 | color: var(--color-toolbar-text); 1219 | background: var(--color-toolbar); 1220 | border-bottom: 1px solid var(--color-panel-divider); 1221 | transition: transform 0.3s linear; 1222 | } 1223 | .tsd-page-toolbar a { 1224 | color: var(--color-toolbar-text); 1225 | text-decoration: none; 1226 | } 1227 | .tsd-page-toolbar a.title { 1228 | font-weight: bold; 1229 | } 1230 | .tsd-page-toolbar a.title:hover { 1231 | text-decoration: underline; 1232 | } 1233 | .tsd-page-toolbar .table-wrap { 1234 | display: table; 1235 | width: 100%; 1236 | height: 40px; 1237 | } 1238 | .tsd-page-toolbar .table-cell { 1239 | display: table-cell; 1240 | position: relative; 1241 | white-space: nowrap; 1242 | line-height: 40px; 1243 | } 1244 | .tsd-page-toolbar .table-cell:first-child { 1245 | width: 100%; 1246 | } 1247 | 1248 | .tsd-page-toolbar--hide { 1249 | transform: translateY(-100%); 1250 | } 1251 | 1252 | .tsd-select .tsd-select-list li:before, 1253 | .tsd-select .tsd-select-label:before, 1254 | .tsd-widget:before { 1255 | content: ""; 1256 | display: inline-block; 1257 | width: 40px; 1258 | height: 40px; 1259 | margin: 0 -8px 0 0; 1260 | background-image: url(./widgets.png); 1261 | background-repeat: no-repeat; 1262 | text-indent: -1024px; 1263 | vertical-align: bottom; 1264 | filter: var(--icon-filter); 1265 | } 1266 | @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { 1267 | .tsd-select .tsd-select-list li:before, 1268 | .tsd-select .tsd-select-label:before, 1269 | .tsd-widget:before { 1270 | background-image: url(./widgets@2x.png); 1271 | background-size: 320px 40px; 1272 | } 1273 | } 1274 | 1275 | .tsd-widget { 1276 | display: inline-block; 1277 | overflow: hidden; 1278 | opacity: 0.8; 1279 | height: 40px; 1280 | transition: opacity 0.1s, background-color 0.2s; 1281 | vertical-align: bottom; 1282 | cursor: pointer; 1283 | } 1284 | .tsd-widget:hover { 1285 | opacity: 0.9; 1286 | } 1287 | .tsd-widget.active { 1288 | opacity: 1; 1289 | background-color: var(--color-panel-divider); 1290 | } 1291 | .tsd-widget.no-caption { 1292 | width: 40px; 1293 | } 1294 | .tsd-widget.no-caption:before { 1295 | margin: 0; 1296 | } 1297 | .tsd-widget.search:before { 1298 | background-position: 0 0; 1299 | } 1300 | .tsd-widget.menu:before { 1301 | background-position: -40px 0; 1302 | } 1303 | .tsd-widget.options:before { 1304 | background-position: -80px 0; 1305 | } 1306 | .tsd-widget.options, 1307 | .tsd-widget.menu { 1308 | display: none; 1309 | } 1310 | @media (max-width: 900px) { 1311 | .tsd-widget.options, 1312 | .tsd-widget.menu { 1313 | display: inline-block; 1314 | } 1315 | } 1316 | input[type="checkbox"] + .tsd-widget:before { 1317 | background-position: -120px 0; 1318 | } 1319 | input[type="checkbox"]:checked + .tsd-widget:before { 1320 | background-position: -160px 0; 1321 | } 1322 | 1323 | .tsd-select { 1324 | position: relative; 1325 | display: inline-block; 1326 | height: 40px; 1327 | transition: opacity 0.1s, background-color 0.2s; 1328 | vertical-align: bottom; 1329 | cursor: pointer; 1330 | } 1331 | .tsd-select .tsd-select-label { 1332 | opacity: 0.6; 1333 | transition: opacity 0.2s; 1334 | } 1335 | .tsd-select .tsd-select-label:before { 1336 | background-position: -240px 0; 1337 | } 1338 | .tsd-select.active .tsd-select-label { 1339 | opacity: 0.8; 1340 | } 1341 | .tsd-select.active .tsd-select-list { 1342 | visibility: visible; 1343 | opacity: 1; 1344 | transition-delay: 0s; 1345 | } 1346 | .tsd-select .tsd-select-list { 1347 | position: absolute; 1348 | visibility: hidden; 1349 | top: 40px; 1350 | left: 0; 1351 | margin: 0; 1352 | padding: 0; 1353 | opacity: 0; 1354 | list-style: none; 1355 | box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); 1356 | transition: visibility 0s 0.2s, opacity 0.2s; 1357 | } 1358 | .tsd-select .tsd-select-list li { 1359 | padding: 0 20px 0 0; 1360 | background-color: var(--color-background); 1361 | } 1362 | .tsd-select .tsd-select-list li:before { 1363 | background-position: 40px 0; 1364 | } 1365 | .tsd-select .tsd-select-list li:nth-child(even) { 1366 | background-color: var(--color-panel); 1367 | } 1368 | .tsd-select .tsd-select-list li:hover { 1369 | background-color: var(--color-panel-divider); 1370 | } 1371 | .tsd-select .tsd-select-list li.selected:before { 1372 | background-position: -200px 0; 1373 | } 1374 | @media (max-width: 900px) { 1375 | .tsd-select .tsd-select-list { 1376 | top: 0; 1377 | left: auto; 1378 | right: 100%; 1379 | margin-right: -5px; 1380 | } 1381 | .tsd-select .tsd-select-label:before { 1382 | background-position: -280px 0; 1383 | } 1384 | } 1385 | 1386 | img { 1387 | max-width: 100%; 1388 | } 1389 | -------------------------------------------------------------------------------- /docs/assets/icons.css: -------------------------------------------------------------------------------- 1 | .tsd-kind-icon { 2 | display: block; 3 | position: relative; 4 | padding-left: 20px; 5 | text-indent: -20px; 6 | } 7 | .tsd-kind-icon:before { 8 | content: ""; 9 | display: inline-block; 10 | vertical-align: middle; 11 | width: 17px; 12 | height: 17px; 13 | margin: 0 3px 2px 0; 14 | background-image: url(./icons.png); 15 | } 16 | @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { 17 | .tsd-kind-icon:before { 18 | background-image: url(./icons@2x.png); 19 | background-size: 238px 204px; 20 | } 21 | } 22 | 23 | .tsd-signature.tsd-kind-icon:before { 24 | background-position: 0 -153px; 25 | } 26 | 27 | .tsd-kind-object-literal > .tsd-kind-icon:before { 28 | background-position: 0px -17px; 29 | } 30 | .tsd-kind-object-literal.tsd-is-protected > .tsd-kind-icon:before { 31 | background-position: -17px -17px; 32 | } 33 | .tsd-kind-object-literal.tsd-is-private > .tsd-kind-icon:before { 34 | background-position: -34px -17px; 35 | } 36 | 37 | .tsd-kind-class > .tsd-kind-icon:before { 38 | background-position: 0px -34px; 39 | } 40 | .tsd-kind-class.tsd-is-protected > .tsd-kind-icon:before { 41 | background-position: -17px -34px; 42 | } 43 | .tsd-kind-class.tsd-is-private > .tsd-kind-icon:before { 44 | background-position: -34px -34px; 45 | } 46 | 47 | .tsd-kind-class.tsd-has-type-parameter > .tsd-kind-icon:before { 48 | background-position: 0px -51px; 49 | } 50 | .tsd-kind-class.tsd-has-type-parameter.tsd-is-protected 51 | > .tsd-kind-icon:before { 52 | background-position: -17px -51px; 53 | } 54 | .tsd-kind-class.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { 55 | background-position: -34px -51px; 56 | } 57 | 58 | .tsd-kind-interface > .tsd-kind-icon:before { 59 | background-position: 0px -68px; 60 | } 61 | .tsd-kind-interface.tsd-is-protected > .tsd-kind-icon:before { 62 | background-position: -17px -68px; 63 | } 64 | .tsd-kind-interface.tsd-is-private > .tsd-kind-icon:before { 65 | background-position: -34px -68px; 66 | } 67 | 68 | .tsd-kind-interface.tsd-has-type-parameter > .tsd-kind-icon:before { 69 | background-position: 0px -85px; 70 | } 71 | .tsd-kind-interface.tsd-has-type-parameter.tsd-is-protected 72 | > .tsd-kind-icon:before { 73 | background-position: -17px -85px; 74 | } 75 | .tsd-kind-interface.tsd-has-type-parameter.tsd-is-private 76 | > .tsd-kind-icon:before { 77 | background-position: -34px -85px; 78 | } 79 | 80 | .tsd-kind-namespace > .tsd-kind-icon:before { 81 | background-position: 0px -102px; 82 | } 83 | .tsd-kind-namespace.tsd-is-protected > .tsd-kind-icon:before { 84 | background-position: -17px -102px; 85 | } 86 | .tsd-kind-namespace.tsd-is-private > .tsd-kind-icon:before { 87 | background-position: -34px -102px; 88 | } 89 | 90 | .tsd-kind-module > .tsd-kind-icon:before { 91 | background-position: 0px -102px; 92 | } 93 | .tsd-kind-module.tsd-is-protected > .tsd-kind-icon:before { 94 | background-position: -17px -102px; 95 | } 96 | .tsd-kind-module.tsd-is-private > .tsd-kind-icon:before { 97 | background-position: -34px -102px; 98 | } 99 | 100 | .tsd-kind-enum > .tsd-kind-icon:before { 101 | background-position: 0px -119px; 102 | } 103 | .tsd-kind-enum.tsd-is-protected > .tsd-kind-icon:before { 104 | background-position: -17px -119px; 105 | } 106 | .tsd-kind-enum.tsd-is-private > .tsd-kind-icon:before { 107 | background-position: -34px -119px; 108 | } 109 | 110 | .tsd-kind-enum-member > .tsd-kind-icon:before { 111 | background-position: 0px -136px; 112 | } 113 | .tsd-kind-enum-member.tsd-is-protected > .tsd-kind-icon:before { 114 | background-position: -17px -136px; 115 | } 116 | .tsd-kind-enum-member.tsd-is-private > .tsd-kind-icon:before { 117 | background-position: -34px -136px; 118 | } 119 | 120 | .tsd-kind-signature > .tsd-kind-icon:before { 121 | background-position: 0px -153px; 122 | } 123 | .tsd-kind-signature.tsd-is-protected > .tsd-kind-icon:before { 124 | background-position: -17px -153px; 125 | } 126 | .tsd-kind-signature.tsd-is-private > .tsd-kind-icon:before { 127 | background-position: -34px -153px; 128 | } 129 | 130 | .tsd-kind-type-alias > .tsd-kind-icon:before { 131 | background-position: 0px -170px; 132 | } 133 | .tsd-kind-type-alias.tsd-is-protected > .tsd-kind-icon:before { 134 | background-position: -17px -170px; 135 | } 136 | .tsd-kind-type-alias.tsd-is-private > .tsd-kind-icon:before { 137 | background-position: -34px -170px; 138 | } 139 | 140 | .tsd-kind-type-alias.tsd-has-type-parameter > .tsd-kind-icon:before { 141 | background-position: 0px -187px; 142 | } 143 | .tsd-kind-type-alias.tsd-has-type-parameter.tsd-is-protected 144 | > .tsd-kind-icon:before { 145 | background-position: -17px -187px; 146 | } 147 | .tsd-kind-type-alias.tsd-has-type-parameter.tsd-is-private 148 | > .tsd-kind-icon:before { 149 | background-position: -34px -187px; 150 | } 151 | 152 | .tsd-kind-variable > .tsd-kind-icon:before { 153 | background-position: -136px -0px; 154 | } 155 | .tsd-kind-variable.tsd-is-protected > .tsd-kind-icon:before { 156 | background-position: -153px -0px; 157 | } 158 | .tsd-kind-variable.tsd-is-private > .tsd-kind-icon:before { 159 | background-position: -119px -0px; 160 | } 161 | .tsd-kind-variable.tsd-parent-kind-class > .tsd-kind-icon:before { 162 | background-position: -51px -0px; 163 | } 164 | .tsd-kind-variable.tsd-parent-kind-class.tsd-is-inherited 165 | > .tsd-kind-icon:before { 166 | background-position: -68px -0px; 167 | } 168 | .tsd-kind-variable.tsd-parent-kind-class.tsd-is-protected 169 | > .tsd-kind-icon:before { 170 | background-position: -85px -0px; 171 | } 172 | .tsd-kind-variable.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 173 | > .tsd-kind-icon:before { 174 | background-position: -102px -0px; 175 | } 176 | .tsd-kind-variable.tsd-parent-kind-class.tsd-is-private 177 | > .tsd-kind-icon:before { 178 | background-position: -119px -0px; 179 | } 180 | .tsd-kind-variable.tsd-parent-kind-enum > .tsd-kind-icon:before { 181 | background-position: -170px -0px; 182 | } 183 | .tsd-kind-variable.tsd-parent-kind-enum.tsd-is-protected 184 | > .tsd-kind-icon:before { 185 | background-position: -187px -0px; 186 | } 187 | .tsd-kind-variable.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 188 | background-position: -119px -0px; 189 | } 190 | .tsd-kind-variable.tsd-parent-kind-interface > .tsd-kind-icon:before { 191 | background-position: -204px -0px; 192 | } 193 | .tsd-kind-variable.tsd-parent-kind-interface.tsd-is-inherited 194 | > .tsd-kind-icon:before { 195 | background-position: -221px -0px; 196 | } 197 | 198 | .tsd-kind-property > .tsd-kind-icon:before { 199 | background-position: -136px -0px; 200 | } 201 | .tsd-kind-property.tsd-is-protected > .tsd-kind-icon:before { 202 | background-position: -153px -0px; 203 | } 204 | .tsd-kind-property.tsd-is-private > .tsd-kind-icon:before { 205 | background-position: -119px -0px; 206 | } 207 | .tsd-kind-property.tsd-parent-kind-class > .tsd-kind-icon:before { 208 | background-position: -51px -0px; 209 | } 210 | .tsd-kind-property.tsd-parent-kind-class.tsd-is-inherited 211 | > .tsd-kind-icon:before { 212 | background-position: -68px -0px; 213 | } 214 | .tsd-kind-property.tsd-parent-kind-class.tsd-is-protected 215 | > .tsd-kind-icon:before { 216 | background-position: -85px -0px; 217 | } 218 | .tsd-kind-property.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 219 | > .tsd-kind-icon:before { 220 | background-position: -102px -0px; 221 | } 222 | .tsd-kind-property.tsd-parent-kind-class.tsd-is-private 223 | > .tsd-kind-icon:before { 224 | background-position: -119px -0px; 225 | } 226 | .tsd-kind-property.tsd-parent-kind-enum > .tsd-kind-icon:before { 227 | background-position: -170px -0px; 228 | } 229 | .tsd-kind-property.tsd-parent-kind-enum.tsd-is-protected 230 | > .tsd-kind-icon:before { 231 | background-position: -187px -0px; 232 | } 233 | .tsd-kind-property.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 234 | background-position: -119px -0px; 235 | } 236 | .tsd-kind-property.tsd-parent-kind-interface > .tsd-kind-icon:before { 237 | background-position: -204px -0px; 238 | } 239 | .tsd-kind-property.tsd-parent-kind-interface.tsd-is-inherited 240 | > .tsd-kind-icon:before { 241 | background-position: -221px -0px; 242 | } 243 | 244 | .tsd-kind-get-signature > .tsd-kind-icon:before { 245 | background-position: -136px -17px; 246 | } 247 | .tsd-kind-get-signature.tsd-is-protected > .tsd-kind-icon:before { 248 | background-position: -153px -17px; 249 | } 250 | .tsd-kind-get-signature.tsd-is-private > .tsd-kind-icon:before { 251 | background-position: -119px -17px; 252 | } 253 | .tsd-kind-get-signature.tsd-parent-kind-class > .tsd-kind-icon:before { 254 | background-position: -51px -17px; 255 | } 256 | .tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-inherited 257 | > .tsd-kind-icon:before { 258 | background-position: -68px -17px; 259 | } 260 | .tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-protected 261 | > .tsd-kind-icon:before { 262 | background-position: -85px -17px; 263 | } 264 | .tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 265 | > .tsd-kind-icon:before { 266 | background-position: -102px -17px; 267 | } 268 | .tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-private 269 | > .tsd-kind-icon:before { 270 | background-position: -119px -17px; 271 | } 272 | .tsd-kind-get-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { 273 | background-position: -170px -17px; 274 | } 275 | .tsd-kind-get-signature.tsd-parent-kind-enum.tsd-is-protected 276 | > .tsd-kind-icon:before { 277 | background-position: -187px -17px; 278 | } 279 | .tsd-kind-get-signature.tsd-parent-kind-enum.tsd-is-private 280 | > .tsd-kind-icon:before { 281 | background-position: -119px -17px; 282 | } 283 | .tsd-kind-get-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { 284 | background-position: -204px -17px; 285 | } 286 | .tsd-kind-get-signature.tsd-parent-kind-interface.tsd-is-inherited 287 | > .tsd-kind-icon:before { 288 | background-position: -221px -17px; 289 | } 290 | 291 | .tsd-kind-set-signature > .tsd-kind-icon:before { 292 | background-position: -136px -34px; 293 | } 294 | .tsd-kind-set-signature.tsd-is-protected > .tsd-kind-icon:before { 295 | background-position: -153px -34px; 296 | } 297 | .tsd-kind-set-signature.tsd-is-private > .tsd-kind-icon:before { 298 | background-position: -119px -34px; 299 | } 300 | .tsd-kind-set-signature.tsd-parent-kind-class > .tsd-kind-icon:before { 301 | background-position: -51px -34px; 302 | } 303 | .tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-inherited 304 | > .tsd-kind-icon:before { 305 | background-position: -68px -34px; 306 | } 307 | .tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-protected 308 | > .tsd-kind-icon:before { 309 | background-position: -85px -34px; 310 | } 311 | .tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 312 | > .tsd-kind-icon:before { 313 | background-position: -102px -34px; 314 | } 315 | .tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-private 316 | > .tsd-kind-icon:before { 317 | background-position: -119px -34px; 318 | } 319 | .tsd-kind-set-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { 320 | background-position: -170px -34px; 321 | } 322 | .tsd-kind-set-signature.tsd-parent-kind-enum.tsd-is-protected 323 | > .tsd-kind-icon:before { 324 | background-position: -187px -34px; 325 | } 326 | .tsd-kind-set-signature.tsd-parent-kind-enum.tsd-is-private 327 | > .tsd-kind-icon:before { 328 | background-position: -119px -34px; 329 | } 330 | .tsd-kind-set-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { 331 | background-position: -204px -34px; 332 | } 333 | .tsd-kind-set-signature.tsd-parent-kind-interface.tsd-is-inherited 334 | > .tsd-kind-icon:before { 335 | background-position: -221px -34px; 336 | } 337 | 338 | .tsd-kind-accessor > .tsd-kind-icon:before { 339 | background-position: -136px -51px; 340 | } 341 | .tsd-kind-accessor.tsd-is-protected > .tsd-kind-icon:before { 342 | background-position: -153px -51px; 343 | } 344 | .tsd-kind-accessor.tsd-is-private > .tsd-kind-icon:before { 345 | background-position: -119px -51px; 346 | } 347 | .tsd-kind-accessor.tsd-parent-kind-class > .tsd-kind-icon:before { 348 | background-position: -51px -51px; 349 | } 350 | .tsd-kind-accessor.tsd-parent-kind-class.tsd-is-inherited 351 | > .tsd-kind-icon:before { 352 | background-position: -68px -51px; 353 | } 354 | .tsd-kind-accessor.tsd-parent-kind-class.tsd-is-protected 355 | > .tsd-kind-icon:before { 356 | background-position: -85px -51px; 357 | } 358 | .tsd-kind-accessor.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 359 | > .tsd-kind-icon:before { 360 | background-position: -102px -51px; 361 | } 362 | .tsd-kind-accessor.tsd-parent-kind-class.tsd-is-private 363 | > .tsd-kind-icon:before { 364 | background-position: -119px -51px; 365 | } 366 | .tsd-kind-accessor.tsd-parent-kind-enum > .tsd-kind-icon:before { 367 | background-position: -170px -51px; 368 | } 369 | .tsd-kind-accessor.tsd-parent-kind-enum.tsd-is-protected 370 | > .tsd-kind-icon:before { 371 | background-position: -187px -51px; 372 | } 373 | .tsd-kind-accessor.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 374 | background-position: -119px -51px; 375 | } 376 | .tsd-kind-accessor.tsd-parent-kind-interface > .tsd-kind-icon:before { 377 | background-position: -204px -51px; 378 | } 379 | .tsd-kind-accessor.tsd-parent-kind-interface.tsd-is-inherited 380 | > .tsd-kind-icon:before { 381 | background-position: -221px -51px; 382 | } 383 | 384 | .tsd-kind-function > .tsd-kind-icon:before { 385 | background-position: -136px -68px; 386 | } 387 | .tsd-kind-function.tsd-is-protected > .tsd-kind-icon:before { 388 | background-position: -153px -68px; 389 | } 390 | .tsd-kind-function.tsd-is-private > .tsd-kind-icon:before { 391 | background-position: -119px -68px; 392 | } 393 | .tsd-kind-function.tsd-parent-kind-class > .tsd-kind-icon:before { 394 | background-position: -51px -68px; 395 | } 396 | .tsd-kind-function.tsd-parent-kind-class.tsd-is-inherited 397 | > .tsd-kind-icon:before { 398 | background-position: -68px -68px; 399 | } 400 | .tsd-kind-function.tsd-parent-kind-class.tsd-is-protected 401 | > .tsd-kind-icon:before { 402 | background-position: -85px -68px; 403 | } 404 | .tsd-kind-function.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 405 | > .tsd-kind-icon:before { 406 | background-position: -102px -68px; 407 | } 408 | .tsd-kind-function.tsd-parent-kind-class.tsd-is-private 409 | > .tsd-kind-icon:before { 410 | background-position: -119px -68px; 411 | } 412 | .tsd-kind-function.tsd-parent-kind-enum > .tsd-kind-icon:before { 413 | background-position: -170px -68px; 414 | } 415 | .tsd-kind-function.tsd-parent-kind-enum.tsd-is-protected 416 | > .tsd-kind-icon:before { 417 | background-position: -187px -68px; 418 | } 419 | .tsd-kind-function.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 420 | background-position: -119px -68px; 421 | } 422 | .tsd-kind-function.tsd-parent-kind-interface > .tsd-kind-icon:before { 423 | background-position: -204px -68px; 424 | } 425 | .tsd-kind-function.tsd-parent-kind-interface.tsd-is-inherited 426 | > .tsd-kind-icon:before { 427 | background-position: -221px -68px; 428 | } 429 | 430 | .tsd-kind-method > .tsd-kind-icon:before { 431 | background-position: -136px -68px; 432 | } 433 | .tsd-kind-method.tsd-is-protected > .tsd-kind-icon:before { 434 | background-position: -153px -68px; 435 | } 436 | .tsd-kind-method.tsd-is-private > .tsd-kind-icon:before { 437 | background-position: -119px -68px; 438 | } 439 | .tsd-kind-method.tsd-parent-kind-class > .tsd-kind-icon:before { 440 | background-position: -51px -68px; 441 | } 442 | .tsd-kind-method.tsd-parent-kind-class.tsd-is-inherited 443 | > .tsd-kind-icon:before { 444 | background-position: -68px -68px; 445 | } 446 | .tsd-kind-method.tsd-parent-kind-class.tsd-is-protected 447 | > .tsd-kind-icon:before { 448 | background-position: -85px -68px; 449 | } 450 | .tsd-kind-method.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 451 | > .tsd-kind-icon:before { 452 | background-position: -102px -68px; 453 | } 454 | .tsd-kind-method.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { 455 | background-position: -119px -68px; 456 | } 457 | .tsd-kind-method.tsd-parent-kind-enum > .tsd-kind-icon:before { 458 | background-position: -170px -68px; 459 | } 460 | .tsd-kind-method.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { 461 | background-position: -187px -68px; 462 | } 463 | .tsd-kind-method.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 464 | background-position: -119px -68px; 465 | } 466 | .tsd-kind-method.tsd-parent-kind-interface > .tsd-kind-icon:before { 467 | background-position: -204px -68px; 468 | } 469 | .tsd-kind-method.tsd-parent-kind-interface.tsd-is-inherited 470 | > .tsd-kind-icon:before { 471 | background-position: -221px -68px; 472 | } 473 | 474 | .tsd-kind-call-signature > .tsd-kind-icon:before { 475 | background-position: -136px -68px; 476 | } 477 | .tsd-kind-call-signature.tsd-is-protected > .tsd-kind-icon:before { 478 | background-position: -153px -68px; 479 | } 480 | .tsd-kind-call-signature.tsd-is-private > .tsd-kind-icon:before { 481 | background-position: -119px -68px; 482 | } 483 | .tsd-kind-call-signature.tsd-parent-kind-class > .tsd-kind-icon:before { 484 | background-position: -51px -68px; 485 | } 486 | .tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-inherited 487 | > .tsd-kind-icon:before { 488 | background-position: -68px -68px; 489 | } 490 | .tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected 491 | > .tsd-kind-icon:before { 492 | background-position: -85px -68px; 493 | } 494 | .tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 495 | > .tsd-kind-icon:before { 496 | background-position: -102px -68px; 497 | } 498 | .tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-private 499 | > .tsd-kind-icon:before { 500 | background-position: -119px -68px; 501 | } 502 | .tsd-kind-call-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { 503 | background-position: -170px -68px; 504 | } 505 | .tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-protected 506 | > .tsd-kind-icon:before { 507 | background-position: -187px -68px; 508 | } 509 | .tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-private 510 | > .tsd-kind-icon:before { 511 | background-position: -119px -68px; 512 | } 513 | .tsd-kind-call-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { 514 | background-position: -204px -68px; 515 | } 516 | .tsd-kind-call-signature.tsd-parent-kind-interface.tsd-is-inherited 517 | > .tsd-kind-icon:before { 518 | background-position: -221px -68px; 519 | } 520 | 521 | .tsd-kind-function.tsd-has-type-parameter > .tsd-kind-icon:before { 522 | background-position: -136px -85px; 523 | } 524 | .tsd-kind-function.tsd-has-type-parameter.tsd-is-protected 525 | > .tsd-kind-icon:before { 526 | background-position: -153px -85px; 527 | } 528 | .tsd-kind-function.tsd-has-type-parameter.tsd-is-private 529 | > .tsd-kind-icon:before { 530 | background-position: -119px -85px; 531 | } 532 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class 533 | > .tsd-kind-icon:before { 534 | background-position: -51px -85px; 535 | } 536 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-inherited 537 | > .tsd-kind-icon:before { 538 | background-position: -68px -85px; 539 | } 540 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected 541 | > .tsd-kind-icon:before { 542 | background-position: -85px -85px; 543 | } 544 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 545 | > .tsd-kind-icon:before { 546 | background-position: -102px -85px; 547 | } 548 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-private 549 | > .tsd-kind-icon:before { 550 | background-position: -119px -85px; 551 | } 552 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum 553 | > .tsd-kind-icon:before { 554 | background-position: -170px -85px; 555 | } 556 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-protected 557 | > .tsd-kind-icon:before { 558 | background-position: -187px -85px; 559 | } 560 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-private 561 | > .tsd-kind-icon:before { 562 | background-position: -119px -85px; 563 | } 564 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-interface 565 | > .tsd-kind-icon:before { 566 | background-position: -204px -85px; 567 | } 568 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-interface.tsd-is-inherited 569 | > .tsd-kind-icon:before { 570 | background-position: -221px -85px; 571 | } 572 | 573 | .tsd-kind-method.tsd-has-type-parameter > .tsd-kind-icon:before { 574 | background-position: -136px -85px; 575 | } 576 | .tsd-kind-method.tsd-has-type-parameter.tsd-is-protected 577 | > .tsd-kind-icon:before { 578 | background-position: -153px -85px; 579 | } 580 | .tsd-kind-method.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { 581 | background-position: -119px -85px; 582 | } 583 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class 584 | > .tsd-kind-icon:before { 585 | background-position: -51px -85px; 586 | } 587 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-inherited 588 | > .tsd-kind-icon:before { 589 | background-position: -68px -85px; 590 | } 591 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected 592 | > .tsd-kind-icon:before { 593 | background-position: -85px -85px; 594 | } 595 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 596 | > .tsd-kind-icon:before { 597 | background-position: -102px -85px; 598 | } 599 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-private 600 | > .tsd-kind-icon:before { 601 | background-position: -119px -85px; 602 | } 603 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum 604 | > .tsd-kind-icon:before { 605 | background-position: -170px -85px; 606 | } 607 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-protected 608 | > .tsd-kind-icon:before { 609 | background-position: -187px -85px; 610 | } 611 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-private 612 | > .tsd-kind-icon:before { 613 | background-position: -119px -85px; 614 | } 615 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-interface 616 | > .tsd-kind-icon:before { 617 | background-position: -204px -85px; 618 | } 619 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-interface.tsd-is-inherited 620 | > .tsd-kind-icon:before { 621 | background-position: -221px -85px; 622 | } 623 | 624 | .tsd-kind-constructor > .tsd-kind-icon:before { 625 | background-position: -136px -102px; 626 | } 627 | .tsd-kind-constructor.tsd-is-protected > .tsd-kind-icon:before { 628 | background-position: -153px -102px; 629 | } 630 | .tsd-kind-constructor.tsd-is-private > .tsd-kind-icon:before { 631 | background-position: -119px -102px; 632 | } 633 | .tsd-kind-constructor.tsd-parent-kind-class > .tsd-kind-icon:before { 634 | background-position: -51px -102px; 635 | } 636 | .tsd-kind-constructor.tsd-parent-kind-class.tsd-is-inherited 637 | > .tsd-kind-icon:before { 638 | background-position: -68px -102px; 639 | } 640 | .tsd-kind-constructor.tsd-parent-kind-class.tsd-is-protected 641 | > .tsd-kind-icon:before { 642 | background-position: -85px -102px; 643 | } 644 | .tsd-kind-constructor.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 645 | > .tsd-kind-icon:before { 646 | background-position: -102px -102px; 647 | } 648 | .tsd-kind-constructor.tsd-parent-kind-class.tsd-is-private 649 | > .tsd-kind-icon:before { 650 | background-position: -119px -102px; 651 | } 652 | .tsd-kind-constructor.tsd-parent-kind-enum > .tsd-kind-icon:before { 653 | background-position: -170px -102px; 654 | } 655 | .tsd-kind-constructor.tsd-parent-kind-enum.tsd-is-protected 656 | > .tsd-kind-icon:before { 657 | background-position: -187px -102px; 658 | } 659 | .tsd-kind-constructor.tsd-parent-kind-enum.tsd-is-private 660 | > .tsd-kind-icon:before { 661 | background-position: -119px -102px; 662 | } 663 | .tsd-kind-constructor.tsd-parent-kind-interface > .tsd-kind-icon:before { 664 | background-position: -204px -102px; 665 | } 666 | .tsd-kind-constructor.tsd-parent-kind-interface.tsd-is-inherited 667 | > .tsd-kind-icon:before { 668 | background-position: -221px -102px; 669 | } 670 | 671 | .tsd-kind-constructor-signature > .tsd-kind-icon:before { 672 | background-position: -136px -102px; 673 | } 674 | .tsd-kind-constructor-signature.tsd-is-protected > .tsd-kind-icon:before { 675 | background-position: -153px -102px; 676 | } 677 | .tsd-kind-constructor-signature.tsd-is-private > .tsd-kind-icon:before { 678 | background-position: -119px -102px; 679 | } 680 | .tsd-kind-constructor-signature.tsd-parent-kind-class > .tsd-kind-icon:before { 681 | background-position: -51px -102px; 682 | } 683 | .tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-inherited 684 | > .tsd-kind-icon:before { 685 | background-position: -68px -102px; 686 | } 687 | .tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-protected 688 | > .tsd-kind-icon:before { 689 | background-position: -85px -102px; 690 | } 691 | .tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 692 | > .tsd-kind-icon:before { 693 | background-position: -102px -102px; 694 | } 695 | .tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-private 696 | > .tsd-kind-icon:before { 697 | background-position: -119px -102px; 698 | } 699 | .tsd-kind-constructor-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { 700 | background-position: -170px -102px; 701 | } 702 | .tsd-kind-constructor-signature.tsd-parent-kind-enum.tsd-is-protected 703 | > .tsd-kind-icon:before { 704 | background-position: -187px -102px; 705 | } 706 | .tsd-kind-constructor-signature.tsd-parent-kind-enum.tsd-is-private 707 | > .tsd-kind-icon:before { 708 | background-position: -119px -102px; 709 | } 710 | .tsd-kind-constructor-signature.tsd-parent-kind-interface 711 | > .tsd-kind-icon:before { 712 | background-position: -204px -102px; 713 | } 714 | .tsd-kind-constructor-signature.tsd-parent-kind-interface.tsd-is-inherited 715 | > .tsd-kind-icon:before { 716 | background-position: -221px -102px; 717 | } 718 | 719 | .tsd-kind-index-signature > .tsd-kind-icon:before { 720 | background-position: -136px -119px; 721 | } 722 | .tsd-kind-index-signature.tsd-is-protected > .tsd-kind-icon:before { 723 | background-position: -153px -119px; 724 | } 725 | .tsd-kind-index-signature.tsd-is-private > .tsd-kind-icon:before { 726 | background-position: -119px -119px; 727 | } 728 | .tsd-kind-index-signature.tsd-parent-kind-class > .tsd-kind-icon:before { 729 | background-position: -51px -119px; 730 | } 731 | .tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-inherited 732 | > .tsd-kind-icon:before { 733 | background-position: -68px -119px; 734 | } 735 | .tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-protected 736 | > .tsd-kind-icon:before { 737 | background-position: -85px -119px; 738 | } 739 | .tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 740 | > .tsd-kind-icon:before { 741 | background-position: -102px -119px; 742 | } 743 | .tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-private 744 | > .tsd-kind-icon:before { 745 | background-position: -119px -119px; 746 | } 747 | .tsd-kind-index-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { 748 | background-position: -170px -119px; 749 | } 750 | .tsd-kind-index-signature.tsd-parent-kind-enum.tsd-is-protected 751 | > .tsd-kind-icon:before { 752 | background-position: -187px -119px; 753 | } 754 | .tsd-kind-index-signature.tsd-parent-kind-enum.tsd-is-private 755 | > .tsd-kind-icon:before { 756 | background-position: -119px -119px; 757 | } 758 | .tsd-kind-index-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { 759 | background-position: -204px -119px; 760 | } 761 | .tsd-kind-index-signature.tsd-parent-kind-interface.tsd-is-inherited 762 | > .tsd-kind-icon:before { 763 | background-position: -221px -119px; 764 | } 765 | 766 | .tsd-kind-event > .tsd-kind-icon:before { 767 | background-position: -136px -136px; 768 | } 769 | .tsd-kind-event.tsd-is-protected > .tsd-kind-icon:before { 770 | background-position: -153px -136px; 771 | } 772 | .tsd-kind-event.tsd-is-private > .tsd-kind-icon:before { 773 | background-position: -119px -136px; 774 | } 775 | .tsd-kind-event.tsd-parent-kind-class > .tsd-kind-icon:before { 776 | background-position: -51px -136px; 777 | } 778 | .tsd-kind-event.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { 779 | background-position: -68px -136px; 780 | } 781 | .tsd-kind-event.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { 782 | background-position: -85px -136px; 783 | } 784 | .tsd-kind-event.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 785 | > .tsd-kind-icon:before { 786 | background-position: -102px -136px; 787 | } 788 | .tsd-kind-event.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { 789 | background-position: -119px -136px; 790 | } 791 | .tsd-kind-event.tsd-parent-kind-enum > .tsd-kind-icon:before { 792 | background-position: -170px -136px; 793 | } 794 | .tsd-kind-event.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { 795 | background-position: -187px -136px; 796 | } 797 | .tsd-kind-event.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 798 | background-position: -119px -136px; 799 | } 800 | .tsd-kind-event.tsd-parent-kind-interface > .tsd-kind-icon:before { 801 | background-position: -204px -136px; 802 | } 803 | .tsd-kind-event.tsd-parent-kind-interface.tsd-is-inherited 804 | > .tsd-kind-icon:before { 805 | background-position: -221px -136px; 806 | } 807 | 808 | .tsd-is-static > .tsd-kind-icon:before { 809 | background-position: -136px -153px; 810 | } 811 | .tsd-is-static.tsd-is-protected > .tsd-kind-icon:before { 812 | background-position: -153px -153px; 813 | } 814 | .tsd-is-static.tsd-is-private > .tsd-kind-icon:before { 815 | background-position: -119px -153px; 816 | } 817 | .tsd-is-static.tsd-parent-kind-class > .tsd-kind-icon:before { 818 | background-position: -51px -153px; 819 | } 820 | .tsd-is-static.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { 821 | background-position: -68px -153px; 822 | } 823 | .tsd-is-static.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { 824 | background-position: -85px -153px; 825 | } 826 | .tsd-is-static.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 827 | > .tsd-kind-icon:before { 828 | background-position: -102px -153px; 829 | } 830 | .tsd-is-static.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { 831 | background-position: -119px -153px; 832 | } 833 | .tsd-is-static.tsd-parent-kind-enum > .tsd-kind-icon:before { 834 | background-position: -170px -153px; 835 | } 836 | .tsd-is-static.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { 837 | background-position: -187px -153px; 838 | } 839 | .tsd-is-static.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 840 | background-position: -119px -153px; 841 | } 842 | .tsd-is-static.tsd-parent-kind-interface > .tsd-kind-icon:before { 843 | background-position: -204px -153px; 844 | } 845 | .tsd-is-static.tsd-parent-kind-interface.tsd-is-inherited 846 | > .tsd-kind-icon:before { 847 | background-position: -221px -153px; 848 | } 849 | 850 | .tsd-is-static.tsd-kind-function > .tsd-kind-icon:before { 851 | background-position: -136px -170px; 852 | } 853 | .tsd-is-static.tsd-kind-function.tsd-is-protected > .tsd-kind-icon:before { 854 | background-position: -153px -170px; 855 | } 856 | .tsd-is-static.tsd-kind-function.tsd-is-private > .tsd-kind-icon:before { 857 | background-position: -119px -170px; 858 | } 859 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-class > .tsd-kind-icon:before { 860 | background-position: -51px -170px; 861 | } 862 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-inherited 863 | > .tsd-kind-icon:before { 864 | background-position: -68px -170px; 865 | } 866 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected 867 | > .tsd-kind-icon:before { 868 | background-position: -85px -170px; 869 | } 870 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 871 | > .tsd-kind-icon:before { 872 | background-position: -102px -170px; 873 | } 874 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-private 875 | > .tsd-kind-icon:before { 876 | background-position: -119px -170px; 877 | } 878 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-enum > .tsd-kind-icon:before { 879 | background-position: -170px -170px; 880 | } 881 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-enum.tsd-is-protected 882 | > .tsd-kind-icon:before { 883 | background-position: -187px -170px; 884 | } 885 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-enum.tsd-is-private 886 | > .tsd-kind-icon:before { 887 | background-position: -119px -170px; 888 | } 889 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-interface 890 | > .tsd-kind-icon:before { 891 | background-position: -204px -170px; 892 | } 893 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-interface.tsd-is-inherited 894 | > .tsd-kind-icon:before { 895 | background-position: -221px -170px; 896 | } 897 | 898 | .tsd-is-static.tsd-kind-method > .tsd-kind-icon:before { 899 | background-position: -136px -170px; 900 | } 901 | .tsd-is-static.tsd-kind-method.tsd-is-protected > .tsd-kind-icon:before { 902 | background-position: -153px -170px; 903 | } 904 | .tsd-is-static.tsd-kind-method.tsd-is-private > .tsd-kind-icon:before { 905 | background-position: -119px -170px; 906 | } 907 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-class > .tsd-kind-icon:before { 908 | background-position: -51px -170px; 909 | } 910 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-inherited 911 | > .tsd-kind-icon:before { 912 | background-position: -68px -170px; 913 | } 914 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected 915 | > .tsd-kind-icon:before { 916 | background-position: -85px -170px; 917 | } 918 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 919 | > .tsd-kind-icon:before { 920 | background-position: -102px -170px; 921 | } 922 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-private 923 | > .tsd-kind-icon:before { 924 | background-position: -119px -170px; 925 | } 926 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-enum > .tsd-kind-icon:before { 927 | background-position: -170px -170px; 928 | } 929 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-enum.tsd-is-protected 930 | > .tsd-kind-icon:before { 931 | background-position: -187px -170px; 932 | } 933 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-enum.tsd-is-private 934 | > .tsd-kind-icon:before { 935 | background-position: -119px -170px; 936 | } 937 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-interface 938 | > .tsd-kind-icon:before { 939 | background-position: -204px -170px; 940 | } 941 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-interface.tsd-is-inherited 942 | > .tsd-kind-icon:before { 943 | background-position: -221px -170px; 944 | } 945 | 946 | .tsd-is-static.tsd-kind-call-signature > .tsd-kind-icon:before { 947 | background-position: -136px -170px; 948 | } 949 | .tsd-is-static.tsd-kind-call-signature.tsd-is-protected 950 | > .tsd-kind-icon:before { 951 | background-position: -153px -170px; 952 | } 953 | .tsd-is-static.tsd-kind-call-signature.tsd-is-private > .tsd-kind-icon:before { 954 | background-position: -119px -170px; 955 | } 956 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class 957 | > .tsd-kind-icon:before { 958 | background-position: -51px -170px; 959 | } 960 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-inherited 961 | > .tsd-kind-icon:before { 962 | background-position: -68px -170px; 963 | } 964 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected 965 | > .tsd-kind-icon:before { 966 | background-position: -85px -170px; 967 | } 968 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 969 | > .tsd-kind-icon:before { 970 | background-position: -102px -170px; 971 | } 972 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-private 973 | > .tsd-kind-icon:before { 974 | background-position: -119px -170px; 975 | } 976 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum 977 | > .tsd-kind-icon:before { 978 | background-position: -170px -170px; 979 | } 980 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-protected 981 | > .tsd-kind-icon:before { 982 | background-position: -187px -170px; 983 | } 984 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-private 985 | > .tsd-kind-icon:before { 986 | background-position: -119px -170px; 987 | } 988 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-interface 989 | > .tsd-kind-icon:before { 990 | background-position: -204px -170px; 991 | } 992 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-interface.tsd-is-inherited 993 | > .tsd-kind-icon:before { 994 | background-position: -221px -170px; 995 | } 996 | 997 | .tsd-is-static.tsd-kind-event > .tsd-kind-icon:before { 998 | background-position: -136px -187px; 999 | } 1000 | .tsd-is-static.tsd-kind-event.tsd-is-protected > .tsd-kind-icon:before { 1001 | background-position: -153px -187px; 1002 | } 1003 | .tsd-is-static.tsd-kind-event.tsd-is-private > .tsd-kind-icon:before { 1004 | background-position: -119px -187px; 1005 | } 1006 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-class > .tsd-kind-icon:before { 1007 | background-position: -51px -187px; 1008 | } 1009 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-inherited 1010 | > .tsd-kind-icon:before { 1011 | background-position: -68px -187px; 1012 | } 1013 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected 1014 | > .tsd-kind-icon:before { 1015 | background-position: -85px -187px; 1016 | } 1017 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 1018 | > .tsd-kind-icon:before { 1019 | background-position: -102px -187px; 1020 | } 1021 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-private 1022 | > .tsd-kind-icon:before { 1023 | background-position: -119px -187px; 1024 | } 1025 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-enum > .tsd-kind-icon:before { 1026 | background-position: -170px -187px; 1027 | } 1028 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-enum.tsd-is-protected 1029 | > .tsd-kind-icon:before { 1030 | background-position: -187px -187px; 1031 | } 1032 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-enum.tsd-is-private 1033 | > .tsd-kind-icon:before { 1034 | background-position: -119px -187px; 1035 | } 1036 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-interface 1037 | > .tsd-kind-icon:before { 1038 | background-position: -204px -187px; 1039 | } 1040 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-interface.tsd-is-inherited 1041 | > .tsd-kind-icon:before { 1042 | background-position: -221px -187px; 1043 | } 1044 | -------------------------------------------------------------------------------- /docs/assets/main.js: -------------------------------------------------------------------------------- 1 | (()=>{var Ce=Object.create;var J=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Re=Object.getPrototypeOf,_e=Object.prototype.hasOwnProperty;var Me=t=>J(t,"__esModule",{value:!0});var Fe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var De=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Oe(e))!_e.call(t,n)&&n!=="default"&&J(t,n,{get:()=>e[n],enumerable:!(r=Pe(e,n))||r.enumerable});return t},Ae=t=>De(Me(J(t!=null?Ce(Re(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var de=Fe((ue,he)=>{(function(){var t=function(e){var r=new t.Builder;return r.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),r.searchPipeline.add(t.stemmer),e.call(r,r),r.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(r){e.console&&console.warn&&console.warn(r)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var r=Object.create(null),n=Object.keys(e),i=0;i0){var h=t.utils.clone(r)||{};h.position=[a,l],h.index=s.length,s.push(new t.Token(n.slice(a,o),h))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,r){r in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+r),e.label=r,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var r=e.label&&e.label in this.registeredFunctions;r||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. 2 | `,e)},t.Pipeline.load=function(e){var r=new t.Pipeline;return e.forEach(function(n){var i=t.Pipeline.registeredFunctions[n];if(i)r.add(i);else throw new Error("Cannot load unregistered function: "+n)}),r},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(r){t.Pipeline.warnIfFunctionNotRegistered(r),this._stack.push(r)},this)},t.Pipeline.prototype.after=function(e,r){t.Pipeline.warnIfFunctionNotRegistered(r);var n=this._stack.indexOf(e);if(n==-1)throw new Error("Cannot find existingFn");n=n+1,this._stack.splice(n,0,r)},t.Pipeline.prototype.before=function(e,r){t.Pipeline.warnIfFunctionNotRegistered(r);var n=this._stack.indexOf(e);if(n==-1)throw new Error("Cannot find existingFn");this._stack.splice(n,0,r)},t.Pipeline.prototype.remove=function(e){var r=this._stack.indexOf(e);r!=-1&&this._stack.splice(r,1)},t.Pipeline.prototype.run=function(e){for(var r=this._stack.length,n=0;n1&&(oe&&(n=s),o!=e);)i=n-r,s=r+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(oc?h+=2:a==c&&(r+=n[l+1]*i[h+1],l+=2,h+=2);return r},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),r=1,n=0;r0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var c=s.node.edges["*"];else{var c=new t.TokenSet;s.node.edges["*"]=c}if(s.str.length==0&&(c.final=!0),i.push({node:c,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}s.str.length==1&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var h=s.str.charAt(0),f=s.str.charAt(1),v;f in s.node.edges?v=s.node.edges[f]:(v=new t.TokenSet,s.node.edges[f]=v),s.str.length==1&&(v.final=!0),i.push({node:v,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return n},t.TokenSet.fromString=function(e){for(var r=new t.TokenSet,n=r,i=0,s=e.length;i=e;r--){var n=this.uncheckedNodes[r],i=n.child.toString();i in this.minimizedNodes?n.parent.edges[n.char]=this.minimizedNodes[i]:(n.child._str=i,this.minimizedNodes[i]=n.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(r){var n=new t.QueryParser(e,r);n.parse()})},t.Index.prototype.query=function(e){for(var r=new t.Query(this.fields),n=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),c=0;c1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,r){var n=e[this._ref],i=Object.keys(this._fields);this._documents[n]=r||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,r;do e=this.next(),r=e.charCodeAt(0);while(r>47&&r<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var r=e.next();if(r==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(r.charCodeAt(0)==92){e.escapeCharacter();continue}if(r==":")return t.QueryLexer.lexField;if(r=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(r=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(r=="+"&&e.width()===1||r=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(r.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,r){this.lexer=new t.QueryLexer(e),this.query=r,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var r=e.peekLexeme();if(r!=null)switch(r.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var n="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(n+=" with value '"+r.str+"'"),new t.QueryParseError(n,r.start,r.end)}},t.QueryParser.parsePresence=function(e){var r=e.consumeLexeme();if(r!=null){switch(r.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var n="unrecognised presence operator'"+r.str+"'";throw new t.QueryParseError(n,r.start,r.end)}var i=e.peekLexeme();if(i==null){var n="expecting term or field, found nothing";throw new t.QueryParseError(n,r.start,r.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var n="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(n,i.start,i.end)}}},t.QueryParser.parseField=function(e){var r=e.consumeLexeme();if(r!=null){if(e.query.allFields.indexOf(r.str)==-1){var n=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+r.str+"', possible fields: "+n;throw new t.QueryParseError(i,r.start,r.end)}e.currentClause.fields=[r.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,r.start,r.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var r=e.consumeLexeme();if(r!=null){e.currentClause.term=r.str.toLowerCase(),r.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var n=e.peekLexeme();if(n==null){e.nextClause();return}switch(n.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+n.type+"'";throw new t.QueryParseError(i,n.start,n.end)}}},t.QueryParser.parseEditDistance=function(e){var r=e.consumeLexeme();if(r!=null){var n=parseInt(r.str,10);if(isNaN(n)){var i="edit distance must be numeric";throw new t.QueryParseError(i,r.start,r.end)}e.currentClause.editDistance=n;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var r=e.consumeLexeme();if(r!=null){var n=parseInt(r.str,10);if(isNaN(n)){var i="boost must be numeric";throw new t.QueryParseError(i,r.start,r.end)}e.currentClause.boost=n;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,r){typeof define=="function"&&define.amd?define(r):typeof ue=="object"?he.exports=r():e.lunr=r()}(this,function(){return t})})()});var le=[];function N(t,e){le.push({selector:e,constructor:t})}var X=class{constructor(){this.createComponents(document.body)}createComponents(e){le.forEach(r=>{e.querySelectorAll(r.selector).forEach(n=>{n.dataset.hasInstance||(new r.constructor({el:n}),n.dataset.hasInstance=String(!0))})})}};var Q=class{constructor(e){this.el=e.el}};var Z=class{constructor(){this.listeners={}}addEventListener(e,r){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push(r)}removeEventListener(e,r){if(!(e in this.listeners))return;let n=this.listeners[e];for(let i=0,s=n.length;i{let r=Date.now();return(...n)=>{r+e-Date.now()<0&&(t(...n),r=Date.now())}};var ee=class extends Z{constructor(){super();this.scrollTop=0;this.lastY=0;this.width=0;this.height=0;this.showToolbar=!0;this.toolbar=document.querySelector(".tsd-page-toolbar"),this.secondaryNav=document.querySelector(".tsd-navigation.secondary"),window.addEventListener("scroll",K(()=>this.onScroll(),10)),window.addEventListener("resize",K(()=>this.onResize(),10)),this.onResize(),this.onScroll()}triggerResize(){let e=new CustomEvent("resize",{detail:{width:this.width,height:this.height}});this.dispatchEvent(e)}onResize(){this.width=window.innerWidth||0,this.height=window.innerHeight||0;let e=new CustomEvent("resize",{detail:{width:this.width,height:this.height}});this.dispatchEvent(e)}onScroll(){this.scrollTop=window.scrollY||0;let e=new CustomEvent("scroll",{detail:{scrollTop:this.scrollTop}});this.dispatchEvent(e),this.hideShowToolbar()}hideShowToolbar(){let e=this.showToolbar;this.showToolbar=this.lastY>=this.scrollTop||this.scrollTop<=0,e!==this.showToolbar&&(this.toolbar.classList.toggle("tsd-page-toolbar--hide"),this.secondaryNav.classList.toggle("tsd-navigation--toolbar-hide")),this.lastY=this.scrollTop}},I=ee;I.instance=new ee;var te=class extends Q{constructor(e){super(e);this.anchors=[];this.index=-1;I.instance.addEventListener("resize",()=>this.onResize()),I.instance.addEventListener("scroll",r=>this.onScroll(r)),this.createAnchors()}createAnchors(){let e=window.location.href;e.indexOf("#")!=-1&&(e=e.substr(0,e.indexOf("#"))),this.el.querySelectorAll("a").forEach(r=>{let n=r.href;if(n.indexOf("#")==-1||n.substr(0,e.length)!=e)return;let i=n.substr(n.indexOf("#")+1),s=document.querySelector("a.tsd-anchor[name="+i+"]"),o=r.parentNode;!s||!o||this.anchors.push({link:o,anchor:s,position:0})}),this.onResize()}onResize(){let e;for(let n=0,i=this.anchors.length;nn.position-i.position);let r=new CustomEvent("scroll",{detail:{scrollTop:I.instance.scrollTop}});this.onScroll(r)}onScroll(e){let r=e.detail.scrollTop+5,n=this.anchors,i=n.length-1,s=this.index;for(;s>-1&&n[s].position>r;)s-=1;for(;s-1&&this.anchors[this.index].link.classList.remove("focus"),this.index=s,this.index>-1&&this.anchors[this.index].link.classList.add("focus"))}};var ce=(t,e=100)=>{let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(n),e)}};var pe=Ae(de());function fe(){let t=document.getElementById("tsd-search");if(!t)return;let e=document.getElementById("search-script");t.classList.add("loading"),e&&(e.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),e.addEventListener("load",()=>{t.classList.remove("loading"),t.classList.add("ready")}),window.searchData&&t.classList.remove("loading"));let r=document.querySelector("#tsd-search input"),n=document.querySelector("#tsd-search .results");if(!r||!n)throw new Error("The input field or the result list wrapper was not found");let i=!1;n.addEventListener("mousedown",()=>i=!0),n.addEventListener("mouseup",()=>{i=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{i||(i=!1,t.classList.remove("has-focus"))});let s={base:t.dataset.base+"/"};Ve(t,n,r,s)}function Ve(t,e,r,n){r.addEventListener("input",ce(()=>{ze(t,e,r,n)},200));let i=!1;r.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ne(e,r):s.key=="Escape"?r.blur():s.key=="ArrowUp"?me(e,-1):s.key==="ArrowDown"?me(e,1):i=!1}),r.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!r.matches(":focus")&&s.key==="/"&&(r.focus(),s.preventDefault())})}function He(t,e){t.index||window.searchData&&(e.classList.remove("loading"),e.classList.add("ready"),t.data=window.searchData,t.index=pe.Index.load(window.searchData.index))}function ze(t,e,r,n){if(He(n,t),!n.index||!n.data)return;e.textContent="";let i=r.value.trim(),s=n.index.search(`*${i}*`);for(let o=0,a=Math.min(10,s.length);o${ve(c.parent,i)}.${l}`);let h=document.createElement("li");h.classList.value=c.classes;let f=document.createElement("a");f.href=n.base+c.url,f.classList.add("tsd-kind-icon"),f.innerHTML=l,h.append(f),e.appendChild(h)}}function me(t,e){let r=t.querySelector(".current");if(!r)r=t.querySelector(e==1?"li:first-child":"li:last-child"),r&&r.classList.add("current");else{let n=r;if(e===1)do n=n.nextElementSibling;while(n instanceof HTMLElement&&n.offsetParent==null);else do n=n.previousElementSibling;while(n instanceof HTMLElement&&n.offsetParent==null);n&&(r.classList.remove("current"),n.classList.add("current"))}}function Ne(t,e){let r=t.querySelector(".current");if(r||(r=t.querySelector("li:first-child")),r){let n=r.querySelector("a");n&&(window.location.href=n.href),e.blur()}}function ve(t,e){if(e==="")return t;let r=t.toLocaleLowerCase(),n=e.toLocaleLowerCase(),i=[],s=0,o=r.indexOf(n);for(;o!=-1;)i.push(re(t.substring(s,o)),`${re(t.substring(o,o+n.length))}`),s=o+n.length,o=r.indexOf(n,s);return i.push(re(t.substring(s))),i.join("")}var je={"&":"&","<":"<",">":">","'":"'",'"':"""};function re(t){return t.replace(/[&<>"'"]/g,e=>je[e])}var ge=class{constructor(e,r){this.signature=e,this.description=r}addClass(e){return this.signature.classList.add(e),this.description.classList.add(e),this}removeClass(e){return this.signature.classList.remove(e),this.description.classList.remove(e),this}},ne=class extends Q{constructor(e){super(e);this.groups=[];this.index=-1;this.createGroups(),this.container&&(this.el.classList.add("active"),Array.from(this.el.children).forEach(r=>{r.addEventListener("touchstart",n=>this.onClick(n)),r.addEventListener("click",n=>this.onClick(n))}),this.container.classList.add("active"),this.setIndex(0))}setIndex(e){if(e<0&&(e=0),e>this.groups.length-1&&(e=this.groups.length-1),this.index==e)return;let r=this.groups[e];if(this.index>-1){let n=this.groups[this.index];n.removeClass("current").addClass("fade-out"),r.addClass("current"),r.addClass("fade-in"),I.instance.triggerResize(),setTimeout(()=>{n.removeClass("fade-out"),r.removeClass("fade-in")},300)}else r.addClass("current"),I.instance.triggerResize();this.index=e}createGroups(){let e=this.el.children;if(e.length<2)return;this.container=this.el.nextElementSibling;let r=this.container.children;this.groups=[];for(let n=0;n{r.signature===e.currentTarget&&this.setIndex(n)})}};var C="mousedown",ye="mousemove",_="mouseup",G={x:0,y:0},xe=!1,ie=!1,Be=!1,A=!1,Le=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(Le?"is-mobile":"not-mobile");Le&&"ontouchstart"in document.documentElement&&(Be=!0,C="touchstart",ye="touchmove",_="touchend");document.addEventListener(C,t=>{ie=!0,A=!1;let e=C=="touchstart"?t.targetTouches[0]:t;G.y=e.pageY||0,G.x=e.pageX||0});document.addEventListener(ye,t=>{if(!!ie&&!A){let e=C=="touchstart"?t.targetTouches[0]:t,r=G.x-(e.pageX||0),n=G.y-(e.pageY||0);A=Math.sqrt(r*r+n*n)>10}});document.addEventListener(_,()=>{ie=!1});document.addEventListener("click",t=>{xe&&(t.preventDefault(),t.stopImmediatePropagation(),xe=!1)});var se=class extends Q{constructor(e){super(e);this.className=this.el.dataset.toggle||"",this.el.addEventListener(_,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(C,r=>this.onDocumentPointerDown(r)),document.addEventListener(_,r=>this.onDocumentPointerUp(r))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(e){A||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-menu, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!A&&this.active&&e.target.closest(".col-menu")){let r=e.target.closest("a");if(r){let n=window.location.href;n.indexOf("#")!=-1&&(n=n.substr(0,n.indexOf("#"))),r.href.substr(0,n.length)==n&&setTimeout(()=>this.setActive(!1),250)}}}};var oe=class{constructor(e,r){this.key=e,this.value=r,this.defaultValue=r,this.initialize(),window.localStorage[this.key]&&this.setValue(this.fromLocalStorage(window.localStorage[this.key]))}initialize(){}setValue(e){if(this.value==e)return;let r=this.value;this.value=e,window.localStorage[this.key]=this.toLocalStorage(e),this.handleValueChange(r,e)}},ae=class extends oe{initialize(){let e=document.querySelector("#tsd-filter-"+this.key);!e||(this.checkbox=e,this.checkbox.addEventListener("change",()=>{this.setValue(this.checkbox.checked)}))}handleValueChange(e,r){!this.checkbox||(this.checkbox.checked=this.value,document.documentElement.classList.toggle("toggle-"+this.key,this.value!=this.defaultValue))}fromLocalStorage(e){return e=="true"}toLocalStorage(e){return e?"true":"false"}},Ee=class extends oe{initialize(){document.documentElement.classList.add("toggle-"+this.key+this.value);let e=document.querySelector("#tsd-filter-"+this.key);if(!e)return;this.select=e;let r=()=>{this.select.classList.add("active")},n=()=>{this.select.classList.remove("active")};this.select.addEventListener(C,r),this.select.addEventListener("mouseover",r),this.select.addEventListener("mouseleave",n),this.select.querySelectorAll("li").forEach(i=>{i.addEventListener(_,s=>{e.classList.remove("active"),this.setValue(s.target.dataset.value||"")})}),document.addEventListener(C,i=>{this.select.contains(i.target)||this.select.classList.remove("active")})}handleValueChange(e,r){this.select.querySelectorAll("li.selected").forEach(s=>{s.classList.remove("selected")});let n=this.select.querySelector('li[data-value="'+r+'"]'),i=this.select.querySelector(".tsd-select-label");n&&i&&(n.classList.add("selected"),i.textContent=n.textContent),document.documentElement.classList.remove("toggle-"+e),document.documentElement.classList.add("toggle-"+r)}fromLocalStorage(e){return e}toLocalStorage(e){return e}},Y=class extends Q{constructor(e){super(e);this.optionVisibility=new Ee("visibility","private"),this.optionInherited=new ae("inherited",!0),this.optionExternals=new ae("externals",!0)}static isSupported(){try{return typeof window.localStorage!="undefined"}catch{return!1}}};function be(t){let e=localStorage.getItem("tsd-theme")||"os";t.value=e,we(e),t.addEventListener("change",()=>{localStorage.setItem("tsd-theme",t.value),we(t.value)})}function we(t){switch(t){case"os":document.body.classList.remove("light","dark");break;case"light":document.body.classList.remove("dark"),document.body.classList.add("light");break;case"dark":document.body.classList.remove("light"),document.body.classList.add("dark");break}}fe();N(te,".menu-highlight");N(ne,".tsd-signatures");N(se,"a[data-toggle]");Y.isSupported()?N(Y,"#tsd-filter"):document.documentElement.classList.add("no-filter");var Te=document.getElementById("theme");Te&&be(Te);var qe=new X;Object.defineProperty(window,"app",{value:qe});})(); 3 | /*! 4 | * lunr.Builder 5 | * Copyright (C) 2020 Oliver Nightingale 6 | */ 7 | /*! 8 | * lunr.Index 9 | * Copyright (C) 2020 Oliver Nightingale 10 | */ 11 | /*! 12 | * lunr.Pipeline 13 | * Copyright (C) 2020 Oliver Nightingale 14 | */ 15 | /*! 16 | * lunr.Set 17 | * Copyright (C) 2020 Oliver Nightingale 18 | */ 19 | /*! 20 | * lunr.TokenSet 21 | * Copyright (C) 2020 Oliver Nightingale 22 | */ 23 | /*! 24 | * lunr.Vector 25 | * Copyright (C) 2020 Oliver Nightingale 26 | */ 27 | /*! 28 | * lunr.stemmer 29 | * Copyright (C) 2020 Oliver Nightingale 30 | * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt 31 | */ 32 | /*! 33 | * lunr.stopWordFilter 34 | * Copyright (C) 2020 Oliver Nightingale 35 | */ 36 | /*! 37 | * lunr.tokenizer 38 | * Copyright (C) 2020 Oliver Nightingale 39 | */ 40 | /*! 41 | * lunr.trimmer 42 | * Copyright (C) 2020 Oliver Nightingale 43 | */ 44 | /*! 45 | * lunr.utils 46 | * Copyright (C) 2020 Oliver Nightingale 47 | */ 48 | /** 49 | * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 50 | * Copyright (C) 2020 Oliver Nightingale 51 | * @license MIT 52 | */ 53 | --------------------------------------------------------------------------------