UNPKG

11.7 kBJavaScriptView Raw
1export {}
2
3/* typal types/index.xml */
4/**
5 * @typedef {Object} OpenGraph Open Graph Tags
6 * @prop {string} [url] The url of the page. The default will be constructed based on the `url` property of the page.
7 * @prop {string} [title] The title of the page. The default is the title of the page from the pages config.
8 * @prop {string} [description] The description of the page. There's no default.
9 * @prop {string} [type="website"] The type of the page (`website`/`article`). Default `website`.
10 * @prop {string} image The image for the page.
11 * @typedef {Object} Page A page configuration.
12 * @prop {string} title The title of the web-page to set on `document.title`.
13 * @prop {string} key The key in the pages config. If dir was set on the page, it will be part for the key, e.g., `dir/key`.
14 * @prop {string} dir The dirname of the page.
15 * @prop {boolean} [focus=false] Only compile this page. Default `false`.
16 * @prop {string} url The path to output `html` file in the build directory.
17 * @prop {string} file The location of the page file, or directory inside of the `pages` folder.
18 * @prop {string} [menuUrl] [readonly] The override of what link should be used in the menu, e.g., `/` for the index page. This will be computed automatically for index pages. Mount is also added.
19 * @prop {boolean} [reverse=false] Reverse the order of files in the directory. Default `false`.
20 * @prop {string} path Set by `Splendid`. The resolved path to the page.
21 * @prop {string} key Set by `Splendid`. The unique key with which the page is exported.
22 * @prop {OpenGraph} og Open Graph Tags specific to the page.
23 * @prop {Object<string, string>} links Links to be referenced on the page via standard `href` attribute, or in markdown.
24 * @prop {string} layout The path to the layout of the page.
25 * @typedef {Object} Splendid The object passed to the components.
26 * @prop {Page} page The page being currently processed.
27 * @prop {Array<Page>} pages The array with all pages.
28 * @prop {Config} config The configuration object.
29 * @prop {function} random Returns a seeded random number, useful to make sure that random values don't always change.
30 * @prop {function} addFile Adds the file.
31 * @prop {(arg0: string) => ?} addStyle Adds a link to the style.
32 * @prop {string} [env="prod"] The current environment passed in the `-e` flag. Default `prod`.
33 * @prop {(arg0: string, arg1: boolean) => ?} addScript Adds the script.
34 * @prop {(arg0: string, arg1: boolean) => ?} addJs Adds the JavaScript source.
35 * @prop {(arg0: string) => ?} addFile Makes sure that the file is available in the build.
36 * @prop {(key: string, id: string, props: Object, children: Array<string>) => void} addComponent Marks the component for export and compilation as a JS Preact component on the page.
37 * @prop {(arg0: boolean) => ?} export When called from the component, will mark it for export, automatically generating an ID and remembering required properties. Does not work from JSX pages, when `addComponent` should be used instead. Individual instances of a componet can call this method with the `false` value to prevent being exported (e.g., depending on the value of a property).
38 * @prop {(arg0: boolean, arg1: number) => ?} setPretty Controls whether to enable pretty printing for individual components. The second argument is the line width.
39 */
40
41/* typal types/config.xml */
42/**
43 * @typedef {import('restream').Rule} Rule
44 * @typedef {Object} Config Splendid Configuration.
45 * @prop {string} layout The path to the layout.
46 * @prop {string} [appDir="splendid"] The application directory. Default `splendid`.
47 * @prop {string} [pages="pages"] The directory with Pages inside of the app dir. Default `pages`.
48 * @prop {string} [components="components"] The directory with Components inside of the app dir. Default `components`.
49 * @prop {string|Array<string>} [elements="elements"] The directory or directories with Elements inside of the app dir. Default `elements`.
50 * @prop {string} [url] The website URL to additionally generate the sitemap.
51 * @prop {Array<Rule>} [replacements] The array with additional replacements that should run on the code.
52 * @prop {string} output Where to build the website into and copy all the assets.
53 * @prop {string} [mount="/"] The directory on which to mount the website. Must be in form of `/mount/`.
54 * Useful for GitHub_ pages. Default `/`.
55 * @prop {?number} [pretty=100] Whether to print JSX components in pretty mode, and the maximum line length. Default `100`.
56 * @prop {string} [sectionBreaks] The source from which to copy section breaks inside of the `splendid` directory, e.g., `my-breaks`. If not specified, the default section breaks are used.
57 * @prop {boolean} [preactSrc=false] Serve _Preact_ source code instead of its build. Default `false`.
58 * @prop {string} [depack=true] Build the source code of JS files with _Google Closure Compiler_ using _Depack_. Default `true`.
59 * @prop {boolean} [ajax=true] Enable the ajax navigation on the website. Default `true`.
60 * @prop {OpenGraph} og Global _Open Graph_ tags that will be set by default when pages do not contain specific fields.
61 * @prop {Object<string, string>} links The associative array of links, which can be refered to when writing `<a href="link">title<a>` and `[title](link)` tags.
62 * @prop {string} [blocks="blocks"] The directory inside of the app folder in which to find HTML blocks for embedding. Each file will create a replacement such as `<block-filename>`. Default `blocks`.
63 * @prop {?HighlightJsStyle} [highlightJsStyle="default"] What style to use for code blocks using HighlightJS. View all styles here https://highlightjs.org/static/demo/. Pass `null` to disable addition of the CSS file, and include it in the layout manually. Default `default`.
64 * @prop {?string} [compsStrategy="onDOMContentLoaded"] How the components (_PageComp_'s) should be initialised:
65 * - `onDOMContentLoaded` / `onload`: _Splendid_ will add script tags with `data-src` attribute and a preload link in the head, and dynamically load the scripts when the DOM or window have loaded by renaming `data-src` attribute to `src`.
66 * - `null`: adds component scripts like normal scripts according to the `scriptsStrategy`.
67 *
68 * ​ Default `onDOMContentLoaded`.
69 * @prop {?string} [scriptsStrategy="defer"] How to load any external scripts that are not part of _PageComp_'s ([article on loading order](https://flaviocopes.com/javascript-async-defer)):
70 * - `defer`: adds the script tags in the head with `defer` attribute so that their download is kicked off immediately, but they are executed only after the `domInteractive` event without blocking page rendering.
71 * - `null`: places the scripts just before the closing body tags, so that they start loading only when parsing of DOM reaches that point.
72 *
73 * ​ Default `defer`.
74 * @prop {boolean} [paragraphs=true] Whether to use a RegExp for paragraphs, which wraps Markdown-style paragraphs into `p` tags. Paragraphs must have blank lines around them (unless followed by a closing tag), and not start with a tag, e.g.,
75 * ```html
76 * <div>
77 *
78 * This is a paragraph.
79 * </div>
80 * ```
81 * Default `true`.
82 * @prop {boolean} [bootstrapUtils=true] Moves global attributes that make up bootstrap utilities (e.g., `d-flex`, `align-items-center`) into the class attribute. Also enables to specify styles
83 * via attributes.
84 * ```html
85 * <div class="Example" d-flex align-items-center color="green">
86 * <!-- becomes -->
87 * <div class="Example d-flex align-items-center" style="color:green">
88 * ```
89 * Default `true`.
90 * @prop {Array<string>} prefixes The CSS property names (optionally with values) to include in the compiled CSS, e.g., `position:sticky`, `-ms-hyphens`.
91 * @prop {boolean} [renameBootstrap=true] Renames _Bootstrap_ classes into shortened versions, e.g., `container-fluid` becomes `b-A`.
92 * This option is only used when exporting components, whereas for static rendering the `rename` property on the `bootstrap-css` component is looked up.
93 * Has no effect when not on the `prod` environment. Default `true`.
94 * @prop {string} [potracePath] The path to the potrace binary, which can be configured during installation.
95 */
96
97/* typal types/highlightjs.xml */
98/**
99 * @typedef {('a11y-dark'|'a11y-light'|'agate'|'an-old-hope'|'androidstudio'|'arduino-light'|'arta'|'ascetic'|'atelier-cave-dark'|'atelier-cave-light'|'atelier-dune-dark'|'atelier-dune-light'|'atelier-estuary-dark'|'atelier-estuary-light'|'atelier-forest-dark'|'atelier-forest-light'|'atelier-heath-dark'|'atelier-heath-light'|'atelier-lakeside-dark'|'atelier-lakeside-light'|'atelier-plateau-dark'|'atelier-plateau-light'|'atelier-savanna-dark'|'atelier-savanna-light'|'atelier-seaside-dark'|'atelier-seaside-light'|'atelier-sulphurpool-dark'|'atelier-sulphurpool-light'|'atom-one-dark-reasonable'|'atom-one-dark'|'atom-one-light'|'brown-paper'|'brown-papersq'|'codepen-embed'|'color-brewer'|'darcula'|'dark'|'darkula'|'default'|'docco'|'dracula'|'far'|'foundation'|'github-gist'|'github'|'gml'|'googlecode'|'grayscale'|'gruvbox-dark'|'gruvbox-light'|'hopscotch'|'hybrid'|'idea'|'ir-black'|'isbl-editor-dark'|'isbl-editor-light'|'kimbie.dark'|'kimbie.light'|'lightfair'|'magula'|'mono-blue'|'monokai-sublime'|'monokai'|'nord'|'obsidian'|'ocean'|'paraiso-dark'|'paraiso-light'|'pojoaque'|'pojoaque'|'purebasic'|'qtcreator_dark'|'qtcreator_light'|'railscasts'|'rainbow'|'routeros'|'school-book'|'school-book'|'shades-of-purple'|'solarized-dark'|'solarized-light'|'sunburst'|'tomorrow-night-blue'|'tomorrow-night-bright'|'tomorrow-night-eighties'|'tomorrow-night'|'tomorrow'|'vs'|'vs2015'|'xcode'|'xt256'|'zenburn')} HighlightJsStyle
100 */
101
102/* typal node_modules/@rqt/aqt/types/index.xml */
103/**
104 * @typedef {import('http').OutgoingHttpHeaders} OutgoingHttpHeaders
105 * @typedef {Object} AqtOptions Configuration for requests.
106 * @prop {!Object} [data] Optional data to send to the server with the request.
107 * @prop {string} [type="json"] How to send data: `json` to serialise JSON data and add _Content-Type: application/json_ header, and `form` for url-encoded transmission with _Content-Type: application/x-www-form-urlencoded_. _Multipart/form-data_ must be implemented manually. Default `json`.
108 * @prop {!http.OutgoingHttpHeaders} [headers] Headers to use for the request. By default, a single User-Agent header with _Mozilla/5.0 (Node.JS) aqt/{version}_ value is set.
109 * @prop {boolean} [compress=true] Add the `Accept-Encoding: gzip, deflate` header to indicate to the server that it can send a compressed response. Default `true`.
110 * @prop {number} [timeout] The timeout after which the request should fail.
111 * @prop {string} [method] What HTTP method to use in making of the request. When no method is given and `data` is present, defaults to `POST`.
112 * @prop {boolean} [binary=false] Whether to return a buffer instead of a string. Default `false`.
113 * @prop {boolean} [justHeaders=false] Whether to stop the request after response headers were received, without waiting for the data. Default `false`.
114 */
115
116/* typal node_modules/@rqt/aqt/types/return.xml */
117/**
118 * @typedef {import('http').IncomingHttpHeaders} IncomingHttpHeaders
119 * @typedef {Object} AqtReturn The return type of the function.
120 * @prop {!(string|Object|Buffer)} body The return from the server. In case the `json` content-type was set by the server, the response will be parsed into an object. If `binary` option was used for the request, a `Buffer` will be returned. Otherwise, a string response is returned.
121 * @prop {!http.IncomingHttpHeaders} headers Incoming headers returned by the server.
122 * @prop {number} statusCode The status code returned by the server.
123 * @prop {string} statusMessage The status message set by the server.
124 */