1
|
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/lib/output/theme.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAIA,2CAA+C;AAC/C,gDAA6C;AAC7C,+CAA4C;AA8C5C,IAAa,KAAK;IAAS,yBAAiB;IAcxC,eAAY,QAAkB,EAAE,QAAgB;QAAhD,YACI,kBAAM,QAAQ,CAAC,SAIlB;QAFG,KAAI,CAAC,QAAQ,GAAI,QAAQ,CAAC;QAC1B,KAAI,CAAC,SAAS,GAAG,IAAI,qBAAS,CAAC,KAAI,CAAC,CAAC;;IACzC,CAAC;IAmBD,iCAAiB,GAAjB,UAAkB,IAAY;QAC1B,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;IAYD,uBAAO,GAAP,UAAQ,OAA0B;QAC9B,MAAM,CAAC,EAAE,CAAC;IACd,CAAC;IAeD,6BAAa,GAAb,UAAc,OAA0B;QACpC,MAAM,CAAC,IAAI,CAAC;IAChB,CAAC;IACL,YAAC;AAAD,CAAC,AAxED,CAA2B,8BAAiB,GAwE3C;AAxEY,KAAK;IADjB,qBAAS,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;GAC9B,KAAK,CAwEjB;AAxEY,sBAAK","sourcesContent":["import {Renderer} from './renderer';\nimport {ProjectReflection} from '../models/reflections/project';\nimport {UrlMapping} from './models/UrlMapping';\nimport {NavigationItem} from './models/NavigationItem';\nimport {RendererComponent} from './components';\nimport {Component} from '../utils/component';\nimport {Resources} from './utils/resources';\n\n/**\n * Base class of all themes.\n *\n * A theme defines the logical and graphical output of a documentation. Themes are\n * directories containing a ```theme.js``` file defining a [[BaseTheme]] subclass and a\n * series of subdirectories containing templates and assets. You can select a theme\n * through the ```--theme <path/to/theme>``` commandline argument.\n *\n * The theme class controls which files will be created through the [[BaseTheme.getUrls]]\n * function. It returns an array of [[UrlMapping]] instances defining the target files, models\n * and templates to use. Additionally themes can subscribe to the events emitted by\n * [[Renderer]] to control and manipulate the output process.\n *\n * The default file structure of a theme looks like this:\n *\n * - ```/assets/```<br>\n * Contains static assets like stylesheets, images or javascript files used by the theme.\n * The [[AssetsPlugin]] will deep copy this directory to the output directory.\n *\n * - ```/layouts/```<br>\n * Contains layout templates that the [[LayoutPlugin]] wraps around the output of the\n * page template. Currently only one ```default.hbs``` layout is supported. Layout templates\n * receive the current [[PageEvent]] instance as their handlebars context. Place the\n * ```{{{contents}}}``` variable to render the actual body of the document within this template.\n *\n * - ```/partials/```<br>\n * Contains partial templates that can be used by other templates using handlebars partial\n * syntax ```{{> partial-name}}```. The [[PartialsPlugin]] loads all files in this directory\n * and combines them with the partials of the default theme.\n *\n * - ```/templates/```<br>\n * Contains the main templates of the theme. The theme maps models to these templates through\n * the [[BaseTheme.getUrls]] function. If the [[Renderer.getTemplate]] function cannot find a\n * given template within this directory, it will try to find it in the default theme\n * ```/templates/``` directory. Templates receive the current [[PageEvent]] instance as\n * their handlebars context. You can access the target model through the ```{{model}}``` variable.\n *\n * - ```/theme.js```<br>\n * A javascript file that returns the definition of a [[BaseTheme]] subclass. This file will\n * be executed within the context of TypeDoc, one may directly access all classes and functions\n * of TypeDoc. If this file is not present, an instance of [[DefaultTheme]] will be used to render\n * this theme.\n */\n@Component({name: 'theme', internal: true})\nexport class Theme extends RendererComponent {\n /**\n * The base path of this theme.\n */\n basePath: string;\n\n resources: Resources;\n\n /**\n * Create a new BaseTheme instance.\n *\n * @param renderer The renderer this theme is attached to.\n * @param basePath The base path of this theme.\n */\n constructor(renderer: Renderer, basePath: string) {\n super(renderer);\n\n this.basePath = basePath;\n this.resources = new Resources(this);\n }\n\n /**\n * Test whether the given path contains a documentation generated by this theme.\n *\n * TypeDoc empties the output directory before rendering a project. This function\n * is used to ensure that only previously generated documentations are deleted.\n * When this function returns FALSE, the documentation will not be created and an\n * error message will be displayed.\n *\n * Every theme must have an own implementation of this function, the default\n * implementation always returns FALSE.\n *\n * @param path The path of the directory that should be tested.\n * @returns TRUE if the given path seems to be a previous output directory,\n * otherwise FALSE.\n *\n * @see [[Renderer.prepareOutputDirectory]]\n */\n isOutputDirectory(path: string): boolean {\n return false;\n }\n\n /**\n * Map the models of the given project to the desired output files.\n *\n * Every theme must have an own implementation of this function, the default\n * implementation always returns an empty array.\n *\n * @param project The project whose urls should be generated.\n * @returns A list of [[UrlMapping]] instances defining which models\n * should be rendered to which files.\n */\n getUrls(project: ProjectReflection): UrlMapping[] {\n return [];\n }\n\n /**\n * Create a navigation structure for the given project.\n *\n * A navigation is a tree structure consisting of [[NavigationItem]] nodes. This\n * function should return the root node of the desired navigation tree.\n *\n * The [[NavigationPlugin]] will call this hook before a project will be rendered.\n * The plugin will update the state of the navigation tree and pass it to the\n * templates.\n *\n * @param project The project whose navigation should be generated.\n * @returns The root navigation item.\n */\n getNavigation(project: ProjectReflection): NavigationItem {\n return null;\n }\n}\n"]}
|