From 5f1f3bb14811f00931df6ea42998f256d504d0c4 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 17 Feb 2021 07:57:11 +0100 Subject: [PATCH] Adopt latest typedoc --- monaco.d.ts => doc/monaco.d.ts | 0 doc/tsconfig.json | 6 + doc/typedoc.json | 8 + gulpfile.js | 34 +- package-lock.json | 449 ++++++---------- package.json | 8 +- .../assets/css/elements/_filter.sass | 5 +- .../assets/css/elements/_member.sass | 15 + website/typedoc-theme/assets/css/main.sass | 1 - .../assets/css/setup/_icons.scss | 78 ++- .../assets/css/setup/_typography.sass | 7 +- .../assets/css/vendors/_highlight.js.sass | 50 -- .../typedoc-theme/assets/js/src/bootstrap.ts | 28 +- .../assets/js/src/typedoc/Application.ts | 10 +- .../assets/js/src/typedoc/EventTarget.ts | 6 +- .../js/src/typedoc/components/Filter.ts | 92 ++-- .../src/typedoc/components/MenuHighlight.ts | 48 +- .../js/src/typedoc/components/Search.ts | 483 ++++++++---------- .../js/src/typedoc/components/Signature.ts | 43 +- .../js/src/typedoc/components/Toggle.ts | 46 +- .../js/src/typedoc/services/Viewport.ts | 48 +- .../assets/js/src/typedoc/utils/debounce.ts | 7 + .../assets/js/src/typedoc/utils/pointer.ts | 37 +- .../assets/js/src/typedoc/utils/trottle.ts | 11 +- website/typedoc-theme/layouts/default.hbs | 1 + website/typedoc-theme/partials/breadcrumb.hbs | 4 +- website/typedoc-theme/partials/header.hbs | 17 +- .../typedoc-theme/partials/member.sources.hbs | 2 +- website/typedoc-theme/partials/parameter.hbs | 71 ++- website/typedoc-theme/partials/type.hbs | 144 +++++- 30 files changed, 857 insertions(+), 902 deletions(-) rename monaco.d.ts => doc/monaco.d.ts (100%) create mode 100644 doc/tsconfig.json create mode 100644 doc/typedoc.json delete mode 100644 website/typedoc-theme/assets/css/vendors/_highlight.js.sass create mode 100644 website/typedoc-theme/assets/js/src/typedoc/utils/debounce.ts diff --git a/monaco.d.ts b/doc/monaco.d.ts similarity index 100% rename from monaco.d.ts rename to doc/monaco.d.ts diff --git a/doc/tsconfig.json b/doc/tsconfig.json new file mode 100644 index 00000000..b151b90c --- /dev/null +++ b/doc/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "module": "CommonJS" + }, + "include": ["monaco.d.ts"] +} diff --git a/doc/typedoc.json b/doc/typedoc.json new file mode 100644 index 00000000..62db9c2d --- /dev/null +++ b/doc/typedoc.json @@ -0,0 +1,8 @@ +{ + "entryPoints": ["monaco.d.ts"], + "out": "../../monaco-editor-website/api", + "theme": "../website/typedoc-theme", + "name": "Monaco Editor API", + "readme": "none", + "hideGenerator": true +} diff --git a/gulpfile.js b/gulpfile.js index 43513f54..c9b1b007 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,10 +6,8 @@ const path = require('path'); const fs = require('fs'); const rimraf = require('rimraf'); const cp = require('child_process'); -const os = require('os'); const yaserver = require('yaserver'); const http = require('http'); -const typedoc = require("gulp-typedoc"); const CleanCSS = require('clean-css'); const uncss = require('uncss'); const File = require('vinyl'); @@ -435,7 +433,7 @@ function addPluginDTS() { })); fs.writeFileSync('website/playground/monaco.d.ts.txt', contents); - fs.writeFileSync('monaco.d.ts', contents); + fs.writeFileSync('doc/monaco.d.ts', contents); this.emit('data', data); }); } @@ -531,32 +529,6 @@ function addPluginThirdPartyNotices() { // --- website -function typedocStream() { - const initialCWD = process.cwd(); - // TypeDoc is silly and consumes the `exclude` option. - // This option does not make it to typescript compiler, which ends up including /node_modules/ .d.ts files. - // We work around this by changing the cwd... :O - return gulp.src('monaco.d.ts') - .pipe(es.through(undefined, function() { - process.chdir(os.tmpdir()); - this.emit('end'); - })) - .pipe(typedoc({ - mode: 'file', - out: path.join(__dirname, '../monaco-editor-website/api'), - includeDeclarations: true, - theme: path.join(__dirname, 'website/typedoc-theme'), - entryPoint: 'monaco', - name: 'Monaco Editor API v' + MONACO_EDITOR_VERSION, - readme: 'none', - hideGenerator: true - })) - .pipe(es.through(undefined, function() { - process.chdir(initialCWD); - this.emit('end'); - })) -}; -gulp.task('typedoc', () => typedocStream()); const cleanWebsiteTask = function(cb) { rimraf('../monaco-editor-website', { maxBusyTries: 1 }, cb); }; const buildWebsiteTask = taskSeries(cleanWebsiteTask, function() { @@ -651,9 +623,7 @@ const buildWebsiteTask = taskSeries(cleanWebsiteTask, function() { this.emit('end'); } })) - .pipe(gulp.dest('../monaco-editor-website')), - - typedocStream() + .pipe(gulp.dest('../monaco-editor-website')) ) .pipe(es.through(function(data) { diff --git a/package-lock.json b/package-lock.json index d17c7028..bcbc25c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,9 +11,9 @@ "dev": true }, "acorn": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", - "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", + "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", "dev": true }, "acorn-globals": { @@ -33,9 +33,9 @@ "dev": true }, "ajv": { - "version": "6.12.5", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", - "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -312,9 +312,9 @@ "dev": true }, "aws4": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz", - "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", "dev": true }, "bach": { @@ -494,6 +494,22 @@ "unset-value": "^1.0.0" } }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -662,6 +678,12 @@ "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", "dev": true }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -960,37 +982,6 @@ "is-arrayish": "^0.2.1" } }, - "es-abstract": { - "version": "1.18.0-next.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.0.tgz", - "integrity": "sha512-elZXTZXKn51hUBdJjSZGYRujuzilgXo8vSPQzjGYXLvSlGiCo8VO8ZGV3kjo9a0WNJJ57hENagwbtlRuHuzkcQ==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, "es5-ext": { "version": "0.10.53", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz", @@ -1141,9 +1132,9 @@ }, "dependencies": { "type": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/type/-/type-2.1.0.tgz", - "integrity": "sha512-G9absDWvhAWCV2gmF1zKud3OyC61nZDwWvBL2DApaVFogI07CprggiQAOOjvp2NRjYWFzPyu7vwtDrQFq8jeSA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-2.2.0.tgz", + "integrity": "sha512-M/u37b4oSGlusaU8ZB96BfFPWQ8MbsZYXB+kXGMiDj6IKinkcNaQvmirBuWj8mAXqP6LYn1rQvbTYum3yPhaOA==", "dev": true } } @@ -1405,15 +1396,15 @@ "dev": true }, "fs-extra": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", - "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dev": true, "requires": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", - "universalify": "^1.0.0" + "universalify": "^2.0.0" } }, "fs-mkdirp-stream": { @@ -1455,6 +1446,17 @@ "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -1572,9 +1574,9 @@ } }, "graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", "dev": true }, "gulp": { @@ -1617,27 +1619,6 @@ } } }, - "gulp-typedoc": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/gulp-typedoc/-/gulp-typedoc-2.2.5.tgz", - "integrity": "sha512-+xfmr9g7TmBRJzHn+WCbyvN0lfi0Y5Q4IDG/7CjRgnNoomWYzSAXa2HdQKJM/QfQUc7kQS/td9j35mg8FaSKrw==", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1", - "event-stream": "^4.0.1", - "fancy-log": "^1.3.3", - "plugin-error": "^1.0.1", - "semver": "^7.1.3" - }, - "dependencies": { - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - } - } - }, "gulplog": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", @@ -1648,9 +1629,9 @@ } }, "handlebars": { - "version": "4.7.6", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz", - "integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==", + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", "dev": true, "requires": { "minimist": "^1.2.5", @@ -1729,12 +1710,6 @@ } } }, - "highlight.js": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.4.1.tgz", - "integrity": "sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg==", - "dev": true - }, "homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", @@ -1808,9 +1783,9 @@ "dev": true }, "ini": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz", - "integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, "interpret": { @@ -1882,11 +1857,14 @@ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, - "is-callable": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.1.tgz", - "integrity": "sha512-wliAfSzx6V+6WfMOmus1xy0XvSgf/dlStkvTfq7F0g4bOIW0PSUbnyse3NhDwdyYS1ozfUtAAySqTws3z9Eqgg==", - "dev": true + "is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } }, "is-data-descriptor": { "version": "0.1.4", @@ -1908,12 +1886,6 @@ } } }, - "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true - }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -1978,12 +1950,6 @@ "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", "dev": true }, - "is-negative-zero": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", - "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", - "dev": true - }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -2013,15 +1979,6 @@ "isobject": "^3.0.1" } }, - "is-regex": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", - "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, "is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", @@ -2031,15 +1988,6 @@ "is-unc-path": "^1.0.0" } }, - "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -2162,13 +2110,13 @@ "dev": true }, "jsonfile": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", - "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, "requires": { "graceful-fs": "^4.1.6", - "universalify": "^1.0.0" + "universalify": "^2.0.0" } }, "jsprim": { @@ -2320,9 +2268,9 @@ } }, "marked": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/marked/-/marked-1.1.1.tgz", - "integrity": "sha512-mJzT8D2yPxoPh7h0UXkB+dBj4FykPJ2OIfxAWeIHrvoHDkFxukV/29QxoFQoPM6RLEwhIFdJpmKBlqVM3s2ZIw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.0.tgz", + "integrity": "sha512-NqRSh2+LlN2NInpqTQnS614Y/3NkVMFFU6sJlRFEpxJ/LHuK/qJECH7/fXZjk4VZstPW/Pevjil/VtSONsLc7Q==", "dev": true }, "matchdep": { @@ -2382,18 +2330,18 @@ } }, "mime-db": { - "version": "1.44.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "version": "1.45.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz", + "integrity": "sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w==", "dev": true }, "mime-types": { - "version": "2.1.27", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", - "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "version": "2.1.28", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.28.tgz", + "integrity": "sha512-0TO2yJ5YHYr7M2zzT7gDU1tbwHxEUWBCLt0lscSNpcdAfFyJOVEpRYNS7EXVcTLNj/25QO8gulHC5JtTzSE2UQ==", "dev": true, "requires": { - "mime-db": "1.44.0" + "mime-db": "1.45.0" } }, "minimatch": { @@ -2481,9 +2429,9 @@ "dev": true }, "nan": { - "version": "2.14.1", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", - "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==", + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", "dev": true, "optional": true }, @@ -2528,14 +2476,6 @@ "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } } }, "normalize-path": { @@ -2602,12 +2542,6 @@ } } }, - "object-inspect": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", - "dev": true - }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -2624,13 +2558,13 @@ } }, "object.assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", - "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", "dev": true, "requires": { + "call-bind": "^1.0.0", "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.0", "has-symbols": "^1.0.1", "object-keys": "^1.1.1" } @@ -2685,6 +2619,32 @@ "wrappy": "1" } }, + "onigasm": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/onigasm/-/onigasm-2.2.5.tgz", + "integrity": "sha512-F+th54mPc0l1lp1ZcFMyL/jTs2Tlq4SqIHKIXGZOR/VkHkF9A7Fr5rRr5+ZG/lWeRsyrClLYRq7s/yFQ/XhWCA==", + "dev": true, + "requires": { + "lru-cache": "^5.1.1" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, "optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -2858,18 +2818,6 @@ "pinkie": "^2.0.0" } }, - "plugin-error": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", - "integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==", - "dev": true, - "requires": { - "ansi-colors": "^1.0.1", - "arr-diff": "^4.0.0", - "arr-union": "^3.1.0", - "extend-shallow": "^3.0.2" - } - }, "pn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", @@ -2883,9 +2831,9 @@ "dev": true }, "postcss": { - "version": "7.0.34", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.34.tgz", - "integrity": "sha512-H/7V2VeNScX9KE83GDrDZNiGT1m2H+UTnlinIzhjlLX9hfMUn1mHNnGeX81a1c8JSBdBvqk7c2ZOG6ZPn5itGw==", + "version": "7.0.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.35.tgz", + "integrity": "sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==", "dev": true, "requires": { "chalk": "^2.4.2", @@ -3150,11 +3098,12 @@ "dev": true }, "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", "dev": true, "requires": { + "is-core-module": "^2.2.0", "path-parse": "^1.0.6" } }, @@ -3229,9 +3178,9 @@ } }, "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, "semver-greatest-satisfied-range": { @@ -3283,6 +3232,16 @@ "rechoir": "^0.6.2" } }, + "shiki": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.2.tgz", + "integrity": "sha512-BjUCxVbxMnvjs8jC4b+BQ808vwjJ9Q8NtLqPwXShZ307HdXiDFYP968ORSVfaTNNSWYDBYdMnVKJ0fYNsoZUBA==", + "dev": true, + "requires": { + "onigasm": "^2.2.5", + "vscode-textmate": "^5.2.0" + } + }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -3416,9 +3375,9 @@ } }, "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz", + "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==", "dev": true }, "sparkles": { @@ -3454,9 +3413,9 @@ } }, "spdx-license-ids": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", - "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==", "dev": true }, "split": { @@ -3560,68 +3519,6 @@ "strip-ansi": "^3.0.0" } }, - "string.prototype.trimend": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", - "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "string.prototype.trimstart": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", - "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -3823,28 +3720,28 @@ "dev": true }, "typedoc": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.19.1.tgz", - "integrity": "sha512-EqZpRJQUnkwHA1yBhaDExEXUZIiWKddkrDXhRcfUzpnu6pizxNmVTw5IZ3mu682Noa4zQCniE0YNjaAwHQodrA==", + "version": "0.20.25", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.25.tgz", + "integrity": "sha512-ZQZnjJPrt0rjp216gp6FQC1QC4ojcoKikhfOJ/51CqaJunVDilRLlIO5tCGWj1tzlYYT9eOGhJv7MF3t7rxSmw==", "dev": true, "requires": { - "fs-extra": "^9.0.1", + "colors": "^1.4.0", + "fs-extra": "^9.1.0", "handlebars": "^4.7.6", - "highlight.js": "^10.0.0", "lodash": "^4.17.20", "lunr": "^2.3.9", - "marked": "^1.1.1", + "marked": "^2.0.0", "minimatch": "^3.0.0", "progress": "^2.0.3", - "semver": "^7.3.2", "shelljs": "^0.8.4", - "typedoc-default-themes": "^0.11.1" + "shiki": "^0.9.2", + "typedoc-default-themes": "^0.12.7" } }, "typedoc-default-themes": { - "version": "0.11.3", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.11.3.tgz", - "integrity": "sha512-SwyN188QGNA2iFS5mdWYTGzohKqJ1PWAXVmGolKnVc2NnpX234FEPF2nUvEg+O9jjwAu7ZSVZ5UrZri0raJOjQ==", + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.7.tgz", + "integrity": "sha512-0XAuGEqID+gon1+fhi4LycOEFM+5Mvm2PjwaiVZNAzU7pn3G2DEpsoXnFOPlLDnHY6ZW0BY0nO7ur9fHOFkBLQ==", "dev": true }, "typescript": { @@ -3854,9 +3751,9 @@ "dev": true }, "uglify-js": { - "version": "3.10.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.4.tgz", - "integrity": "sha512-kBFT3U4Dcj4/pJ52vfjCSfyLyvG9VYYuGYPmrPvAxRw/i7xHiT4VvCev+uiEMcEEiu6UNB6KgWmGtSUYIWScbw==", + "version": "3.12.8", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.12.8.tgz", + "integrity": "sha512-fvBeuXOsvqjecUtF/l1dwsrrf5y2BCUk9AOJGzGcm6tE7vegku5u/YvqjyDaAGr422PLoLnrxg3EnRvTqsdC1w==", "dev": true, "optional": true }, @@ -3936,9 +3833,9 @@ } }, "universalify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", - "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", "dev": true }, "unset-value": { @@ -3988,9 +3885,9 @@ "dev": true }, "uri-js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", - "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "requires": { "punycode": "^2.1.0" @@ -4121,6 +4018,12 @@ } } }, + "vscode-textmate": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", + "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", + "dev": true + }, "w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", @@ -4244,9 +4147,9 @@ "dev": true }, "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", "dev": true }, "yargs": { @@ -4268,14 +4171,6 @@ "which-module": "^1.0.0", "y18n": "^3.2.1", "yargs-parser": "5.0.0-security.0" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true - } } }, "yargs-parser": { @@ -4286,14 +4181,6 @@ "requires": { "camelcase": "^3.0.0", "object.assign": "^4.1.0" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true - } } }, "yaserver": { diff --git a/package.json b/package.json index 5105410f..79358885 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,9 @@ "scripts": { "simpleserver": "gulp simpleserver", "release": "gulp release", - "website": "gulp website", - "build-website": "gulp build-website" + "website": "gulp website && npm run typedoc", + "build-website": "gulp build-website && npm run typedoc", + "typedoc": "cd doc && \"../node_modules/.bin/typedoc\" --options ./typedoc.json" }, "typings": "./esm/vs/editor/editor.api.d.ts", "module": "./esm/vs/editor/editor.main.js", @@ -21,7 +22,6 @@ "clean-css": "^4.2.3", "event-stream": "4.0.1", "gulp": "^4.0.2", - "gulp-typedoc": "^2.2.5", "monaco-css": "3.2.0", "monaco-editor-core": "0.22.3", "monaco-html": "3.2.0", @@ -29,7 +29,7 @@ "monaco-languages": "2.2.0", "monaco-typescript": "4.2.0", "rimraf": "^3.0.2", - "typedoc": "^0.19.1", + "typedoc": "^0.20.25", "typescript": "4.1.3", "uncss": "^0.17.3", "vinyl": "^2.2.1", diff --git a/website/typedoc-theme/assets/css/elements/_filter.sass b/website/typedoc-theme/assets/css/elements/_filter.sass index 12541540..3d8b6eab 100644 --- a/website/typedoc-theme/assets/css/elements/_filter.sass +++ b/website/typedoc-theme/assets/css/elements/_filter.sass @@ -11,9 +11,6 @@ .toggle-inherited .tsd-is-inherited display: none -.toggle-only-exported .tsd-is-not-exported - display: none - .toggle-externals .tsd-is-external display: none @@ -62,4 +59,4 @@ label, .tsd-select display: block - padding-right: 20px \ No newline at end of file + padding-right: 20px diff --git a/website/typedoc-theme/assets/css/elements/_member.sass b/website/typedoc-theme/assets/css/elements/_member.sass index f3518336..87d39818 100644 --- a/website/typedoc-theme/assets/css/elements/_member.sass +++ b/website/typedoc-theme/assets/css/elements/_member.sass @@ -19,3 +19,18 @@ margin-top: 0 margin-bottom: 0 border-bottom: none + + a[data-tsd-kind] + color: $COLOR_TS + + a[data-tsd-kind="Interface"] + color: $COLOR_TS_INTERFACE + + a[data-tsd-kind="Enum"] + color: $COLOR_TS_ENUM + + a[data-tsd-kind="Class"] + color: $COLOR_TS_CLASS + + a[data-tsd-kind="Private"] + color: $COLOR_TS_PRIVATE diff --git a/website/typedoc-theme/assets/css/main.sass b/website/typedoc-theme/assets/css/main.sass index 8fcf3352..29bc9173 100644 --- a/website/typedoc-theme/assets/css/main.sass +++ b/website/typedoc-theme/assets/css/main.sass @@ -1,7 +1,6 @@ @import constants @import vendors/normalize -@import vendors/highlight.js @import setup/mixins @import setup/grid diff --git a/website/typedoc-theme/assets/css/setup/_icons.scss b/website/typedoc-theme/assets/css/setup/_icons.scss index 9a875b14..bafecdf1 100644 --- a/website/typedoc-theme/assets/css/setup/_icons.scss +++ b/website/typedoc-theme/assets/css/setup/_icons.scss @@ -1,29 +1,13 @@ -$type-icons: - (object-literal), - (class), - ('class.tsd-has-type-parameter'), - (interface), - ('interface.tsd-has-type-parameter'), - (namespace, module), - (enum), - (enum-member), - (signature), - (type-alias), - ('type-alias.tsd-has-type-parameter'); - -$member-icons: - (variable, property), - (get-signature), - (set-signature), - (accessor), - (function, method, call-signature), - ('function.tsd-has-type-parameter', 'method.tsd-has-type-parameter'), - (constructor, constructor-signature), - (index-signature), - (event), - (property), - (function, method, call-signature), - (event); +$type-icons: (object-literal), (class), ("class.tsd-has-type-parameter"), + (interface), ("interface.tsd-has-type-parameter"), (namespace, module), + (enum), (enum-member), (signature), (type-alias), + ("type-alias.tsd-has-type-parameter"); + +$member-icons: (variable, property), (get-signature), (set-signature), + (accessor), (function, method, call-signature), + ("function.tsd-has-type-parameter", "method.tsd-has-type-parameter"), + (constructor, constructor-signature), (index-signature), (event), (property), + (function, method, call-signature), (event); // parameter // type-literal @@ -36,7 +20,7 @@ $member-icons: text-indent: -20px; &:before { - content: ''; + content: ""; display: inline-block; vertical-align: middle; width: 17px; @@ -55,26 +39,25 @@ $member-icons: background-position: 0 -153px; } -$icon-size: 17px; -$type: -0 * $icon-size; -$type-protected: -1 * $icon-size; -$type-private: -2 * $icon-size; -$member-class-public: -3 * $icon-size; -$member-class-public-inherited: -4 * $icon-size; -$member-class-protected: -5 * $icon-size; +$icon-size: 17px; +$type: -0 * $icon-size; +$type-protected: -1 * $icon-size; +$type-private: -2 * $icon-size; +$member-class-public: -3 * $icon-size; +$member-class-public-inherited: -4 * $icon-size; +$member-class-protected: -5 * $icon-size; $member-class-protected-inherited: -6 * $icon-size; -$member-private: -7 * $icon-size; -$member: -8 * $icon-size; -$member-protected: -9 * $icon-size; -$member-enum: -10 * $icon-size; -$member-enum-protected: -11 * $icon-size; -$member-interface: -12 * $icon-size; -$member-interface-inherited: -13 * $icon-size; - +$member-private: -7 * $icon-size; +$member: -8 * $icon-size; +$member-protected: -9 * $icon-size; +$member-enum: -10 * $icon-size; +$member-enum-protected: -11 * $icon-size; +$member-interface: -12 * $icon-size; +$member-interface-inherited: -13 * $icon-size; @for $index from 1 through length($type-icons) { @each $kind in nth($type-icons, $index) { - $selector: '.tsd-kind-' + $kind; + $selector: ".tsd-kind-" + $kind; $offset: -#{17 * ($index)}px; #{$selector} { @@ -96,11 +79,11 @@ $member-interface-inherited: -13 * $icon-size; @for $index from 1 through length($member-icons) { @each $kind in nth($member-icons, $index) { $offset: -#{17 * ($index - 1)}px; - $selector: '.tsd-kind-' + $kind; + $selector: ".tsd-kind-" + $kind; @if $index == 10 { - $selector: '.tsd-is-static'; + $selector: ".tsd-is-static"; } @else if $index > 10 { - $selector: '.tsd-is-static.tsd-kind-' + $kind; + $selector: ".tsd-is-static.tsd-kind-" + $kind; } #{$selector} { @@ -130,7 +113,8 @@ $member-interface-inherited: -13 * $icon-size; } &.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: $member-class-protected-inherited $offset; + background-position: $member-class-protected-inherited + $offset; } &.tsd-is-private > .tsd-kind-icon:before { diff --git a/website/typedoc-theme/assets/css/setup/_typography.sass b/website/typedoc-theme/assets/css/setup/_typography.sass index c05225d7..dc7af906 100644 --- a/website/typedoc-theme/assets/css/setup/_typography.sass +++ b/website/typedoc-theme/assets/css/setup/_typography.sass @@ -26,6 +26,11 @@ pre font-size: 100% background-color: transparent +blockquote + margin: 1em 0 + padding-left: 1em + border-left: 4px solid gray + .tsd-typography line-height: $LINE_HEIGHT @@ -42,4 +47,4 @@ pre font-weight: normal p, ul, ol - margin: 1em 0 \ No newline at end of file + margin: 1em 0 diff --git a/website/typedoc-theme/assets/css/vendors/_highlight.js.sass b/website/typedoc-theme/assets/css/vendors/_highlight.js.sass deleted file mode 100644 index d093f7a5..00000000 --- a/website/typedoc-theme/assets/css/vendors/_highlight.js.sass +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - *Visual Studio-like style based on original C# coloring by Jason Diamond - -.hljs - display: inline-block - padding: 0.5em - background: white - color: black - -.hljs-comment, .hljs-annotation, .hljs-template_comment, .diff .hljs-header, .hljs-chunk, .apache .hljs-cbracket - color: #008000 - -.hljs-keyword, .hljs-id, .hljs-built_in, .css .smalltalk .hljs-class, .hljs-winutils, .bash .hljs-variable, .tex .hljs-command, .hljs-request, .hljs-status, .nginx .hljs-title - color: #00f - -.xml .hljs-tag - color: #00f - .hljs-value - color: #00f - -.hljs-string, .hljs-title, .hljs-parent, .hljs-tag .hljs-value, .hljs-rules .hljs-value - color: #a31515 - -.ruby .hljs-symbol - color: #a31515 - .hljs-string - color: #a31515 - -.hljs-template_tag, .django .hljs-variable, .hljs-addition, .hljs-flow, .hljs-stream, .apache .hljs-tag, .hljs-date, .tex .hljs-formula, .coffeescript .hljs-attribute - color: #a31515 - -.ruby .hljs-string, .hljs-decorator, .hljs-filter .hljs-argument, .hljs-localvars, .hljs-array, .hljs-attr_selector, .hljs-pseudo, .hljs-pi, .hljs-doctype, .hljs-deletion, .hljs-envvar, .hljs-shebang, .hljs-preprocessor, .hljs-pragma, .userType, .apache .hljs-sqbracket, .nginx .hljs-built_in, .tex .hljs-special, .hljs-prompt - color: #2b91af - -.hljs-phpdoc, .hljs-javadoc, .hljs-xmlDocTag - color: #808080 - -.vhdl - .hljs-typename - font-weight: bold - .hljs-string - color: #666666 - .hljs-literal - color: #a31515 - .hljs-attribute - color: #00b0e8 - -.xml .hljs-attribute - color: #f00 \ No newline at end of file diff --git a/website/typedoc-theme/assets/js/src/bootstrap.ts b/website/typedoc-theme/assets/js/src/bootstrap.ts index 84bf1536..5e99eed7 100644 --- a/website/typedoc-theme/assets/js/src/bootstrap.ts +++ b/website/typedoc-theme/assets/js/src/bootstrap.ts @@ -1,24 +1,24 @@ -import {Application, registerComponent} from "./typedoc/Application"; -import {Search} from "./typedoc/components/Search"; -import {MenuHighlight} from "./typedoc/components/MenuHighlight"; -import {Signature} from "./typedoc/components/Signature"; -import {Toggle} from "./typedoc/components/Toggle"; -import {Filter} from "./typedoc/components/Filter"; +import { Application, registerComponent } from "./typedoc/Application"; +import { MenuHighlight } from "./typedoc/components/MenuHighlight"; +import { initSearch } from "./typedoc/components/Search"; +import { Signature } from "./typedoc/components/Signature"; +import { Toggle } from "./typedoc/components/Toggle"; +import { Filter } from "./typedoc/components/Filter"; -import '../../css/main.sass' +import "../../css/main.sass"; -registerComponent(Search, '#tsd-search'); +initSearch(); -registerComponent(MenuHighlight, '.menu-highlight'); -registerComponent(Signature, '.tsd-signatures'); -registerComponent(Toggle, 'a[data-toggle]'); +registerComponent(MenuHighlight, ".menu-highlight"); +registerComponent(Signature, ".tsd-signatures"); +registerComponent(Toggle, "a[data-toggle]"); if (Filter.isSupported()) { - registerComponent(Filter, '#tsd-filter'); + registerComponent(Filter, "#tsd-filter"); } else { - document.documentElement.classList.add('no-filter'); + document.documentElement.classList.add("no-filter"); } const app: Application = new Application(); -Object.defineProperty(window, 'app', {value: app}); +Object.defineProperty(window, "app", { value: app }); diff --git a/website/typedoc-theme/assets/js/src/typedoc/Application.ts b/website/typedoc-theme/assets/js/src/typedoc/Application.ts index ea4427bf..44bd8a9f 100644 --- a/website/typedoc-theme/assets/js/src/typedoc/Application.ts +++ b/website/typedoc-theme/assets/js/src/typedoc/Application.ts @@ -1,4 +1,4 @@ -import {IComponentOptions} from "./Component"; +import { IComponentOptions } from "./Component"; /** * Component definition. @@ -16,14 +16,16 @@ const components: IComponent[] = []; /** * Register a new component. */ -export function registerComponent(constructor: IComponent['constructor'], selector: string) { +export function registerComponent( + constructor: IComponent["constructor"], + selector: string +) { components.push({ selector: selector, constructor: constructor, }); } - /** * TypeDoc application class. */ @@ -42,7 +44,7 @@ export class Application { components.forEach((c) => { context.querySelectorAll(c.selector).forEach((el) => { if (!el.dataset.hasInstance) { - new c.constructor({el: el}); + new c.constructor({ el: el }); el.dataset.hasInstance = String(true); } }); diff --git a/website/typedoc-theme/assets/js/src/typedoc/EventTarget.ts b/website/typedoc-theme/assets/js/src/typedoc/EventTarget.ts index 0ace1f93..88f46293 100644 --- a/website/typedoc-theme/assets/js/src/typedoc/EventTarget.ts +++ b/website/typedoc-theme/assets/js/src/typedoc/EventTarget.ts @@ -13,7 +13,7 @@ export class EventTarget { this.listeners[type] = []; } this.listeners[type].push(callback); - }; + } public removeEventListener(type: string, callback: IEventListener) { if (!(type in this.listeners)) { @@ -26,7 +26,7 @@ export class EventTarget { return; } } - }; + } public dispatchEvent(event: CustomEvent) { if (!(event.type in this.listeners)) { @@ -38,5 +38,5 @@ export class EventTarget { stack[i].call(this, event); } return !event.defaultPrevented; - }; + } } diff --git a/website/typedoc-theme/assets/js/src/typedoc/components/Filter.ts b/website/typedoc-theme/assets/js/src/typedoc/components/Filter.ts index 32dfbaba..650974e8 100644 --- a/website/typedoc-theme/assets/js/src/typedoc/components/Filter.ts +++ b/website/typedoc-theme/assets/js/src/typedoc/components/Filter.ts @@ -1,5 +1,5 @@ -import {Component, IComponentOptions} from "../Component"; -import {pointerDown, pointerUp} from "../utils/pointer"; +import { Component, IComponentOptions } from "../Component"; +import { pointerDown, pointerUp } from "../utils/pointer"; abstract class FilterItem { protected key: string; @@ -8,7 +8,6 @@ abstract class FilterItem { protected defaultValue: T; - constructor(key: string, value: T) { this.key = key; this.value = value; @@ -21,10 +20,7 @@ abstract class FilterItem { } } - - protected initialize() { - } - + protected initialize() {} protected abstract handleValueChange(oldValue: T, newValue: T): void; @@ -32,7 +28,6 @@ abstract class FilterItem { protected abstract toLocalStorage(value: T): string; - protected setValue(value: T) { if (this.value == value) return; @@ -44,92 +39,97 @@ abstract class FilterItem { } } - class FilterItemCheckbox extends FilterItem { private checkbox!: HTMLInputElement; - protected initialize() { - const checkbox = document.querySelector('#tsd-filter-' + this.key); + const checkbox = document.querySelector( + "#tsd-filter-" + this.key + ); if (!checkbox) return; this.checkbox = checkbox; - this.checkbox.addEventListener('change', () => { + this.checkbox.addEventListener("change", () => { this.setValue(this.checkbox.checked); }); } - protected handleValueChange(oldValue: boolean, newValue: boolean) { if (!this.checkbox) return; this.checkbox.checked = this.value; - document.documentElement.classList.toggle('toggle-' + this.key, this.value != this.defaultValue); + document.documentElement.classList.toggle( + "toggle-" + this.key, + this.value != this.defaultValue + ); } - protected fromLocalStorage(value: string): boolean { - return value == 'true'; + return value == "true"; } - protected toLocalStorage(value: boolean): string { - return value ? 'true' : 'false'; + return value ? "true" : "false"; } } - class FilterItemSelect extends FilterItem { private select!: HTMLElement; - protected initialize() { - document.documentElement.classList.add('toggle-' + this.key + this.value); + document.documentElement.classList.add( + "toggle-" + this.key + this.value + ); - const select = document.querySelector('#tsd-filter-' + this.key); + const select = document.querySelector( + "#tsd-filter-" + this.key + ); if (!select) return; this.select = select; const onActivate = () => { - this.select.classList.add('active'); + this.select.classList.add("active"); }; const onDeactivate = () => { - this.select.classList.remove('active'); + this.select.classList.remove("active"); }; this.select.addEventListener(pointerDown, onActivate); - this.select.addEventListener('mouseover', onActivate); - this.select.addEventListener('mouseleave', onDeactivate); + this.select.addEventListener("mouseover", onActivate); + this.select.addEventListener("mouseleave", onDeactivate); - this.select.querySelectorAll('li').forEach(el => { + this.select.querySelectorAll("li").forEach((el) => { el.addEventListener(pointerUp, (e) => { - select.classList.remove('active'); - this.setValue((e.target as HTMLElement).dataset.value || ''); - }) + select.classList.remove("active"); + this.setValue((e.target as HTMLElement).dataset.value || ""); + }); }); document.addEventListener(pointerDown, (e) => { if (this.select.contains(e.target as HTMLElement)) return; - this.select.classList.remove('active'); + this.select.classList.remove("active"); }); } - protected handleValueChange(oldValue: string, newValue: string) { - this.select.querySelectorAll('li.selected').forEach(el => { - el.classList.remove('selected') + this.select.querySelectorAll("li.selected").forEach((el) => { + el.classList.remove("selected"); }); - const selected = this.select.querySelector('li[data-value="' + newValue + '"]'); - const label = this.select.querySelector('.tsd-select-label'); + const selected = this.select.querySelector( + 'li[data-value="' + newValue + '"]' + ); + const label = this.select.querySelector( + ".tsd-select-label" + ); if (selected && label) { - selected.classList.add('selected'); + selected.classList.add("selected"); label.textContent = selected.textContent; } - document.documentElement.classList.remove('toggle-' + oldValue); - document.documentElement.classList.add('toggle-' + newValue); + document.documentElement.classList.remove("toggle-" + oldValue); + document.documentElement.classList.add("toggle-" + newValue); } protected fromLocalStorage(value: string): string { @@ -141,30 +141,24 @@ class FilterItemSelect extends FilterItem { } } - export class Filter extends Component { private optionVisibility: FilterItemSelect; private optionInherited: FilterItemCheckbox; - private optionOnlyExported: FilterItemCheckbox; - private optionExternals: FilterItemCheckbox; - constructor(options: IComponentOptions) { super(options); - this.optionVisibility = new FilterItemSelect('visibility', 'private'); - this.optionInherited = new FilterItemCheckbox('inherited', true); - this.optionExternals = new FilterItemCheckbox('externals', true); - this.optionOnlyExported = new FilterItemCheckbox('only-exported', false); + this.optionVisibility = new FilterItemSelect("visibility", "private"); + this.optionInherited = new FilterItemCheckbox("inherited", true); + this.optionExternals = new FilterItemCheckbox("externals", true); } - static isSupported(): boolean { try { - return typeof window.localStorage != 'undefined'; + return typeof window.localStorage != "undefined"; } catch (e) { return false; } diff --git a/website/typedoc-theme/assets/js/src/typedoc/components/MenuHighlight.ts b/website/typedoc-theme/assets/js/src/typedoc/components/MenuHighlight.ts index 19402726..1e684281 100644 --- a/website/typedoc-theme/assets/js/src/typedoc/components/MenuHighlight.ts +++ b/website/typedoc-theme/assets/js/src/typedoc/components/MenuHighlight.ts @@ -1,5 +1,5 @@ -import {Component, IComponentOptions} from "../Component"; -import {Viewport} from "../services/Viewport"; +import { Component, IComponentOptions } from "../Component"; +import { Viewport } from "../services/Viewport"; /** * Stored element and position data of a single anchor. @@ -21,7 +21,6 @@ interface IAnchorInfo { position: number; } - /** * Manages the sticky state of the navigation and moves the highlight * to the current navigation item. @@ -37,7 +36,6 @@ export class MenuHighlight extends Component { */ private index: number = -1; - /** * Create a new MenuHighlight instance. * @@ -46,49 +44,56 @@ export class MenuHighlight extends Component { constructor(options: IComponentOptions) { super(options); - Viewport.instance.addEventListener('resize', () => this.onResize()); - Viewport.instance.addEventListener<{ scrollTop: number }>('scroll', e => this.onScroll(e)); + Viewport.instance.addEventListener("resize", () => this.onResize()); + Viewport.instance.addEventListener<{ scrollTop: number }>( + "scroll", + (e) => this.onScroll(e) + ); this.createAnchors(); } - /** * Find all anchors on the current page. */ private createAnchors() { let base = window.location.href; - if (base.indexOf('#') != -1) { - base = base.substr(0, base.indexOf('#')); + if (base.indexOf("#") != -1) { + base = base.substr(0, base.indexOf("#")); } - this.el.querySelectorAll('a').forEach(el => { + this.el.querySelectorAll("a").forEach((el) => { const href = el.href; - if (href.indexOf('#') == -1) return; + if (href.indexOf("#") == -1) return; if (href.substr(0, base.length) != base) return; - const hash = href.substr(href.indexOf('#') + 1); - const anchor = document.querySelector('a.tsd-anchor[name=' + hash + ']'); + const hash = href.substr(href.indexOf("#") + 1); + const anchor = document.querySelector( + "a.tsd-anchor[name=" + hash + "]" + ); const link = el.parentNode; if (!anchor || !link) return; this.anchors.push({ link: link as HTMLElement, anchor: anchor, - position: 0 + position: 0, }); }); this.onResize(); } - /** * Triggered after the viewport was resized. */ private onResize() { let anchor: IAnchorInfo; - for (let index = 0, count = this.anchors.length; index < count; index++) { + for ( + let index = 0, count = this.anchors.length; + index < count; + index++ + ) { anchor = this.anchors[index]; const rect = anchor.anchor.getBoundingClientRect(); anchor.position = rect.top + document.body.scrollTop; @@ -98,15 +103,14 @@ export class MenuHighlight extends Component { return a.position - b.position; }); - const event = new CustomEvent('scroll', { + const event = new CustomEvent("scroll", { detail: { scrollTop: Viewport.instance.scrollTop, - } + }, }); this.onScroll(event); } - /** * Triggered after the viewport was scrolled. * @@ -127,9 +131,11 @@ export class MenuHighlight extends Component { } if (this.index != index) { - if (this.index > -1) this.anchors[this.index].link.classList.remove('focus'); + if (this.index > -1) + this.anchors[this.index].link.classList.remove("focus"); this.index = index; - if (this.index > -1) this.anchors[this.index].link.classList.add('focus'); + if (this.index > -1) + this.anchors[this.index].link.classList.add("focus"); } } } diff --git a/website/typedoc-theme/assets/js/src/typedoc/components/Search.ts b/website/typedoc-theme/assets/js/src/typedoc/components/Search.ts index ecdc6ca2..b799cab2 100644 --- a/website/typedoc-theme/assets/js/src/typedoc/components/Search.ts +++ b/website/typedoc-theme/assets/js/src/typedoc/components/Search.ts @@ -1,5 +1,5 @@ -import {Component, IComponentOptions} from "../Component"; -import {Index} from 'lunr'; +import { debounce } from "../utils/debounce"; +import { Index } from "lunr"; interface IDocument { id: number; @@ -16,312 +16,251 @@ interface IData { index: object; } -/** - * Loading state definitions. - */ -enum SearchLoadingState { - Idle, Loading, Ready, Failure +declare global { + interface Window { + searchData?: IData; + } } -/** - * Provides an indexed search on generated documentation - */ -export class Search extends Component { - /** - * The input field of the search widget. - */ - private field: HTMLInputElement; - - /** - * The result list wrapper. - */ - private results: HTMLElement; +interface SearchState { + base: string; + data?: IData; + index?: Index; +} - /** - * The base url that must be prepended to the indexed urls. - */ - private base: string; +export function initSearch() { + const searchEl = document.getElementById("tsd-search"); + if (!searchEl) return; + + const searchScript = document.getElementById( + "search-script" + ) as HTMLScriptElement | null; + searchEl.classList.add("loading"); + if (searchScript) { + searchScript.addEventListener("error", () => { + searchEl.classList.remove("loading"); + searchEl.classList.add("failure"); + }); + searchScript.addEventListener("load", () => { + searchEl.classList.remove("loading"); + searchEl.classList.add("ready"); + }); + if (window.searchData) { + searchEl.classList.remove("loading"); + } + } - /** - * The current query string. - */ - private query: string = ''; + const field = document.querySelector("#tsd-search-field"); + const results = document.querySelector(".results"); - /** - * The state the search is currently in. - */ - private loadingState: SearchLoadingState = SearchLoadingState.Idle; + if (!field || !results) { + throw new Error( + "The input field or the result list wrapper was not found" + ); + } - /** - * Is the input field focused? - */ - private hasFocus: boolean = false; + let resultClicked = false; + results.addEventListener("mousedown", () => (resultClicked = true)); + results.addEventListener("mouseup", () => { + resultClicked = false; + searchEl.classList.remove("has-focus"); + }); + + field.addEventListener("focus", () => searchEl.classList.add("has-focus")); + field.addEventListener("blur", () => { + if (!resultClicked) { + resultClicked = false; + searchEl.classList.remove("has-focus"); + } + }); - /** - * Should the next key press be prevents? - */ - private preventPress: boolean = false; + const state: SearchState = { + base: searchEl.dataset.base + "/", + }; - /** - * The search data - */ - private data: IData | null = null; + bindEvents(searchEl, results, field, state); +} - /** - * The lunr index used to search the documentation. - */ - private index: Index | null = null; +function bindEvents( + searchEl: HTMLElement, + results: HTMLElement, + field: HTMLInputElement, + state: SearchState +) { + field.addEventListener( + "input", + debounce(() => { + updateResults(searchEl, results, field, state); + }, 200) + ); + + let preventPress = false; + field.addEventListener("keydown", (e) => { + preventPress = true; + if (e.key == "Enter") { + gotoCurrentResult(results, field); + } else if (e.key == "Escape") { + field.blur(); + } else if (e.key == "ArrowUp") { + setCurrentResult(results, -1); + } else if (e.key === "ArrowDown") { + setCurrentResult(results, 1); + } else { + preventPress = false; + } + }); + field.addEventListener("keypress", (e) => { + if (preventPress) e.preventDefault(); + }); /** - * Has a search result been clicked? - * Used to stop the results hiding before a user can fully click on a result. + * Start searching by pressing slash. */ - private resultClicked: boolean = false; - - constructor(options: IComponentOptions) { - super(options); - - const field = document.querySelector('#tsd-search-field'); - const results = document.querySelector('.results'); - - if (!field || !results) { - throw new Error('The input field or the result list wrapper are not found'); + document.body.addEventListener("keydown", (e) => { + if (e.altKey || e.ctrlKey || e.metaKey) return; + if (!field.matches(":focus") && e.key === "/") { + field.focus(); + e.preventDefault(); } + }); +} - this.field = field; - this.results = results; - - this.base = this.el.dataset.base + '/'; +function checkIndex(state: SearchState, searchEl: HTMLElement) { + if (state.index) return; - this.bindEvents(); + if (window.searchData) { + searchEl.classList.remove("loading"); + searchEl.classList.add("ready"); + state.data = window.searchData; + state.index = Index.load(window.searchData.index); } +} - /** - * Lazy load the search index and parse it. - */ - private loadIndex() { - if (this.loadingState != SearchLoadingState.Idle || this.data) return; - - setTimeout(() => { - if (this.loadingState == SearchLoadingState.Idle) { - this.setLoadingState(SearchLoadingState.Loading); - } - }, 500); - - const url = this.el.dataset.index; - if (!url) { - this.setLoadingState(SearchLoadingState.Failure); - return; +function updateResults( + searchEl: HTMLElement, + results: HTMLElement, + query: HTMLInputElement, + state: SearchState +) { + checkIndex(state, searchEl); + // Don't clear results if loading state is not ready, + // because loading or error message can be removed. + if (!state.index || !state.data) return; + + results.textContent = ""; + + const searchText = query.value.trim(); + + // Perform a wildcard search + let res = state.index.search(`*${searchText}*`); + + for (let i = 0, c = Math.min(10, res.length); i < c; i++) { + const row = state.data.rows[Number(res[i].ref)]; + + // Bold the matched part of the query in the search results + let name = boldMatches(row.name, searchText); + if (row.parent) { + name = `${boldMatches( + row.parent, + searchText + )}.${name}`; } - fetch(url) - .then(response => { - if (!response.ok) { - throw new Error('The search index is missing'); - } - - return response.json(); - }) - .then((source: IData) => { - this.data = source; - this.index = Index.load(source.index); - - this.setLoadingState(SearchLoadingState.Ready); - }) - .catch((error) => { - console.error(error); - this.setLoadingState(SearchLoadingState.Failure); - }); - } - + const item = document.createElement("li"); + item.classList.value = row.classes; - /** - * Update the visible state of the search control. - */ - private updateResults() { - // Don't clear results, if loading state is not ready, - // because loading or error message can be removed. - if (this.loadingState != SearchLoadingState.Ready) return; - - this.results.textContent = ''; - if (!this.query || !this.index || !this.data) return; + const anchor = document.createElement("a"); + anchor.href = state.base + row.url; + anchor.classList.add("tsd-kind-icon"); + anchor.innerHTML = name; + item.append(anchor); - // Perform a wildcard search - let res = this.index.search(`*${this.query}*`); + results.appendChild(item); + } +} - // If still no results, try a fuzzy match search - if (res.length === 0) { - res = this.index.search(`*${this.query}~1*`); +/** + * Move the highlight within the result set. + */ +function setCurrentResult(results: HTMLElement, dir: number) { + let current = results.querySelector(".current"); + if (!current) { + current = results.querySelector( + dir == 1 ? "li:first-child" : "li:last-child" + ); + if (current) { + current.classList.add("current"); } - - for (let i = 0, c = Math.min(10, res.length); i < c; i++) { - const row = this.data.rows[Number(res[i].ref)]; - - // Bold the matched part of the query in the search results - let name = row.name.replace(new RegExp(this.query, 'i'), (match: string) => `${match}`); - let parent = row.parent || ''; - parent = parent.replace(new RegExp(this.query, 'i'), (match: string) => `${match}`); - - if (parent) name = '' + parent + '.' + name; - const item = document.createElement('li'); - item.classList.value = row.classes; - item.innerHTML = ` - ${name} - `; - this.results.appendChild(item); + } else { + const rel = + dir == 1 + ? current.nextElementSibling + : current.previousElementSibling; + if (rel) { + current.classList.remove("current"); + rel.classList.add("current"); } } +} +/** + * Navigate to the highlighted result. + */ +function gotoCurrentResult(results: HTMLElement, field: HTMLInputElement) { + let current = results.querySelector(".current"); - /** - * Set the loading state and update the visual state accordingly. - */ - private setLoadingState(value: SearchLoadingState) { - if (this.loadingState == value) return; - - this.el.classList.remove(SearchLoadingState[this.loadingState].toLowerCase()); - this.loadingState = value; - this.el.classList.add(SearchLoadingState[this.loadingState].toLowerCase()); - - this.updateResults(); + if (!current) { + current = results.querySelector("li:first-child"); } - - /** - * Set the focus state and update the visual state accordingly. - */ - private setHasFocus(value: boolean) { - if (this.hasFocus == value) return; - this.hasFocus = value; - this.el.classList.toggle('has-focus'); - - if (!value) { - this.field.value = this.query; - } else { - this.setQuery(''); - this.field.value = ''; + if (current) { + const link = current.querySelector("a"); + if (link) { + window.location.href = link.href; } + field.blur(); } +} - - /** - * Set the query string and update the results. - */ - private setQuery(value: string) { - this.query = value.trim(); - this.updateResults(); +function boldMatches(text: string, search: string) { + if (search === "") { + return text; } - - /** - * Move the highlight within the result set. - */ - private setCurrentResult(dir: number) { - let current = this.results.querySelector('.current'); - if (!current) { - current = this.results.querySelector(dir == 1 ? 'li:first-child' : 'li:last-child'); - if (current) { - current.classList.add('current') - } - } else { - const rel = dir == 1 ? current.nextElementSibling : current.previousElementSibling; - if (rel) { - current.classList.remove('current'); - rel.classList.add('current'); - } - } + const lowerText = text.toLocaleLowerCase(); + const lowerSearch = search.toLocaleLowerCase(); + + const parts = []; + let lastIndex = 0; + let index = lowerText.indexOf(lowerSearch); + while (index != -1) { + parts.push( + escapeHtml(text.substring(lastIndex, index)), + `${escapeHtml( + text.substring(index, index + lowerSearch.length) + )}` + ); + + lastIndex = index + lowerSearch.length; + index = lowerText.indexOf(lowerSearch, lastIndex); } + parts.push(escapeHtml(text.substring(lastIndex))); - /** - * Navigate to the highlighted result. - */ - private gotoCurrentResult() { - let current = this.results.querySelector('.current'); - - if (!current) { - current = this.results.querySelector('li:first-child'); - } - - if (current) { - const link = current.querySelector('a'); - if (link) { - window.location.href = link.href; - } - this.field.blur(); - } - } - - /** - * Bind events on result list wrapper, input field and document body. - */ - private bindEvents() { - /** - * Intercept mousedown and mouseup events so we can correctly - * handle clicking on search results. - */ - this.results.addEventListener('mousedown', () => { - this.resultClicked = true; - }); - this.results.addEventListener('mouseup', () => { - this.resultClicked = false; - this.setHasFocus(false); - }); - - - /** - * Bind all required events on the input field. - */ - this.field.addEventListener('focusin', () => { - this.setHasFocus(true); - this.loadIndex(); - }); - this.field.addEventListener('focusout', () => { - // If the user just clicked on a search result, then - // don't lose the focus straight away, as this prevents - // them from clicking the result and following the link - if (this.resultClicked) { - this.resultClicked = false; - return; - } - - setTimeout(() => this.setHasFocus(false), 100); - }); - this.field.addEventListener('input', () => { - this.setQuery(this.field.value); - }); - this.field.addEventListener('keydown', (e) => { - if (e.keyCode == 13 || e.keyCode == 27 || e.keyCode == 38 || e.keyCode == 40) { - this.preventPress = true; - e.preventDefault(); - - if (e.keyCode == 13) { - this.gotoCurrentResult(); - } else if (e.keyCode == 27) { - this.field.blur(); - } else if (e.keyCode == 38) { - this.setCurrentResult(-1); - } else if (e.keyCode == 40) { - this.setCurrentResult(1); - } - } else { - this.preventPress = false; - } - }); - this.field.addEventListener('keypress', (e) => { - if (this.preventPress) e.preventDefault(); - }); - - - /** - * Start searching by pressing a key on the body. - */ - document.body.addEventListener('keydown', e => { - if (e.altKey || e.ctrlKey || e.metaKey) return; - if (!this.hasFocus && e.keyCode > 47 && e.keyCode < 112) { - this.field.focus(); - } - }); - } + return parts.join(""); } +const SPECIAL_HTML = { + "&": "&", + "<": "<", + ">": ">", + "'": "'", + '"': """, +} as const; + +function escapeHtml(text: string) { + return text.replace( + /[&<>"'"]/g, + (match) => SPECIAL_HTML[match as keyof typeof SPECIAL_HTML] + ); +} diff --git a/website/typedoc-theme/assets/js/src/typedoc/components/Signature.ts b/website/typedoc-theme/assets/js/src/typedoc/components/Signature.ts index a6ea8c4e..1682c82f 100644 --- a/website/typedoc-theme/assets/js/src/typedoc/components/Signature.ts +++ b/website/typedoc-theme/assets/js/src/typedoc/components/Signature.ts @@ -1,5 +1,5 @@ -import {Component, IComponentOptions} from "../Component"; -import {Viewport} from "../services/Viewport"; +import { Component, IComponentOptions } from "../Component"; +import { Viewport } from "../services/Viewport"; /** * Holds a signature and its description. @@ -15,7 +15,6 @@ class SignatureGroup { */ description: Element; - /** * Create a new SignatureGroup instance. * @@ -27,7 +26,6 @@ class SignatureGroup { this.description = description; } - /** * Add the given class to all elements of the group. * @@ -39,7 +37,6 @@ class SignatureGroup { return this; } - /** * Remove the given class from all elements of the group. * @@ -52,7 +49,6 @@ class SignatureGroup { } } - /** * Controls the tab like behaviour of methods and functions with multiple signatures. */ @@ -72,7 +68,6 @@ export class Signature extends Component { */ private index: number = -1; - /** * Create a new Signature instance. * @@ -84,17 +79,20 @@ export class Signature extends Component { this.createGroups(); if (this.container) { - this.el.classList.add('active'); - Array.from(this.el.children).forEach(signature => { - signature.addEventListener('touchstart', (event) => this.onClick(event)); - signature.addEventListener('click', (event) => this.onClick(event)); + this.el.classList.add("active"); + Array.from(this.el.children).forEach((signature) => { + signature.addEventListener("touchstart", (event) => + this.onClick(event) + ); + signature.addEventListener("click", (event) => + this.onClick(event) + ); }); - this.container.classList.add('active'); + this.container.classList.add("active"); this.setIndex(0); } } - /** * Set the index of the active signature. * @@ -109,24 +107,23 @@ export class Signature extends Component { if (this.index > -1) { const from = this.groups[this.index]; - from.removeClass('current').addClass('fade-out'); - to.addClass('current'); - to.addClass('fade-in'); + from.removeClass("current").addClass("fade-out"); + to.addClass("current"); + to.addClass("fade-in"); Viewport.instance.triggerResize(); setTimeout(() => { - from.removeClass('fade-out'); - to.removeClass('fade-in'); + from.removeClass("fade-out"); + to.removeClass("fade-in"); }, 300); } else { - to.addClass('current'); + to.addClass("current"); Viewport.instance.triggerResize(); } this.index = index; } - /** * Find all signature/description groups. */ @@ -139,11 +136,12 @@ export class Signature extends Component { this.groups = []; for (let index = 0; index < signatures.length; index++) { - this.groups.push(new SignatureGroup(signatures[index], descriptions[index])); + this.groups.push( + new SignatureGroup(signatures[index], descriptions[index]) + ); } } - /** * Triggered when the user clicks onto a signature header. * @@ -157,4 +155,3 @@ export class Signature extends Component { }); } } - diff --git a/website/typedoc-theme/assets/js/src/typedoc/components/Toggle.ts b/website/typedoc-theme/assets/js/src/typedoc/components/Toggle.ts index 1141542b..79b510cd 100644 --- a/website/typedoc-theme/assets/js/src/typedoc/components/Toggle.ts +++ b/website/typedoc-theme/assets/js/src/typedoc/components/Toggle.ts @@ -1,5 +1,5 @@ -import {Component, IComponentOptions} from "../Component"; -import {hasPointerMoved, pointerDown, pointerUp} from "../utils/pointer"; +import { Component, IComponentOptions } from "../Component"; +import { hasPointerMoved, pointerDown, pointerUp } from "../utils/pointer"; export class Toggle extends Component { active?: boolean; @@ -9,23 +9,34 @@ export class Toggle extends Component { constructor(options: IComponentOptions) { super(options); - this.className = this.el.dataset.toggle || ''; + this.className = this.el.dataset.toggle || ""; this.el.addEventListener(pointerUp, (e) => this.onPointerUp(e)); - this.el.addEventListener('click', (e) => e.preventDefault()); - document.addEventListener(pointerDown, (e) => this.onDocumentPointerDown(e)); - document.addEventListener(pointerUp, (e) => this.onDocumentPointerUp(e)); + this.el.addEventListener("click", (e) => e.preventDefault()); + document.addEventListener(pointerDown, (e) => + this.onDocumentPointerDown(e) + ); + document.addEventListener(pointerUp, (e) => + this.onDocumentPointerUp(e) + ); } setActive(value: boolean) { if (this.active == value) return; this.active = value; - document.documentElement.classList.toggle('has-' + this.className, value); - this.el.classList.toggle('active', value); + document.documentElement.classList.toggle( + "has-" + this.className, + value + ); + this.el.classList.toggle("active", value); - const transition = (this.active ? 'to-has-' : 'from-has-') + this.className; + const transition = + (this.active ? "to-has-" : "from-has-") + this.className; document.documentElement.classList.add(transition); - setTimeout(() => document.documentElement.classList.remove(transition), 500); + setTimeout( + () => document.documentElement.classList.remove(transition), + 500 + ); } onPointerUp(event: Event) { @@ -36,7 +47,11 @@ export class Toggle extends Component { onDocumentPointerDown(e: Event) { if (this.active) { - if ((e.target as HTMLElement).closest('.col-menu, .tsd-filter-group')) { + if ( + (e.target as HTMLElement).closest( + ".col-menu, .tsd-filter-group" + ) + ) { return; } @@ -47,12 +62,12 @@ export class Toggle extends Component { onDocumentPointerUp(e: Event) { if (hasPointerMoved) return; if (this.active) { - if ((e.target as HTMLElement).closest('.col-menu')) { - const link = (e.target as HTMLElement).closest('a'); + if ((e.target as HTMLElement).closest(".col-menu")) { + const link = (e.target as HTMLElement).closest("a"); if (link) { let href = window.location.href; - if (href.indexOf('#') != -1) { - href = href.substr(0, href.indexOf('#')); + if (href.indexOf("#") != -1) { + href = href.substr(0, href.indexOf("#")); } if (link.href.substr(0, href.length) == href) { setTimeout(() => this.setActive(false), 250); @@ -62,4 +77,3 @@ export class Toggle extends Component { } } } - diff --git a/website/typedoc-theme/assets/js/src/typedoc/services/Viewport.ts b/website/typedoc-theme/assets/js/src/typedoc/services/Viewport.ts index 83ecc448..32d0bffa 100644 --- a/website/typedoc-theme/assets/js/src/typedoc/services/Viewport.ts +++ b/website/typedoc-theme/assets/js/src/typedoc/services/Viewport.ts @@ -1,11 +1,11 @@ -import {EventTarget} from "../EventTarget"; -import {throttle} from "../utils/trottle"; +import { EventTarget } from "../EventTarget"; +import { throttle } from "../utils/trottle"; /** * A global service that monitors the window size and scroll position. */ export class Viewport extends EventTarget { - public static readonly instance = new Viewport() + public static readonly instance = new Viewport(); /** * The current scroll position. @@ -42,39 +42,46 @@ export class Viewport extends EventTarget { */ secondaryNav: HTMLElement; - /** * Create new Viewport instance. */ constructor() { super(); - this.toolbar = document.querySelector('.tsd-page-toolbar'); - this.secondaryNav = document.querySelector('.tsd-navigation.secondary'); - - window.addEventListener('scroll', throttle(() => this.onScroll(), 10)); - window.addEventListener('resize', throttle(() => this.onResize(), 10)); + this.toolbar = ( + document.querySelector(".tsd-page-toolbar") + ); + this.secondaryNav = ( + document.querySelector(".tsd-navigation.secondary") + ); + + window.addEventListener( + "scroll", + throttle(() => this.onScroll(), 10) + ); + window.addEventListener( + "resize", + throttle(() => this.onResize(), 10) + ); this.onResize(); this.onScroll(); } - /** * Trigger a resize event. */ triggerResize() { - const event = new CustomEvent('resize', { + const event = new CustomEvent("resize", { detail: { width: this.width, height: this.height, - } + }, }); this.dispatchEvent(event); } - /** * Triggered when the size of the window has changed. */ @@ -82,34 +89,32 @@ export class Viewport extends EventTarget { this.width = window.innerWidth || 0; this.height = window.innerHeight || 0; - const event = new CustomEvent('resize', { + const event = new CustomEvent("resize", { detail: { width: this.width, height: this.height, - } + }, }); this.dispatchEvent(event); } - /** * Triggered when the user scrolled the viewport. */ onScroll() { this.scrollTop = window.scrollY || 0; - const event = new CustomEvent('scroll', { + const event = new CustomEvent("scroll", { detail: { scrollTop: this.scrollTop, - } + }, }); this.dispatchEvent(event); this.hideShowToolbar(); } - /** * Handle hiding/showing of the toolbar. */ @@ -117,10 +122,9 @@ export class Viewport extends EventTarget { const isShown = this.showToolbar; this.showToolbar = this.lastY >= this.scrollTop || this.scrollTop === 0; if (isShown !== this.showToolbar) { - this.toolbar.classList.toggle('tsd-page-toolbar--hide'); - this.secondaryNav.classList.toggle('tsd-navigation--toolbar-hide'); + this.toolbar.classList.toggle("tsd-page-toolbar--hide"); + this.secondaryNav.classList.toggle("tsd-navigation--toolbar-hide"); } this.lastY = this.scrollTop; } } - diff --git a/website/typedoc-theme/assets/js/src/typedoc/utils/debounce.ts b/website/typedoc-theme/assets/js/src/typedoc/utils/debounce.ts new file mode 100644 index 00000000..9d984d1d --- /dev/null +++ b/website/typedoc-theme/assets/js/src/typedoc/utils/debounce.ts @@ -0,0 +1,7 @@ +export const debounce = (fn: Function, wait: number = 100) => { + let timeout: ReturnType; + return (...args: any[]) => { + clearTimeout(timeout) + timeout = setTimeout(() => fn(args), wait) + } +} diff --git a/website/typedoc-theme/assets/js/src/typedoc/utils/pointer.ts b/website/typedoc-theme/assets/js/src/typedoc/utils/pointer.ts index 80b0fb11..b1d88bd7 100644 --- a/website/typedoc-theme/assets/js/src/typedoc/utils/pointer.ts +++ b/website/typedoc-theme/assets/js/src/typedoc/utils/pointer.ts @@ -9,22 +9,22 @@ export interface Point { /** * Event name of the pointer down event. */ -export let pointerDown: string = 'mousedown'; +export let pointerDown: string = "mousedown"; /** * Event name of the pointer move event. */ -export let pointerMove: string = 'mousemove'; +export let pointerMove: string = "mousemove"; /** * Event name of the pointer up event. */ -export let pointerUp: string = 'mouseup'; +export let pointerUp: string = "mouseup"; /** * Position the pointer was pressed at. */ -export const pointerDownPosition: Point = {x: 0, y: 0}; +export const pointerDownPosition: Point = { x: 0, y: 0 }; /** * Should the next click on the document be supressed? @@ -49,21 +49,25 @@ export let hasPointerMoved: boolean = false; /** * Is the user agent a mobile agent? */ -export const isMobile: boolean = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); -document.documentElement.classList.add(isMobile ? 'is-mobile' : 'not-mobile'); +export const isMobile: boolean = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( + navigator.userAgent +); +document.documentElement.classList.add(isMobile ? "is-mobile" : "not-mobile"); - -if (isMobile && 'ontouchstart' in document.documentElement) { +if (isMobile && "ontouchstart" in document.documentElement) { isPointerTouch = true; - pointerDown = 'touchstart'; - pointerMove = 'touchmove'; - pointerUp = 'touchend'; + pointerDown = "touchstart"; + pointerMove = "touchmove"; + pointerUp = "touchend"; } document.addEventListener(pointerDown, (e) => { isPointerDown = true; hasPointerMoved = false; - const t = (pointerDown == 'touchstart' ? (e as TouchEvent).targetTouches[0] : (e as MouseEvent)); + const t = + pointerDown == "touchstart" + ? (e as TouchEvent).targetTouches[0] + : (e as MouseEvent); pointerDownPosition.y = t.pageY || 0; pointerDownPosition.x = t.pageX || 0; }); @@ -71,10 +75,13 @@ document.addEventListener(pointerDown, (e) => { document.addEventListener(pointerMove, (e) => { if (!isPointerDown) return; if (!hasPointerMoved) { - const t = (pointerDown == 'touchstart' ? (e as TouchEvent).targetTouches[0] : (e as MouseEvent)); + const t = + pointerDown == "touchstart" + ? (e as TouchEvent).targetTouches[0] + : (e as MouseEvent); const x = pointerDownPosition.x - (t.pageX || 0); const y = pointerDownPosition.y - (t.pageY || 0); - hasPointerMoved = (Math.sqrt(x * x + y * y) > 10); + hasPointerMoved = Math.sqrt(x * x + y * y) > 10; } }); @@ -82,7 +89,7 @@ document.addEventListener(pointerUp, () => { isPointerDown = false; }); -document.addEventListener('click', (e) => { +document.addEventListener("click", (e) => { if (preventNextClick) { e.preventDefault(); e.stopImmediatePropagation(); diff --git a/website/typedoc-theme/assets/js/src/typedoc/utils/trottle.ts b/website/typedoc-theme/assets/js/src/typedoc/utils/trottle.ts index b3cb5bf5..421c3780 100644 --- a/website/typedoc-theme/assets/js/src/typedoc/utils/trottle.ts +++ b/website/typedoc-theme/assets/js/src/typedoc/utils/trottle.ts @@ -1,9 +1,12 @@ -export const throttle = (fn: (...args: A) => void, wait = 100) => { +export const throttle = ( + fn: (...args: A) => void, + wait = 100 +) => { let time = Date.now(); return (...args: A) => { - if ((time + wait - Date.now()) < 0) { + if (time + wait - Date.now() < 0) { fn(...args); time = Date.now(); } - } -} + }; +}; diff --git a/website/typedoc-theme/layouts/default.hbs b/website/typedoc-theme/layouts/default.hbs index 377f17be..87722a78 100644 --- a/website/typedoc-theme/layouts/default.hbs +++ b/website/typedoc-theme/layouts/default.hbs @@ -8,6 +8,7 @@ + diff --git a/website/typedoc-theme/partials/breadcrumb.hbs b/website/typedoc-theme/partials/breadcrumb.hbs index 31974183..ad63bac7 100644 --- a/website/typedoc-theme/partials/breadcrumb.hbs +++ b/website/typedoc-theme/partials/breadcrumb.hbs @@ -10,7 +10,7 @@ {{else}} {{#if url}}
  • - Globals + {{ name }}
  • {{/if}} -{{/if}} \ No newline at end of file +{{/if}} diff --git a/website/typedoc-theme/partials/header.hbs b/website/typedoc-theme/partials/header.hbs index 441e50db..a25a1985 100644 --- a/website/typedoc-theme/partials/header.hbs +++ b/website/typedoc-theme/partials/header.hbs @@ -40,11 +40,6 @@ {{/unless}} - - {{#unless settings.excludeNotExported}} - - - {{/unless}} @@ -56,12 +51,16 @@
    -
      - {{#with model}}{{> breadcrumb}}{{/with}} -
    + {{#if model.parent}} {{! Don't show breadcrumbs on main project page, it is the root page. !}} +
      + {{#with model}}{{> breadcrumb}}{{/with}} +
    + {{/if}} {{!--MONACO_CHANGE

    {{#compact}} - {{model.kindString}}  + {{#ifCond model.kindString "!==" "Project" }} + {{model.kindString}}  + {{/ifCond}} {{model.name}} {{#if model.typeParameters}} < diff --git a/website/typedoc-theme/partials/member.sources.hbs b/website/typedoc-theme/partials/member.sources.hbs index 6774d04a..b027ae78 100644 --- a/website/typedoc-theme/partials/member.sources.hbs +++ b/website/typedoc-theme/partials/member.sources.hbs @@ -17,7 +17,7 @@ {{!--MONACO_CHANGE
  • Defined in {{fileName}}:{{line}}
  • MONACO_CHANGE--}} -
  • Defined in {{fileName}}:{{line}}
  • +
  • Defined in {{fileName}}:{{line}}
  • {{/if}} {{/each}} diff --git a/website/typedoc-theme/partials/parameter.hbs b/website/typedoc-theme/partials/parameter.hbs index b4e9ac6f..d732ae29 100644 --- a/website/typedoc-theme/partials/parameter.hbs +++ b/website/typedoc-theme/partials/parameter.hbs @@ -39,8 +39,8 @@ {{/if}} {{#each children}} -
  • - {{#if signatures}} + {{#if signatures}} +
  • {{#compact}} {{#if flags.isRest}}...{{/if}} {{{wbr name}}} @@ -52,18 +52,22 @@ {{/compact}}
    {{> member.signatures}} - {{else}} +
  • + {{else}}{{#if type}} {{! standard type }} +
  • {{#compact}} {{#each flags}} {{this}}  {{/each}} {{#if flags.isRest}}...{{/if}} - {{{wbr name}}} - - {{#if flags.isOptional}}?{{/if}} - :  - - {{#with type}}{{>type}}{{/with}} + {{#with type}} + {{{wbr ../name}}} + + {{#if ../flags.isOptional}}?{{/if}} + :  + + {{>type}} + {{/with}} {{/compact}}
    {{> comment}} @@ -77,7 +81,52 @@ {{> parameter}} {{/with}} {{/if}} - {{/if}} -
  • + + {{else}} {{! getter/setter }} + {{#with getSignature}} {{! getter }} +
  • +
    {{#compact}} + {{#each flags}} + {{this}}  + {{/each}} + get  + {{{wbr ../name}}} + ():  + {{#with type}} + {{> type}} + {{/with}} + {{/compact}}
    + + {{> comment }} +
  • + {{/with}} + {{#with setSignature}} {{! setter }} +
  • +
    {{#compact}} + {{#each flags}} + {{this}}  + {{/each}} + set  + {{{wbr ../name}}} + ( + {{#each parameters}} + {{name}} + : + {{#with type}} + {{> type}} + {{else}} + any + {{/with}} + {{/each}} + ):  + {{#with type}} + {{> type}} + {{/with}} + {{/compact}}
    + + {{> comment }} +
  • + {{/with}} + {{/if}}{{/if}} {{/each}} diff --git a/website/typedoc-theme/partials/type.hbs b/website/typedoc-theme/partials/type.hbs index 5318b7e6..1e19959a 100644 --- a/website/typedoc-theme/partials/type.hbs +++ b/website/typedoc-theme/partials/type.hbs @@ -73,9 +73,61 @@ if an inner type may result in invalid output without them. For example: {{name}} {{/inline}} +{{#*inline 'literal'}} + {{stringify value}} +{{/inline}} + +{{#*inline 'mapped'}} + { + {{#ifCond readonlyModifier '===' '+'}} + readonly + {{else}} + {{#ifCond readonlyModifier '===' '-'}} + -readonly + {{/ifCond}} + {{/ifCond}} + + [ + {{parameter}} + in + + {{#with parameterType}} + {{>type}} + {{/with}} + + {{#with nameType}} + as + {{>type}} + {{/with}} + + ] + {{#ifCond readonlyModifier '===' '+'}} + ?: + {{else}} + {{#ifCond readonlyModifier '===' '-'}} + -?: + {{else}} + : + {{/ifCond}} + {{/ifCond}} + + {{#with templateType}} + {{>type}} + {{/with}} + + } +{{/inline}} + +{{#*inline 'optional'}} + {{#with elementType}} + {{> type}} + {{/with}} + ? +{{/inline}} + {{#*inline 'predicate'}} {{#if asserts}} - asserts + asserts {{/if}} {{name}} {{#if targetType}} @@ -94,13 +146,13 @@ if an inner type may result in invalid output without them. For example: {{/inline}} {{#*inline 'reference'}} - {{#if reflection}} - - {{reflection.name}} + {{#with getReflection }} + + {{name}} {{else}} {{name}} - {{/if}} + {{/with}} {{#if typeArguments}} < {{#each typeArguments}} @@ -120,17 +172,56 @@ if an inner type may result in invalid output without them. For example: {{#unless @first}} ; {{/unless}} - {{name}} - {{#if flags.isOptional }} - ?: + + {{#if getSignature}} + {{#if setSignature}} + {{name}} + : + {{#with getSignature.type}} + {{> type}} + {{else}} + any + {{/with}} + {{else}} + get + {{name}} + (): + {{#with getSignature.type}} + {{> type}} + {{else}} + any + {{/with}} + {{/if}} {{else}} - : + {{#if setSignature}} + set + {{name}} + ( + {{! Rather hacky to use each here... but we know there is exactly one. }} + {{#each setSignature.parameters}} + {{name}} + : + {{#with type}} + {{> type}} + {{else}} + any + {{/with}} + {{/each}} + ) + {{else}} + {{name}} + {{#if flags.isOptional }} + ?: + {{else}} + : + {{/if}} + {{#with type}} + {{> type}} + {{else}} + any + {{/with}} + {{/if}} {{/if}} - {{#with type}} - {{> type}} - {{else}} - any - {{/with}} {{/each}} } {{else if declaration.signatures}} @@ -159,8 +250,11 @@ if an inner type may result in invalid output without them. For example: {{/if}} {{/inline}} -{{#*inline 'stringLiteral'}} - "{{value}}" +{{#*inline 'rest'}} + ... + {{#with elementType}} + {{> type}} + {{/with}} {{/inline}} {{#*inline 'tuple'}} @@ -174,6 +268,24 @@ if an inner type may result in invalid output without them. For example: ] {{/inline}} +{{#*inline 'template-literal'}} + ` + {{#if head}} + {{head}} + {{/if}} + {{#each tail}} + ${ + {{#with this.[0]}} + {{>type}} + {{/with}} + } + {{#if this.[1]}} + {{this.[1]}} + {{/if}} + {{/each}} + ` +{{/inline}} + {{#*inline 'typeOperator'}} {{operator}} {{#with target}}