umberto 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +2 -2
- package/LICENSE.md +1 -1
- package/hexo-shim.js +1 -1
- package/package.json +2 -1
- package/scripts/filter/after-post-render/basepath-replacer.js +1 -1
- package/scripts/filter/after-post-render/fix-code-samples.js +1 -1
- package/scripts/filter/after-post-render/gather-guides.js +1 -1
- package/scripts/filter/after-post-render/img-linker.js +1 -1
- package/scripts/filter/after-post-render/import-guide.js +1 -1
- package/scripts/filter/after-post-render/insert-error-codes.js +1 -1
- package/scripts/filter/after-post-render/linker.js +1 -1
- package/scripts/filter/after-post-render/parseicontag.js +1 -1
- package/scripts/filter/after-post-render/process-variables.js +1 -1
- package/scripts/filter/after-post-render/snippets.js +1 -1
- package/scripts/filter/after-post-render/time-end.js +1 -1
- package/scripts/filter/after-post-render/time-start.js +1 -1
- package/scripts/filter/after-post-render/validate-after-render.js +1 -1
- package/scripts/filter/before-post-render/add-project-info-to-page.js +1 -1
- package/scripts/filter/before-post-render/add-repo-url.js +1 -1
- package/scripts/filter/before-post-render/change-output-path.js +1 -1
- package/scripts/filter/before-post-render/escape-special-characters.js +1 -1
- package/scripts/filter/before-post-render/execute-and-insert-function-results.js +1 -1
- package/scripts/filter/before-post-render/infobox.js +1 -1
- package/scripts/filter/before-post-render/insertchangelog.js +1 -1
- package/scripts/filter/before-post-render/replace-macros.js +1 -1
- package/scripts/filter/before-post-render/set-layout.js +1 -1
- package/scripts/filter/before-post-render/validate-page-data.js +1 -1
- package/scripts/helper/find-main-category-page.js +1 -1
- package/scripts/helper/get-pages-for-nav-tree.js +1 -1
- package/scripts/helper/mark-empty-categories.js +1 -1
- package/scripts/helper/normalize-badges.js +1 -1
- package/scripts/helper/u-split-to-title-and-content.js +1 -1
- package/scripts/helper/u-toc.js +1 -1
- package/scripts/utils/execute-and-insert-function-results.js +1 -1
- package/scripts/utils/findmaincategorypage.js +1 -1
- package/scripts/utils/getreportissuewidgeturl.js +1 -1
- package/scripts/utils/insertchangelog.js +1 -1
- package/scripts/utils/normalizebadges.js +1 -1
- package/scripts/utils/parseicontag.js +1 -1
- package/scripts/utils/parselinks.js +61 -41
- package/scripts/utils/shoulddisplaynewindicator.js +1 -1
- package/scripts/utils/transforminfobox.js +1 -1
- package/scripts-dev/postinstall.js +1 -1
- package/src/api-builder/api-builder.js +28 -8
- package/src/api-builder/classes/description-parser.js +79 -63
- package/src/api-builder/classes/doc-data-factory.js +58 -5
- package/src/api-builder/classes/file-name-manager.js +1 -1
- package/src/api-builder/classes/html-file.js +1 -1
- package/src/api-builder/classes/navigation-tree.js +1 -1
- package/src/api-builder/classes/tree-node.js +1 -1
- package/src/api-builder/utils/findtargetdoclet.js +84 -0
- package/src/api-builder/utils/utils.js +41 -0
- package/src/data-converter/converters/jsdoc2umberto.js +8 -1
- package/src/data-converter/converters/jsduck2umberto.js +1 -1
- package/src/data-converter/converters/typedoc/abstractparser.js +364 -0
- package/src/data-converter/converters/typedoc/accessorparser.js +64 -0
- package/src/data-converter/converters/typedoc/classparser.js +49 -0
- package/src/data-converter/converters/typedoc/constantparser.js +45 -0
- package/src/data-converter/converters/typedoc/constructorparser.js +34 -0
- package/src/data-converter/converters/typedoc/errorparser.js +44 -0
- package/src/data-converter/converters/typedoc/eventparser.js +57 -0
- package/src/data-converter/converters/typedoc/functionparser.js +61 -0
- package/src/data-converter/converters/typedoc/interfaceparser.js +46 -0
- package/src/data-converter/converters/typedoc/methodparser.js +63 -0
- package/src/data-converter/converters/typedoc/moduleparser.js +31 -0
- package/src/data-converter/converters/typedoc/propertyparser.js +74 -0
- package/src/data-converter/converters/typedoc/typedoc.ts +297 -0
- package/src/data-converter/converters/typedoc/typedocconverter.js +742 -0
- package/src/data-converter/converters/typedoc/typeparser.js +71 -0
- package/src/data-converter/converters/typedoc2umberto.js +52 -0
- package/src/data-converter/data-collection.js +1 -1
- package/src/data-converter/data-provider.js +4 -2
- package/src/data-converter/doclet-collection.js +14 -2
- package/src/data-converter/middlewares/relation-fixer.js +1 -1
- package/src/helpers/capitalize.js +1 -1
- package/src/helpers/copy-file.js +1 -1
- package/src/helpers/create-filtering-data-attribs.js +1 -1
- package/src/helpers/doc-formats.js +3 -2
- package/src/helpers/escape-longname.js +1 -1
- package/src/helpers/extract-longname.js +1 -1
- package/src/helpers/get-api-infobox-tooltip.js +1 -1
- package/src/helpers/get-docsearch-config.js +1 -1
- package/src/helpers/get-file-patterns-to-process.js +1 -1
- package/src/helpers/get-short-module-path.js +1 -1
- package/src/helpers/github-url.js +1 -1
- package/src/helpers/glob-to-regexp.js +1 -1
- package/src/helpers/html-safe.js +1 -1
- package/src/helpers/is-non-empty-array.js +1 -1
- package/src/helpers/snippets.js +1 -1
- package/src/helpers/split-longname.js +101 -8
- package/src/hexo/filter/extend-config.js +1 -1
- package/src/hexo/filter/project-locals.js +1 -1
- package/src/hexo/get-repo-urls.js +1 -1
- package/src/hexo/helper/get-page-group.js +1 -1
- package/src/hexo/project-globals.js +1 -1
- package/src/hexo-manager.js +1 -1
- package/src/index.js +1 -1
- package/src/sdk-builder/get-sdk-sources.js +1 -1
- package/src/sdk-builder/sdk-builder.js +1 -1
- package/src/tasks/build-api-docs.js +4 -4
- package/src/tasks/build-documentation.js +3 -3
- package/src/tasks/build-sdk.js +1 -1
- package/src/tasks/build-snippets.js +1 -1
- package/src/tasks/cache-files.js +1 -1
- package/src/tasks/compile-sass.js +1 -1
- package/src/tasks/copy-assets.js +1 -1
- package/src/tasks/copy-files.js +1 -1
- package/src/tasks/copy-project-docs.js +1 -1
- package/src/tasks/copy-project-icons.js +1 -1
- package/src/tasks/create-redirect-page.js +1 -1
- package/src/tasks/create-sitemap.js +1 -1
- package/src/tasks/create-sym-links.js +1 -1
- package/src/tasks/execute-hooks.js +1 -1
- package/src/tasks/get-extra-files.js +1 -1
- package/src/tasks/get-hexo-config.js +1 -1
- package/src/tasks/get-main-config.js +1 -1
- package/src/tasks/get-project-config.js +3 -3
- package/src/tasks/macro-replacer.js +1 -1
- package/src/tasks/overwrite-api-guides.js +1 -1
- package/src/tasks/read-doc-sources.js +1 -1
- package/src/tasks/run-webpack.js +1 -1
- package/src/tasks/validate-html-w3c.js +1 -1
- package/src/tasks/validate-links.js +1 -1
- package/src/tasks/watcher.js +1 -1
- package/src/tasks/write-html-files.js +1 -1
- package/src/template/template-collection.js +1 -1
- package/themes/umberto/layout/_api-docs/_mixin/_api-see-source.pug +2 -1
- package/themes/umberto/layout/_api-docs/_mixin/_class-item.pug +0 -1
- package/themes/umberto/layout/_api-docs/_mixin/_dev-names.pug +9 -3
- package/themes/umberto/layout/_api-docs/_mixin/_fires-item.pug +2 -2
- package/themes/umberto/layout/_api-docs/_mixin/_hierarchy-item.pug +2 -2
- package/themes/umberto/layout/_api-docs/_mixin/_link-or-text.pug +40 -41
- package/themes/umberto/layout/_api-docs/_mixin/_method.pug +8 -2
- package/themes/umberto/layout/_api-docs/_mixin/_property.pug +1 -1
- package/themes/umberto/layout/_api-docs/_mixin/_related.pug +1 -1
- package/themes/umberto/layout/_api-docs/_mixin/_sidebox-list-item.pug +1 -1
- package/themes/umberto/layout/_api-docs/_mixin/_type.pug +175 -9
- package/themes/umberto/layout/_api-docs/_mixin/type-parameter.pug +18 -0
- package/themes/umberto/layout/_api-docs/_partial/filter.pug +16 -4
- package/themes/umberto/layout/_api-docs/_partial/type-parameters.pug +26 -0
- package/themes/umberto/layout/_api-docs/api-base.pug +2 -0
- package/themes/umberto/src/css/_api-content.scss +1 -1
- package/themes/umberto/src/css/_api-info-box.scss +1 -1
- package/themes/umberto/src/css/_api-props-filter.scss +1 -1
- package/themes/umberto/src/css/_api-see-source.scss +1 -1
- package/themes/umberto/src/css/_api-subheader.scss +1 -1
- package/themes/umberto/src/css/_api-tree.scss +1 -1
- package/themes/umberto/src/css/_badge.scss +1 -1
- package/themes/umberto/src/css/_collapsinglist.scss +1 -1
- package/themes/umberto/src/css/_content.scss +3 -2
- package/themes/umberto/src/css/_docsearch.scss +1 -1
- package/themes/umberto/src/css/_dropdown.scss +1 -1
- package/themes/umberto/src/css/_editor-icon.scss +1 -1
- package/themes/umberto/src/css/_feedback-widget.scss +1 -1
- package/themes/umberto/src/css/_footer.scss +1 -1
- package/themes/umberto/src/css/_formatted.scss +1 -1
- package/themes/umberto/src/css/_guide-content.scss +1 -1
- package/themes/umberto/src/css/_guide-sdk-tree.scss +1 -1
- package/themes/umberto/src/css/_loading-spinner.scss +1 -1
- package/themes/umberto/src/css/_main.scss +1 -1
- package/themes/umberto/src/css/_navigation.scss +1 -1
- package/themes/umberto/src/css/_notice.scss +1 -1
- package/themes/umberto/src/css/_print.scss +1 -1
- package/themes/umberto/src/css/_prism.scss +1 -1
- package/themes/umberto/src/css/_rwd-breadcrumbs.scss +1 -1
- package/themes/umberto/src/css/_rwd-menu.scss +1 -1
- package/themes/umberto/src/css/_secondary-navigation.scss +1 -1
- package/themes/umberto/src/css/_theme-dark.scss +1 -1
- package/themes/umberto/src/css/_toggler.scss +1 -1
- package/themes/umberto/src/css/_top.scss +1 -1
- package/themes/umberto/src/css/_tree.scss +7 -5
- package/themes/umberto/src/css/_warning-banner.scss +1 -1
- package/themes/umberto/src/css/components/_lightbox.scss +1 -1
- package/themes/umberto/src/css/helpers/_color.scss +1 -1
- package/themes/umberto/src/css/helpers/_font.scss +1 -1
- package/themes/umberto/src/css/helpers/_globals.scss +1 -1
- package/themes/umberto/src/css/helpers/_reset.scss +1 -1
- package/themes/umberto/src/css/helpers/_spacing.scss +1 -1
- package/themes/umberto/src/css/pages/_sdk.scss +1 -1
- package/themes/umberto/src/css/styles.scss +1 -1
- package/themes/umberto/src/js/_anchors.js +1 -1
- package/themes/umberto/src/js/_apisearch.js +1 -1
- package/themes/umberto/src/js/_apitree.js +1 -1
- package/themes/umberto/src/js/_collapsables.js +1 -1
- package/themes/umberto/src/js/_copymobileapinavigation.js +1 -1
- package/themes/umberto/src/js/_devnames.js +1 -1
- package/themes/umberto/src/js/_dropdowns.js +1 -1
- package/themes/umberto/src/js/_filtering.js +2 -1
- package/themes/umberto/src/js/_imageModal.js +1 -1
- package/themes/umberto/src/js/_pagenavigation.js +1 -1
- package/themes/umberto/src/js/_prism.js +1 -1
- package/themes/umberto/src/js/_rwdmenu.js +1 -1
- package/themes/umberto/src/js/_samplecode.js +1 -1
- package/themes/umberto/src/js/_sidenavigation.js +1 -1
- package/themes/umberto/src/js/_toc.js +1 -1
- package/themes/umberto/src/js/_tooltips.js +1 -1
- package/themes/umberto/src/js/_warningbanner.js +1 -1
- package/themes/umberto/src/js/app.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2017-
|
|
2
|
+
* @license Copyright (c) 2017-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -337,10 +337,10 @@ function getPackageJson( rootPath ) {
|
|
|
337
337
|
*
|
|
338
338
|
* @param {String} rootPath An absolute path to the project root.
|
|
339
339
|
* @param {String} projectSlug A project slug (used in the navigation to generate URLs).
|
|
340
|
-
* @param {String|Array.<String>} packagesDir A string or an array of strings where to look for packages.
|
|
340
|
+
* @param {String|Array.<String>} [packagesDir='packages/*'] A string or an array of strings where to look for packages.
|
|
341
341
|
* @return {Array.<Object>}
|
|
342
342
|
*/
|
|
343
|
-
function getPackages( rootPath, projectSlug, packagesDir = 'packages' ) {
|
|
343
|
+
function getPackages( rootPath, projectSlug, packagesDir = 'packages/*' ) {
|
|
344
344
|
if ( Array.isArray( packagesDir ) ) {
|
|
345
345
|
const allPackages = [];
|
|
346
346
|
|
package/src/tasks/run-webpack.js
CHANGED
package/src/tasks/watcher.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
mixin seeSource( item )
|
|
2
2
|
//- Do not render "See source" button if the module or the parsed item (e.g. a function) has the `@skipsource` annotation
|
|
3
3
|
if ( projectLocals.seeSourceRepositoryUrl && item.file && !( data.skipSource || item.skipSource ) )
|
|
4
|
-
- const link = projectLocals.getLinkToSource( projectLocals.seeSourceRepositoryUrl, item.file );
|
|
4
|
+
- const link = item.file.url || projectLocals.getLinkToSource( projectLocals.seeSourceRepositoryUrl, item.file );
|
|
5
|
+
|
|
5
6
|
if link
|
|
6
7
|
.see-source
|
|
7
8
|
a( href=link target='_blank' rel="noopener noreferrer" )
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//- Generates a full name of a member that allows creating a link from any module.
|
|
2
|
+
//-
|
|
3
|
+
//- @param {String} name The `doclet#longname` property.
|
|
4
|
+
//- @param {String|undefined} label A description of an overloaded member.
|
|
5
|
+
mixin devNames( name, label )
|
|
6
|
+
- const nameToDisplay = label ? `${ name }:${ label }` : name;
|
|
7
|
+
|
|
8
|
+
span.collapsing-list__dev-names( aria-hidden='true', title=nameToDisplay )
|
|
9
|
+
code #{ nameToDisplay }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
include _link-or-text
|
|
2
2
|
|
|
3
3
|
mixin firesItem( longname )
|
|
4
|
-
- const {
|
|
4
|
+
- const { label } = splitLongname( longname );
|
|
5
5
|
|
|
6
6
|
li
|
|
7
|
-
+linkOrText( longname, { linkText:
|
|
7
|
+
+linkOrText( longname, { linkText: label } )
|
|
@@ -1,42 +1,41 @@
|
|
|
1
|
+
//- @param {String} name
|
|
2
|
+
//- @param {Object} [options]
|
|
3
|
+
//- @param {String} [options.aClass]
|
|
4
|
+
//- @param {String} [options.linkText]
|
|
1
5
|
mixin linkOrText( name, options = {} )
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if index < extracted.longnames.length - 1
|
|
40
|
-
| #{ extracted.separators[ index ] }
|
|
41
|
-
|
|
42
|
-
| #{ extracted.suffix }
|
|
6
|
+
- const extracted = extractLongname( name );
|
|
7
|
+
|
|
8
|
+
span #{ extracted.prefix }
|
|
9
|
+
each longname, index in extracted.longnames
|
|
10
|
+
- const { aClass, linkText } = options;
|
|
11
|
+
- const parts = splitLongname( longname );
|
|
12
|
+
- const linkLongname = getUrlAddressFromLongname( parts );
|
|
13
|
+
- const hashSplit = longname.split( '#' );
|
|
14
|
+
|
|
15
|
+
- const linkHashSplit = linkLongname ? linkLongname.split( '#' ) : hashSplit;
|
|
16
|
+
- const linkAutoHash = linkHashSplit.length > 1 ? linkHashSplit[ 1 ] : '';
|
|
17
|
+
- const link = longnameToUrl( linkHashSplit[ 0 ], linkAutoHash );
|
|
18
|
+
|
|
19
|
+
- let nameText = '';
|
|
20
|
+
|
|
21
|
+
if ( linkText )
|
|
22
|
+
- nameText = linkText;
|
|
23
|
+
else
|
|
24
|
+
if ( parts.className )
|
|
25
|
+
- nameText = parts.className
|
|
26
|
+
if ( parts.className !== parts.name )
|
|
27
|
+
- nameText += ( parts.isStatic ? '.' : '#' ) + parts.name
|
|
28
|
+
else
|
|
29
|
+
- nameText = parts.name || parts.longnameBase
|
|
30
|
+
|
|
31
|
+
- nameText = htmlsafe( nameText );
|
|
32
|
+
|
|
33
|
+
if ( link )
|
|
34
|
+
a( class=aClass href=link.replace( 'event:', 'event-') ) !{ nameText }
|
|
35
|
+
else
|
|
36
|
+
| #{ nameText }
|
|
37
|
+
|
|
38
|
+
if index < extracted.longnames.length - 1
|
|
39
|
+
| #{ extracted.separators[ index ] }
|
|
40
|
+
|
|
41
|
+
| #{ extracted.suffix }
|
|
@@ -7,6 +7,7 @@ include _link-or-text
|
|
|
7
7
|
include ./_api-see-source.pug
|
|
8
8
|
include ./_dev-names.pug
|
|
9
9
|
include ./_related.pug
|
|
10
|
+
include ./type-parameter
|
|
10
11
|
|
|
11
12
|
mixin method( met )
|
|
12
13
|
- let attrData = createFilterAttribs( met );
|
|
@@ -48,8 +49,7 @@ mixin method( met )
|
|
|
48
49
|
+type( met.returns[0].types )
|
|
49
50
|
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
+devNames( met.longname )
|
|
52
|
+
+devNames( met.longname, met.label )
|
|
53
53
|
|
|
54
54
|
div.collapsing-list__description
|
|
55
55
|
if ( met.description && met.description.excerpt )
|
|
@@ -62,6 +62,12 @@ mixin method( met )
|
|
|
62
62
|
if ( met.description )
|
|
63
63
|
| !{ met.description.content }
|
|
64
64
|
|
|
65
|
+
if isNonEmptyArray( met.typeParameters )
|
|
66
|
+
h4 Type parameters
|
|
67
|
+
dl
|
|
68
|
+
each type in met.typeParameters
|
|
69
|
+
+typeParameter( type )
|
|
70
|
+
|
|
65
71
|
if isNonEmptyArray( met.params )
|
|
66
72
|
h4 Parameters
|
|
67
73
|
+paramsMixin( met.params )
|
|
@@ -1,11 +1,177 @@
|
|
|
1
1
|
include ./_link-or-text.pug
|
|
2
2
|
|
|
3
|
-
mixin type( types )
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
mixin type( types, isOptional = false )
|
|
4
|
+
each nameOrObject, index in types
|
|
5
|
+
+renderType( nameOrObject )
|
|
6
|
+
|
|
7
|
+
if index < types.length - 1
|
|
8
|
+
| !{ ' | ' }
|
|
9
|
+
|
|
10
|
+
if ( isOptional && !types.includes( 'undefined' ) )
|
|
11
|
+
| !{ ' | ' }
|
|
12
|
+
+renderType( 'undefined' )
|
|
13
|
+
|
|
14
|
+
//- TODO: Description.
|
|
15
|
+
//-
|
|
16
|
+
//- @param {String|*} inlineObjectOrType
|
|
17
|
+
mixin renderStringValue( inlineObjectOrType )
|
|
18
|
+
//- An inline object specified as string.
|
|
19
|
+
if ( typeof inlineObjectOrType === 'string' && inlineObjectOrType.startsWith( '{' ) )
|
|
20
|
+
| !{ inlineObjectOrType }
|
|
21
|
+
else
|
|
22
|
+
+linkOrText( inlineObjectOrType, {
|
|
23
|
+
aClass: 'collapsing-list__type'
|
|
24
|
+
} )
|
|
25
|
+
|
|
26
|
+
//- TODO: Description.
|
|
27
|
+
//-
|
|
28
|
+
//- @param {Object} complexType
|
|
29
|
+
//- @param {'function'|'predicate'|'operator'|'generic'} complexType.type
|
|
30
|
+
//- @param {Array.<*>} [complexType.params]
|
|
31
|
+
//- @param {String} [complexType.name]
|
|
32
|
+
//- @param {Array.<*>} [complexType.instances]
|
|
33
|
+
//- @param {String} [complexType.operator]
|
|
34
|
+
//- @param {Array.<*>} [complexType.values]
|
|
35
|
+
//- @param {String} [complexType.name]
|
|
36
|
+
//- @param {Array.<*>} [complexType.typeParameters]
|
|
37
|
+
mixin renderComplexStructure( complexType )
|
|
38
|
+
//- Inline callback.
|
|
39
|
+
if ( complexType.type === 'function' && complexType.params && complexType.returns )
|
|
40
|
+
+renderInlineFunction( complexType )
|
|
41
|
+
|
|
42
|
+
//- Predicate.
|
|
43
|
+
//-
|
|
44
|
+
//- The goal is to display whether an object is an instance of an array of modules.
|
|
45
|
+
//- E.g.: `this is "Model"`
|
|
46
|
+
if ( complexType.type === 'predicate' && complexType.name && complexType.instances )
|
|
47
|
+
i= complexType.name
|
|
48
|
+
| !{ ' is ' }
|
|
49
|
+
+renderUnion( complexType.instances )
|
|
50
|
+
|
|
51
|
+
//- Type operator.
|
|
52
|
+
//-
|
|
53
|
+
//- The goal is to display the type operator keyword before rendering a type.
|
|
54
|
+
if ( complexType.type === 'operator' && complexType.operator && complexType.values )
|
|
55
|
+
i= complexType.operator
|
|
56
|
+
| !{ ' ' }
|
|
57
|
+
+renderType( complexType.values )
|
|
58
|
+
|
|
59
|
+
//- An object with type arguments.
|
|
60
|
+
if ( complexType.type === 'generic' && complexType.name && ( complexType.typeParameters || complexType.typeParameter ) )
|
|
61
|
+
+renderGenericType( complexType )
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
//- Renders a structure for an union, an array or a single type specified as a string.
|
|
65
|
+
//-
|
|
66
|
+
//- * Union: Foo | Bar | Baz
|
|
67
|
+
//- * Array: Array<Foo | Bar | Baz>
|
|
68
|
+
//- * String: Foo
|
|
69
|
+
//-
|
|
70
|
+
//- All types are linkable if they point to an existing JSDoc doclet.
|
|
71
|
+
//-
|
|
72
|
+
//- @param {Set|Array|String} type
|
|
73
|
+
mixin renderType( type )
|
|
74
|
+
//- Because of `typeof null === 'object'`...
|
|
75
|
+
if ( type )
|
|
76
|
+
//- Backward compatibility, when passing a `module:...` string.
|
|
77
|
+
if ( typeof type === 'string' )
|
|
78
|
+
+renderStringValue( type )
|
|
79
|
+
else
|
|
80
|
+
//- Complex structures introduced when generating API pages from TypeScript.
|
|
81
|
+
if ( type instanceof Set )
|
|
82
|
+
+renderUnion( [ ...type ] )
|
|
83
|
+
else if ( Array.isArray( type ) )
|
|
84
|
+
| !{ 'Array<' }
|
|
85
|
+
+renderUnion( type )
|
|
86
|
+
| !{ '>' }
|
|
87
|
+
else if ( typeof type === 'object' )
|
|
88
|
+
+renderComplexStructure( type )
|
|
89
|
+
|
|
90
|
+
//- Renders an union structure, e.g., `Foo | Bar | Baz`.
|
|
91
|
+
//-
|
|
92
|
+
//- All types are linkable if they point to an existing JSDoc doclet.
|
|
93
|
+
//-
|
|
94
|
+
//- @param {Array.<String>} type
|
|
95
|
+
mixin renderUnion( iterable )
|
|
96
|
+
each item, index in iterable
|
|
97
|
+
+renderType( item )
|
|
98
|
+
if index < iterable.length - 1
|
|
99
|
+
| !{ ' | ' }
|
|
100
|
+
|
|
101
|
+
//- Draws an inline callback structure.
|
|
102
|
+
//-
|
|
103
|
+
//- E.g.: `( ArgumentFoo | ArgumentBar, AnotherArgument ) => ReturnType`
|
|
104
|
+
//- If specified names are modules, they should point to the proper API page.
|
|
105
|
+
//-
|
|
106
|
+
//- @param {Object} callback
|
|
107
|
+
//- @param {String} callback.type
|
|
108
|
+
//- @param {Array} callback.params
|
|
109
|
+
//- @param {Object} callback.returns
|
|
110
|
+
//- @param {Boolean} callback.isClass
|
|
111
|
+
mixin renderInlineFunction( callback )
|
|
112
|
+
if ( callback.isClass )
|
|
113
|
+
i !{ 'new' }
|
|
114
|
+
| !{ ' ' }
|
|
115
|
+
|
|
116
|
+
//- (1) Start with an opening parenthesis.
|
|
117
|
+
//- It prints `( ` or `(` depending on required arguments by a callback.
|
|
118
|
+
if ( callback.params.length )
|
|
119
|
+
| (!{ ' ' }
|
|
120
|
+
else
|
|
121
|
+
| (
|
|
122
|
+
|
|
123
|
+
//- (2) Arguments parsing. They are seperated by coma (`, `).
|
|
124
|
+
each paramObject, paramIndex in callback.params
|
|
125
|
+
//- (3) Process a single argument.
|
|
126
|
+
+renderType( paramObject )
|
|
127
|
+
if paramIndex < callback.params.length - 1
|
|
128
|
+
| !{ ', ' }
|
|
129
|
+
|
|
130
|
+
//- (4) Close the parenthesis. Define the returned type.
|
|
131
|
+
//- It prints ` ) => ` or `) => ` depending on required arguments by the callback.
|
|
132
|
+
if ( callback.params.length )
|
|
133
|
+
| !{ ' ' }) => !{ ' ' }
|
|
134
|
+
else
|
|
135
|
+
| ) => !{ ' ' }
|
|
136
|
+
|
|
137
|
+
//- Wraps the returned type in brackets to avoid confusions if a type is returned by the callback,
|
|
138
|
+
//- or it is a new type (outside the callback). See #1063.
|
|
139
|
+
if ( callback.returns instanceof Set )
|
|
140
|
+
| (!{ ' ' }
|
|
141
|
+
|
|
142
|
+
//- (5) Process the returned type that can be an union, an array of a type.
|
|
143
|
+
+renderType( callback.returns )
|
|
144
|
+
|
|
145
|
+
//- See #1063.
|
|
146
|
+
if ( callback.returns instanceof Set )
|
|
147
|
+
| !{ ' ' })
|
|
148
|
+
|
|
149
|
+
//- TODO: Description
|
|
150
|
+
//-
|
|
151
|
+
//- @param {Object} generic
|
|
152
|
+
//- @param {'generic'} generic.type
|
|
153
|
+
//- @param {String} generic.name
|
|
154
|
+
//- @param {Set.<String>} generic.names
|
|
155
|
+
//- @param {Array.<*>} [generic.typeParameters]
|
|
156
|
+
//- @param {*} [generic.typeParameter]
|
|
157
|
+
mixin renderGenericType( generic )
|
|
158
|
+
+renderType( generic.name )
|
|
159
|
+
|
|
160
|
+
if ( generic.typeParameters )
|
|
161
|
+
| !{ '<' }
|
|
162
|
+
each type, typeIndex in generic.typeParameters
|
|
163
|
+
if ( typeof type === 'string' )
|
|
164
|
+
+renderStringValue( type )
|
|
165
|
+
else
|
|
166
|
+
//- Nested generics.
|
|
167
|
+
+renderGenericType( type )
|
|
168
|
+
|
|
169
|
+
if typeIndex < generic.typeParameters.length - 1
|
|
170
|
+
| !{ ', ' }
|
|
171
|
+
| !{ '>' }
|
|
172
|
+
|
|
173
|
+
if ( generic.typeParameter )
|
|
174
|
+
| !{ '[ ' }
|
|
175
|
+
+renderType( generic.typeParameter )
|
|
176
|
+
| !{ ' ]' }
|
|
177
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
include ./_type
|
|
2
|
+
|
|
3
|
+
mixin typeParameter( type )
|
|
4
|
+
dt
|
|
5
|
+
code
|
|
6
|
+
span !{ type.name }
|
|
7
|
+
|
|
8
|
+
//- Most TypeScript types we mark as `object`, as they structure is complex.
|
|
9
|
+
//- Hence, it does not really make sense to show that a type extends an unknown `object`.
|
|
10
|
+
if ( type.value && type.value[ 0 ] !== 'object' )
|
|
11
|
+
| !{' : '}
|
|
12
|
+
if ( type.isExtending )
|
|
13
|
+
i !{ 'extends ' }
|
|
14
|
+
+type( type.value )
|
|
15
|
+
|
|
16
|
+
if ( type.description )
|
|
17
|
+
dd
|
|
18
|
+
| !{ type.description.content }
|
|
@@ -10,10 +10,22 @@ div( class="notice notice__filter api-props-filter hidden-loading" )
|
|
|
10
10
|
input( type="checkbox" id="f4" value="inherited" checked )
|
|
11
11
|
label( for="f4" )
|
|
12
12
|
span( class="badge badge--gray" ) Inherited
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
|
|
14
|
+
//- Typedoc does not support the `@mixin` concept as it is implemented in Umberto.
|
|
15
|
+
//- See: #1060.
|
|
16
|
+
if ( projectLocals.apiType !== 'typedoc' )
|
|
17
|
+
li
|
|
18
|
+
input( type="checkbox" id="f6" value="mixed" checked )
|
|
19
|
+
label( for="f6" )
|
|
20
|
+
span( class="badge badge--gray" ) Mixed
|
|
21
|
+
|
|
22
|
+
//- Typedoc supports the `@internal` annotation. See: #1057.
|
|
23
|
+
if ( projectLocals.apiType === 'typedoc' )
|
|
24
|
+
li
|
|
25
|
+
input( type="checkbox" id="f7" value="internal" checked )
|
|
26
|
+
label( for="f7" )
|
|
27
|
+
span( class="badge badge--orange" ) Internal
|
|
28
|
+
|
|
17
29
|
li
|
|
18
30
|
input( type="checkbox" id="f2" value="protected" )
|
|
19
31
|
label( for="f2" )
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
include ../_mixin/_type
|
|
2
|
+
|
|
3
|
+
if isNonEmptyArray( data.typeParameters )
|
|
4
|
+
h2( id="type-parameters" class="hidden-loading" ) Type parameters
|
|
5
|
+
|
|
6
|
+
ul( class="collapsing-list hidden-loading" )
|
|
7
|
+
each type in data.typeParameters
|
|
8
|
+
|
|
9
|
+
li( class="collapsing-list__item collapsing-list__item--visible" )
|
|
10
|
+
div( class="collapsing-list__term toggler--collapsed" class=type.description ? "" : "hidden" )
|
|
11
|
+
h3
|
|
12
|
+
code
|
|
13
|
+
span( class="member-name" ) #{ type.name }
|
|
14
|
+
|
|
15
|
+
//- Most TypeScript types we mark as `object`, as they structure is complex.
|
|
16
|
+
//- Hence, it does not really make sense to show that a type extends an unknown `object`.
|
|
17
|
+
if ( type.value && type.value[ 0 ] !== 'object' )
|
|
18
|
+
| !{' : '}
|
|
19
|
+
if ( type.isExtending )
|
|
20
|
+
i !{ 'extends ' }
|
|
21
|
+
+type( type.value )
|
|
22
|
+
|
|
23
|
+
if ( type.description )
|
|
24
|
+
div.collapsing-list__description
|
|
25
|
+
div.collapsing-list__content
|
|
26
|
+
| !{ type.description.content }
|