@forsakringskassan/docs-generator 2.9.2 → 2.11.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/dist/compile-example.js +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.js +96 -50
- package/dist/processors/motd.js +39 -0
- package/dist/processors/selectable-version.js +35 -4
- package/dist/runtime.d.ts +31 -0
- package/dist/runtime.js +20 -0
- package/dist/style/core.css +2 -5
- package/dist/style/index.css +63 -12
- package/dist/style/site.css +61 -7
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{vue3-BNuTiNOg.js → vue3-WhFYGWAf.js} +54 -23
- package/package.json +1 -1
- package/templates/macro/motd.njk.html +21 -0
- package/templates/partials/footer.html +4 -3
- package/templates/partials/motd-container.njk.html +14 -0
- package/templates/partials/version-banner.html +0 -14
package/dist/compile-example.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var path$1 = require('node:path');
|
|
4
4
|
var esbuild = require('esbuild');
|
|
5
5
|
var vue = require('vue');
|
|
6
|
-
var vue3 = require('./vue3-
|
|
6
|
+
var vue3 = require('./vue3-WhFYGWAf.js');
|
|
7
7
|
var path = require('node:path/posix');
|
|
8
8
|
require('@vue/compiler-sfc');
|
|
9
9
|
require('./vendor-DM7XM4qm.js');
|
package/dist/index.d.ts
CHANGED
|
@@ -329,7 +329,7 @@ export declare interface MOTDOptions {
|
|
|
329
329
|
/** Name of the container to render content in. */
|
|
330
330
|
container?: string;
|
|
331
331
|
/** Message to display */
|
|
332
|
-
message
|
|
332
|
+
message?: string;
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
/**
|
|
@@ -523,7 +523,16 @@ export declare function searchProcessor(): Processor;
|
|
|
523
523
|
*
|
|
524
524
|
* @public
|
|
525
525
|
*/
|
|
526
|
-
export declare function selectableVersionProcessor(pkg: PackageJson, container: string, options?:
|
|
526
|
+
export declare function selectableVersionProcessor(pkg: PackageJson, container: string, options?: SelectableVersionProcessorOptions): Processor;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Options for {@link selectableVersionProcessor#}.
|
|
530
|
+
*
|
|
531
|
+
* @public
|
|
532
|
+
*/
|
|
533
|
+
export declare interface SelectableVersionProcessorOptions extends ProcessorOptions {
|
|
534
|
+
readonly message?: string;
|
|
535
|
+
}
|
|
527
536
|
|
|
528
537
|
/**
|
|
529
538
|
* Options passed from the example compiler to the `setup` function.
|
package/dist/index.js
CHANGED
|
@@ -13,10 +13,11 @@ var vueDocgenApi = require('vue-docgen-api');
|
|
|
13
13
|
var fs$1 = require('node:fs');
|
|
14
14
|
var sass = require('sass');
|
|
15
15
|
var node_url = require('node:url');
|
|
16
|
+
var Module = require('node:module');
|
|
16
17
|
var esbuild$1 = require('esbuild');
|
|
17
18
|
var nunjucks = require('nunjucks');
|
|
18
19
|
var vue = require('vue');
|
|
19
|
-
var vue3 = require('./vue3-
|
|
20
|
+
var vue3 = require('./vue3-WhFYGWAf.js');
|
|
20
21
|
var express = require('express');
|
|
21
22
|
require('fs');
|
|
22
23
|
require('node:events');
|
|
@@ -357,7 +358,8 @@ function manifestProcessor(options = {}) {
|
|
|
357
358
|
function normalizeOptions(options) {
|
|
358
359
|
const defaults = {
|
|
359
360
|
enabled: true,
|
|
360
|
-
container: "body:begin"
|
|
361
|
+
container: "body:begin",
|
|
362
|
+
message: void 0
|
|
361
363
|
};
|
|
362
364
|
return { ...defaults, ...options };
|
|
363
365
|
}
|
|
@@ -366,14 +368,30 @@ function motdProcessor(options) {
|
|
|
366
368
|
return {
|
|
367
369
|
name: "motd-processor",
|
|
368
370
|
after: "generate-docs",
|
|
371
|
+
runtime: [{ src: "src/runtime/motd/index.ts" }],
|
|
369
372
|
handler(context) {
|
|
370
373
|
if (!enabled) {
|
|
371
374
|
return;
|
|
372
375
|
}
|
|
373
|
-
context.
|
|
374
|
-
|
|
375
|
-
|
|
376
|
+
const useLegacyTemplate = context.hasTemplate(
|
|
377
|
+
"partials/version-banner.html"
|
|
378
|
+
);
|
|
379
|
+
const data = {
|
|
380
|
+
message
|
|
381
|
+
};
|
|
382
|
+
context.addTemplateBlock(container, "motd-container", {
|
|
383
|
+
filename: "partials/motd-container.njk.html",
|
|
384
|
+
data: useLegacyTemplate ? void 0 : data
|
|
376
385
|
});
|
|
386
|
+
if (useLegacyTemplate) {
|
|
387
|
+
console.warn(
|
|
388
|
+
`[deprecated] using the "partial/version-banner.html" template for motdProcessor is deprecated`
|
|
389
|
+
);
|
|
390
|
+
context.addTemplateBlock(container, "version-banner", {
|
|
391
|
+
filename: "partials/version-banner.html",
|
|
392
|
+
data
|
|
393
|
+
});
|
|
394
|
+
}
|
|
377
395
|
}
|
|
378
396
|
};
|
|
379
397
|
}
|
|
@@ -412,13 +430,19 @@ function themeSelectProcessor() {
|
|
|
412
430
|
}
|
|
413
431
|
|
|
414
432
|
function selectableVersionProcessor(pkg, container, options) {
|
|
415
|
-
const { enabled = true } = options ?? {};
|
|
433
|
+
const { enabled = true, message = "Det finns en nyare version" } = options ?? {};
|
|
416
434
|
return {
|
|
417
435
|
name: "selectable-version-processor",
|
|
418
436
|
after: "generate-docs",
|
|
419
437
|
runtime: [
|
|
420
438
|
{
|
|
421
|
-
src: "src/runtime/select-version.ts"
|
|
439
|
+
src: "src/runtime/select-version.ts",
|
|
440
|
+
buildOptions: {
|
|
441
|
+
define: {
|
|
442
|
+
__PKG_VERSION__: JSON.stringify(pkg.version),
|
|
443
|
+
__MESSAGE__: JSON.stringify(message)
|
|
444
|
+
}
|
|
445
|
+
}
|
|
422
446
|
}
|
|
423
447
|
],
|
|
424
448
|
handler(context) {
|
|
@@ -973,50 +997,63 @@ async function navigationFileReader(filePath, basePath) {
|
|
|
973
997
|
return [doc];
|
|
974
998
|
}
|
|
975
999
|
|
|
1000
|
+
function resolveFrom(fromDirectory, moduleId) {
|
|
1001
|
+
const fromFile = path.join(fs$1.realpathSync(fromDirectory), "noop.js");
|
|
1002
|
+
return Module._resolveFilename(moduleId, {
|
|
1003
|
+
id: fromFile,
|
|
1004
|
+
filename: fromFile,
|
|
1005
|
+
paths: Module._nodeModulePaths(fromDirectory)
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
976
1008
|
const WEBPACK_NODE_MODULE_PREFIX = "~";
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
findUrl = url
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1009
|
+
function moduleImporter(options) {
|
|
1010
|
+
const { cwd } = options;
|
|
1011
|
+
return {
|
|
1012
|
+
findFileUrl(url) {
|
|
1013
|
+
let findUrl = url;
|
|
1014
|
+
if (url.startsWith(WEBPACK_NODE_MODULE_PREFIX)) {
|
|
1015
|
+
findUrl = url.substring(1);
|
|
1016
|
+
}
|
|
1017
|
+
const directory = path.dirname(findUrl);
|
|
1018
|
+
const fileName = path.basename(findUrl);
|
|
1019
|
+
const search = [
|
|
1020
|
+
`${fileName}.css`,
|
|
1021
|
+
`${fileName}.scss`,
|
|
1022
|
+
`_${fileName}.scss`,
|
|
1023
|
+
`${fileName}`
|
|
1024
|
+
];
|
|
1025
|
+
for (const variant of search) {
|
|
1026
|
+
try {
|
|
1027
|
+
const moduleName = path.posix.join(directory, variant);
|
|
1028
|
+
const resolved = resolveFrom(cwd, moduleName);
|
|
1029
|
+
return new URL(node_url.pathToFileURL(resolved));
|
|
1030
|
+
} catch (err) {
|
|
1031
|
+
if (err.code !== "MODULE_NOT_FOUND") {
|
|
1032
|
+
throw err;
|
|
1033
|
+
}
|
|
999
1034
|
}
|
|
1000
1035
|
}
|
|
1036
|
+
return null;
|
|
1001
1037
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
};
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1005
1040
|
|
|
1006
|
-
async function compileSassString(dst, style) {
|
|
1041
|
+
async function compileSassString(dst, style, options = {}) {
|
|
1042
|
+
const { cwd = process.cwd() } = options;
|
|
1007
1043
|
const result = await sass.compileStringAsync(style, {
|
|
1008
1044
|
style: "expanded",
|
|
1009
|
-
importers: [new sass.NodePackageImporter(), moduleImporter]
|
|
1045
|
+
importers: [new sass.NodePackageImporter(), moduleImporter({ cwd })]
|
|
1010
1046
|
});
|
|
1011
1047
|
await fs.mkdir(path.dirname(dst), { recursive: true });
|
|
1012
1048
|
await fs.writeFile(dst, result.css, "utf-8");
|
|
1013
1049
|
}
|
|
1014
1050
|
|
|
1015
|
-
async function compileStyle(assetFolder, name, src) {
|
|
1051
|
+
async function compileStyle(assetFolder, name, src, options) {
|
|
1052
|
+
const { cwd } = options;
|
|
1016
1053
|
try {
|
|
1017
1054
|
const outfile = path$1.join("temp", `asset-${name}.css`);
|
|
1018
1055
|
const source = await fs.readFile(src, "utf-8");
|
|
1019
|
-
await compileSassString(outfile, source);
|
|
1056
|
+
await compileSassString(outfile, source, { cwd });
|
|
1020
1057
|
const content = await fs.readFile(outfile, "utf-8");
|
|
1021
1058
|
const fingerprint = createMarkdownRenderer.getFingerprint(content);
|
|
1022
1059
|
const integrity = getIntegrity(content);
|
|
@@ -1044,7 +1081,8 @@ function byPriority$1({ options: a }, { options: b }) {
|
|
|
1044
1081
|
function toSorted$1(values, comparator) {
|
|
1045
1082
|
return [...values].sort(comparator);
|
|
1046
1083
|
}
|
|
1047
|
-
function cssAssetProcessor(assetFolder, assets) {
|
|
1084
|
+
function cssAssetProcessor(assetFolder, assets, options) {
|
|
1085
|
+
const { cwd } = options;
|
|
1048
1086
|
return {
|
|
1049
1087
|
name: "css-asset-processor",
|
|
1050
1088
|
after: "assets",
|
|
@@ -1056,7 +1094,8 @@ function cssAssetProcessor(assetFolder, assets) {
|
|
|
1056
1094
|
const info = await compileStyle(
|
|
1057
1095
|
assetFolder,
|
|
1058
1096
|
asset.name,
|
|
1059
|
-
asset.src
|
|
1097
|
+
asset.src,
|
|
1098
|
+
{ cwd }
|
|
1060
1099
|
);
|
|
1061
1100
|
const attrs = serializeAttrs(asset.options.attributes);
|
|
1062
1101
|
const inject = { ...info, attrs: Array.from(attrs).join(" ") };
|
|
@@ -1648,7 +1687,7 @@ const cache$1 = /* @__PURE__ */ new Map();
|
|
|
1648
1687
|
function cacheKey(layout, extension) {
|
|
1649
1688
|
return [layout, extension].join("|");
|
|
1650
1689
|
}
|
|
1651
|
-
function findTemplate(from, src, format) {
|
|
1690
|
+
function findTemplate(folders, from, src, format) {
|
|
1652
1691
|
let layout;
|
|
1653
1692
|
if (typeof src === "string") {
|
|
1654
1693
|
layout = src;
|
|
@@ -1662,12 +1701,14 @@ function findTemplate(from, src, format) {
|
|
|
1662
1701
|
if (cached) {
|
|
1663
1702
|
return cached;
|
|
1664
1703
|
}
|
|
1704
|
+
folders = [...folders, templateDirectory];
|
|
1665
1705
|
const template = `${layout}.template.${format}`;
|
|
1666
|
-
const
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1706
|
+
const searchPaths = folders.map((it) => {
|
|
1707
|
+
return path.join(it, template);
|
|
1708
|
+
});
|
|
1709
|
+
const found = searchPaths.find((it) => fs$1.existsSync(it));
|
|
1710
|
+
if (!found) {
|
|
1711
|
+
throw new MissingTemplateError(from, template, format, folders);
|
|
1671
1712
|
}
|
|
1672
1713
|
cache$1.set(key, template);
|
|
1673
1714
|
return template;
|
|
@@ -1742,7 +1783,7 @@ async function compileExamples(options) {
|
|
|
1742
1783
|
}
|
|
1743
1784
|
}
|
|
1744
1785
|
async function compileStandalones(options) {
|
|
1745
|
-
const { fileInfo, tasks, renderTemplate, templateData } = options;
|
|
1786
|
+
const { fileInfo, tasks, renderTemplate, templateData, templateFolders } = options;
|
|
1746
1787
|
if (tasks.length === 0) {
|
|
1747
1788
|
return;
|
|
1748
1789
|
}
|
|
@@ -1750,7 +1791,11 @@ async function compileStandalones(options) {
|
|
|
1750
1791
|
const outputFolder = path.posix.join(options.outputFolder, fileInfo.path);
|
|
1751
1792
|
const cacheMiss = cache(cacheFolder, outputFolder);
|
|
1752
1793
|
const dirtyTasks = tasks.filter(cacheMiss);
|
|
1753
|
-
const standaloneTemplate = findTemplate(
|
|
1794
|
+
const standaloneTemplate = findTemplate(
|
|
1795
|
+
templateFolders,
|
|
1796
|
+
fileInfo,
|
|
1797
|
+
"example"
|
|
1798
|
+
);
|
|
1754
1799
|
for (const task of dirtyTasks) {
|
|
1755
1800
|
const outputFile = path.join(outputFolder, task.outputFile);
|
|
1756
1801
|
const content = await renderTemplate(standaloneTemplate, {
|
|
@@ -1766,7 +1811,7 @@ function createTemplateLoader(folders) {
|
|
|
1766
1811
|
}
|
|
1767
1812
|
async function render(doc, docs, nav, vendors, options) {
|
|
1768
1813
|
const { fileInfo } = doc;
|
|
1769
|
-
const { outputFolder, cacheFolder } = options;
|
|
1814
|
+
const { outputFolder, cacheFolder, templateFolders } = options;
|
|
1770
1815
|
if (!haveOutputFile(fileInfo)) {
|
|
1771
1816
|
return null;
|
|
1772
1817
|
}
|
|
@@ -1780,7 +1825,7 @@ async function render(doc, docs, nav, vendors, options) {
|
|
|
1780
1825
|
const njk = new nunjucks.Environment(loader, { autoescape: false });
|
|
1781
1826
|
const asyncRender = util.promisify(njk.render);
|
|
1782
1827
|
const renderTemplate = asyncRender.bind(njk);
|
|
1783
|
-
const template = findTemplate(doc.fileInfo, doc);
|
|
1828
|
+
const template = findTemplate(templateFolders, doc.fileInfo, doc);
|
|
1784
1829
|
const templateData = {
|
|
1785
1830
|
...options.templateData,
|
|
1786
1831
|
site: options.site,
|
|
@@ -1901,6 +1946,7 @@ async function render(doc, docs, nav, vendors, options) {
|
|
|
1901
1946
|
fileInfo,
|
|
1902
1947
|
cacheFolder,
|
|
1903
1948
|
outputFolder,
|
|
1949
|
+
templateFolders,
|
|
1904
1950
|
tasks: generatedStandalone,
|
|
1905
1951
|
renderTemplate,
|
|
1906
1952
|
templateData
|
|
@@ -2241,7 +2287,6 @@ async function stage(stage2, context, processors, { verbose } = { verbose: true
|
|
|
2241
2287
|
}
|
|
2242
2288
|
} catch (err) {
|
|
2243
2289
|
console.error(`When running processor "${processor.name}":`);
|
|
2244
|
-
console.error(err);
|
|
2245
2290
|
throw err;
|
|
2246
2291
|
}
|
|
2247
2292
|
}
|
|
@@ -2425,6 +2470,7 @@ class Generator {
|
|
|
2425
2470
|
return { pages };
|
|
2426
2471
|
}
|
|
2427
2472
|
async build(sourceFiles) {
|
|
2473
|
+
const cwd = process.cwd();
|
|
2428
2474
|
this.sourceFiles = sourceFiles;
|
|
2429
2475
|
const {
|
|
2430
2476
|
site,
|
|
@@ -2439,7 +2485,7 @@ class Generator {
|
|
|
2439
2485
|
const processors = [
|
|
2440
2486
|
fileReaderProcessor(sourceFiles),
|
|
2441
2487
|
vendorProcessor(assetFolder, this.vendor),
|
|
2442
|
-
cssAssetProcessor(assetFolder, this.styles),
|
|
2488
|
+
cssAssetProcessor(assetFolder, this.styles, { cwd }),
|
|
2443
2489
|
jsAssetProcessor(assetFolder, this.scripts),
|
|
2444
2490
|
staticResourcesProcessor(assetFolder, this.resources),
|
|
2445
2491
|
navigationProcessor(),
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// src/runtime/motd/motd.ts
|
|
4
|
+
var container = document.querySelector("#motd-container");
|
|
5
|
+
function showMessage(root, container2, message) {
|
|
6
|
+
const { template: id = "motd-message" } = message;
|
|
7
|
+
const selector = `template#${id}`;
|
|
8
|
+
const template = root.querySelector(selector);
|
|
9
|
+
if (!template) {
|
|
10
|
+
throw new Error(`MOTD template element with id "${id}" not found!`);
|
|
11
|
+
}
|
|
12
|
+
const wrapper = template.content.cloneNode(true);
|
|
13
|
+
const bindings = {
|
|
14
|
+
message: message.message,
|
|
15
|
+
...message.bindings
|
|
16
|
+
};
|
|
17
|
+
for (const element of wrapper.querySelectorAll(
|
|
18
|
+
"[data-bind]"
|
|
19
|
+
)) {
|
|
20
|
+
const key = element.dataset.bind;
|
|
21
|
+
const value = bindings[key] ?? "";
|
|
22
|
+
element.innerHTML = value;
|
|
23
|
+
element.removeAttribute("data-bind");
|
|
24
|
+
}
|
|
25
|
+
if (message.preprocess) {
|
|
26
|
+
message.preprocess(wrapper);
|
|
27
|
+
}
|
|
28
|
+
container2.append(wrapper);
|
|
29
|
+
}
|
|
30
|
+
var motd = {
|
|
31
|
+
enabled: true,
|
|
32
|
+
showMessage: showMessage.bind(null, document, container)
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// src/runtime/motd/motd-symbol.ts
|
|
36
|
+
var motdSymbol = Symbol.for("motd");
|
|
37
|
+
|
|
38
|
+
// src/runtime/motd/index.ts
|
|
39
|
+
window[motdSymbol] = motd;
|
|
@@ -1902,7 +1902,28 @@ function memoize(callback) {
|
|
|
1902
1902
|
};
|
|
1903
1903
|
}
|
|
1904
1904
|
|
|
1905
|
+
// src/runtime/motd/motd-symbol.ts
|
|
1906
|
+
var motdSymbol = Symbol.for("motd");
|
|
1907
|
+
|
|
1908
|
+
// src/runtime/motd/motd-proxy.ts
|
|
1909
|
+
var motdProxy = {
|
|
1910
|
+
get enabled() {
|
|
1911
|
+
return Boolean(window[motdSymbol]);
|
|
1912
|
+
},
|
|
1913
|
+
showMessage(...args) {
|
|
1914
|
+
if (window[motdSymbol]) {
|
|
1915
|
+
window[motdSymbol].showMessage(...args);
|
|
1916
|
+
} else {
|
|
1917
|
+
throw new Error(
|
|
1918
|
+
"motdProcessor(..) not enabled, cannot call showMessage(..)!"
|
|
1919
|
+
);
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
};
|
|
1923
|
+
|
|
1905
1924
|
// src/runtime/select-version.ts
|
|
1925
|
+
var current = __PKG_VERSION__;
|
|
1926
|
+
var message = __MESSAGE__;
|
|
1906
1927
|
var dialog = document.querySelector("#version-dialog");
|
|
1907
1928
|
var dialogCloseButton = dialog?.querySelector("button");
|
|
1908
1929
|
var form = document.querySelector("#version");
|
|
@@ -1929,11 +1950,21 @@ function clickOutside(event) {
|
|
|
1929
1950
|
async function fetchVersions() {
|
|
1930
1951
|
const url = getUrl(document, "../versions.json");
|
|
1931
1952
|
const response = await fetch(url);
|
|
1932
|
-
|
|
1933
|
-
|
|
1953
|
+
if (!response.ok) {
|
|
1954
|
+
console.error("An error occured when loading versions.json.");
|
|
1955
|
+
return {
|
|
1956
|
+
latest: current,
|
|
1957
|
+
versions: [current]
|
|
1958
|
+
};
|
|
1959
|
+
}
|
|
1960
|
+
return await response.json();
|
|
1934
1961
|
}
|
|
1935
1962
|
var getVersions = memoize(fetchVersions);
|
|
1936
|
-
function initVersionProcessor() {
|
|
1963
|
+
async function initVersionProcessor() {
|
|
1964
|
+
const { latest } = await getVersions();
|
|
1965
|
+
if (motdProxy.enabled && latest !== current) {
|
|
1966
|
+
motdProxy.showMessage({ message });
|
|
1967
|
+
}
|
|
1937
1968
|
if (!dialog || !dialogCloseButton || !form) {
|
|
1938
1969
|
return;
|
|
1939
1970
|
}
|
|
@@ -1946,7 +1977,7 @@ function initVersionProcessor() {
|
|
|
1946
1977
|
form.addEventListener("submit", async (event) => {
|
|
1947
1978
|
event.preventDefault();
|
|
1948
1979
|
try {
|
|
1949
|
-
const versions = await getVersions();
|
|
1980
|
+
const { versions } = await getVersions();
|
|
1950
1981
|
updateVersionList(versions);
|
|
1951
1982
|
} catch {
|
|
1952
1983
|
setErrorMessage();
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A runtime proxy for the motd api. When the `motdProcessor(..)` is installed
|
|
3
|
+
* the calls are routed to the actual API implementation or when not installed
|
|
4
|
+
* it gives useful error messages.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare const motd: MOTDApi;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare interface MOTDApi {
|
|
14
|
+
readonly enabled: boolean;
|
|
15
|
+
showMessage(message: MOTDMessage): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare interface MOTDMessage {
|
|
22
|
+
/** Text message (may include HTML) */
|
|
23
|
+
message: string;
|
|
24
|
+
/** ID of message template to use */
|
|
25
|
+
template?: string;
|
|
26
|
+
/** Optional extra bindings */
|
|
27
|
+
bindings?: Record<string, string>;
|
|
28
|
+
/** Called with the new DOM element before the element is shown */
|
|
29
|
+
preprocess?(element: DocumentFragment): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
1
32
|
/**
|
|
2
33
|
* Executes callback when DOM is ready. If DOM is already ready the callback is
|
|
3
34
|
* executed during the next cycle.
|
package/dist/runtime.js
CHANGED
|
@@ -139029,6 +139029,7 @@ var init_architectureDiagram_IFBEXTG3 = __esm({
|
|
|
139029
139029
|
// src/runtime/index.ts
|
|
139030
139030
|
var runtime_exports = {};
|
|
139031
139031
|
__export(runtime_exports, {
|
|
139032
|
+
motd: () => motdProxy,
|
|
139032
139033
|
onContentReady: () => onContentReady
|
|
139033
139034
|
});
|
|
139034
139035
|
module.exports = __toCommonJS(runtime_exports);
|
|
@@ -141930,6 +141931,25 @@ onContentReady(() => {
|
|
|
141930
141931
|
calculateVisibility(refs);
|
|
141931
141932
|
});
|
|
141932
141933
|
|
|
141934
|
+
// src/runtime/motd/motd-symbol.ts
|
|
141935
|
+
var motdSymbol = Symbol.for("motd");
|
|
141936
|
+
|
|
141937
|
+
// src/runtime/motd/motd-proxy.ts
|
|
141938
|
+
var motdProxy = {
|
|
141939
|
+
get enabled() {
|
|
141940
|
+
return Boolean(window[motdSymbol]);
|
|
141941
|
+
},
|
|
141942
|
+
showMessage(...args) {
|
|
141943
|
+
if (window[motdSymbol]) {
|
|
141944
|
+
window[motdSymbol].showMessage(...args);
|
|
141945
|
+
} else {
|
|
141946
|
+
throw new Error(
|
|
141947
|
+
"motdProcessor(..) not enabled, cannot call showMessage(..)!"
|
|
141948
|
+
);
|
|
141949
|
+
}
|
|
141950
|
+
}
|
|
141951
|
+
};
|
|
141952
|
+
|
|
141933
141953
|
// src/runtime/index.ts
|
|
141934
141954
|
window.toggleMarkup = toggleMarkup;
|
|
141935
141955
|
/*! Bundled license information:
|
package/dist/style/core.css
CHANGED
|
@@ -179,7 +179,7 @@ pre code {
|
|
|
179
179
|
.docs-topnav__item {
|
|
180
180
|
display: inline-flex;
|
|
181
181
|
list-style-type: none;
|
|
182
|
-
padding: 1.1rem 0 0
|
|
182
|
+
padding: 1.1rem 0 0;
|
|
183
183
|
white-space: nowrap;
|
|
184
184
|
}
|
|
185
185
|
.docs-topnav__item.highlight {
|
|
@@ -832,10 +832,7 @@ h1 code {
|
|
|
832
832
|
/* Page header - inverted */
|
|
833
833
|
header .page-header {
|
|
834
834
|
background-color: #fff;
|
|
835
|
-
padding
|
|
836
|
-
padding-bottom: 0.5rem;
|
|
837
|
-
padding-left: 1.2rem;
|
|
838
|
-
padding-right: 1.2rem;
|
|
835
|
+
padding: 0.5rem 1.2rem;
|
|
839
836
|
border-bottom: 1px solid #ddddde;
|
|
840
837
|
flex-wrap: wrap;
|
|
841
838
|
}
|
package/dist/style/index.css
CHANGED
|
@@ -179,7 +179,7 @@ pre code {
|
|
|
179
179
|
.docs-topnav__item {
|
|
180
180
|
display: inline-flex;
|
|
181
181
|
list-style-type: none;
|
|
182
|
-
padding: 1.1rem 0 0
|
|
182
|
+
padding: 1.1rem 0 0;
|
|
183
183
|
white-space: nowrap;
|
|
184
184
|
}
|
|
185
185
|
.docs-topnav__item.highlight {
|
|
@@ -832,10 +832,7 @@ h1 code {
|
|
|
832
832
|
/* Page header - inverted */
|
|
833
833
|
header .page-header {
|
|
834
834
|
background-color: #fff;
|
|
835
|
-
padding
|
|
836
|
-
padding-bottom: 0.5rem;
|
|
837
|
-
padding-left: 1.2rem;
|
|
838
|
-
padding-right: 1.2rem;
|
|
835
|
+
padding: 0.5rem 1.2rem;
|
|
839
836
|
border-bottom: 1px solid #ddddde;
|
|
840
837
|
flex-wrap: wrap;
|
|
841
838
|
}
|
|
@@ -1196,13 +1193,6 @@ kbd {
|
|
|
1196
1193
|
background-color: #f4f4f4;
|
|
1197
1194
|
}
|
|
1198
1195
|
|
|
1199
|
-
.cookie-warning {
|
|
1200
|
-
background: var(--docs-cookie-background-color);
|
|
1201
|
-
border-bottom: 2px solid var(--docs-cookie-border-color);
|
|
1202
|
-
display: none;
|
|
1203
|
-
padding: 1rem 1.5rem 0;
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
1196
|
:root {
|
|
1207
1197
|
--docs-font-family: arial, "Helvetica Neue", sans-serif;
|
|
1208
1198
|
--docs-font-weight: normal;
|
|
@@ -1236,6 +1226,11 @@ kbd {
|
|
|
1236
1226
|
--docs-messagebox-warning-background: var(--docs-warning-background);
|
|
1237
1227
|
--docs-messagebox-danger-border: var(--docs-error-color);
|
|
1238
1228
|
--docs-messagebox-danger-background: var(--docs-error-background);
|
|
1229
|
+
--docs-motd-text-color: var(--docs-text-color-discrete);
|
|
1230
|
+
--docs-motd-info-accent-color: #4a52b6;
|
|
1231
|
+
--docs-motd-info-background-color: #f5f6fa;
|
|
1232
|
+
--docs-motd-link-color: var(--docs-text-color-discrete);
|
|
1233
|
+
--docs-motd-hover-color: var(--docs-text-color-default);
|
|
1239
1234
|
--docs-tags-optional-background-color: transparent;
|
|
1240
1235
|
--docs-tags-optional-border-color: #5f6165;
|
|
1241
1236
|
--docs-tags-optional-text-color: var(--docs-text-color-discrete);
|
|
@@ -1312,6 +1307,51 @@ textarea {
|
|
|
1312
1307
|
margin: 0;
|
|
1313
1308
|
}
|
|
1314
1309
|
|
|
1310
|
+
.cookie-warning {
|
|
1311
|
+
background: var(--docs-cookie-background-color);
|
|
1312
|
+
border-bottom: 2px solid var(--docs-cookie-border-color);
|
|
1313
|
+
display: none;
|
|
1314
|
+
padding: 1rem 1.5rem 0;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
.docs-motd {
|
|
1318
|
+
padding: 1.5rem;
|
|
1319
|
+
margin: 0.5rem;
|
|
1320
|
+
color: var(--docs-motd-text-color);
|
|
1321
|
+
}
|
|
1322
|
+
.docs-motd a {
|
|
1323
|
+
color: var(--docs-motd-link-color);
|
|
1324
|
+
}
|
|
1325
|
+
.docs-motd a:hover, .docs-motd a:focus {
|
|
1326
|
+
color: var(--docs-motd-hover-color);
|
|
1327
|
+
}
|
|
1328
|
+
.docs-motd p:last-child {
|
|
1329
|
+
margin-bottom: 0;
|
|
1330
|
+
}
|
|
1331
|
+
.docs-motd--info {
|
|
1332
|
+
border: 2px solid var(--docs-motd-info-accent-color);
|
|
1333
|
+
border-top: 1rem solid var(--docs-motd-info-accent-color);
|
|
1334
|
+
background-color: var(--docs-motd-info-background-color);
|
|
1335
|
+
border-radius: 2px;
|
|
1336
|
+
}
|
|
1337
|
+
.docs-motd--info .icon--circle {
|
|
1338
|
+
color: #fff;
|
|
1339
|
+
}
|
|
1340
|
+
.docs-motd--info .icon--i {
|
|
1341
|
+
color: var(--docs-motd-text-color);
|
|
1342
|
+
}
|
|
1343
|
+
.docs-motd__icon {
|
|
1344
|
+
float: left;
|
|
1345
|
+
height: 1.5rem;
|
|
1346
|
+
margin: 0 0.4rem 0 0;
|
|
1347
|
+
width: 1.5rem;
|
|
1348
|
+
}
|
|
1349
|
+
.docs-motd__icon .icon,
|
|
1350
|
+
.docs-motd__icon .icon-stack {
|
|
1351
|
+
height: 1.5rem;
|
|
1352
|
+
width: 1.5rem;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1315
1355
|
.version {
|
|
1316
1356
|
color: var(--docs-text-color-discrete);
|
|
1317
1357
|
text-wrap: nowrap;
|
|
@@ -1353,4 +1393,15 @@ body {
|
|
|
1353
1393
|
.page-header {
|
|
1354
1394
|
--docs-text-color-default: var(--docs-header-text-color-default);
|
|
1355
1395
|
--docs-text-color-discrete: var(--docs-header-text-color-discrete);
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
.sr-only {
|
|
1399
|
+
position: absolute;
|
|
1400
|
+
width: 1px;
|
|
1401
|
+
height: 1px;
|
|
1402
|
+
margin: -1px;
|
|
1403
|
+
padding: 0;
|
|
1404
|
+
overflow: hidden;
|
|
1405
|
+
clip: rect(0, 0, 0, 0);
|
|
1406
|
+
border: 0;
|
|
1356
1407
|
}
|
package/dist/style/site.css
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
.cookie-warning {
|
|
2
|
-
background: var(--docs-cookie-background-color);
|
|
3
|
-
border-bottom: 2px solid var(--docs-cookie-border-color);
|
|
4
|
-
display: none;
|
|
5
|
-
padding: 1rem 1.5rem 0;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
1
|
:root {
|
|
9
2
|
--docs-font-family: arial, "Helvetica Neue", sans-serif;
|
|
10
3
|
--docs-font-weight: normal;
|
|
@@ -38,6 +31,11 @@
|
|
|
38
31
|
--docs-messagebox-warning-background: var(--docs-warning-background);
|
|
39
32
|
--docs-messagebox-danger-border: var(--docs-error-color);
|
|
40
33
|
--docs-messagebox-danger-background: var(--docs-error-background);
|
|
34
|
+
--docs-motd-text-color: var(--docs-text-color-discrete);
|
|
35
|
+
--docs-motd-info-accent-color: #4a52b6;
|
|
36
|
+
--docs-motd-info-background-color: #f5f6fa;
|
|
37
|
+
--docs-motd-link-color: var(--docs-text-color-discrete);
|
|
38
|
+
--docs-motd-hover-color: var(--docs-text-color-default);
|
|
41
39
|
--docs-tags-optional-background-color: transparent;
|
|
42
40
|
--docs-tags-optional-border-color: #5f6165;
|
|
43
41
|
--docs-tags-optional-text-color: var(--docs-text-color-discrete);
|
|
@@ -114,6 +112,51 @@ textarea {
|
|
|
114
112
|
margin: 0;
|
|
115
113
|
}
|
|
116
114
|
|
|
115
|
+
.cookie-warning {
|
|
116
|
+
background: var(--docs-cookie-background-color);
|
|
117
|
+
border-bottom: 2px solid var(--docs-cookie-border-color);
|
|
118
|
+
display: none;
|
|
119
|
+
padding: 1rem 1.5rem 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.docs-motd {
|
|
123
|
+
padding: 1.5rem;
|
|
124
|
+
margin: 0.5rem;
|
|
125
|
+
color: var(--docs-motd-text-color);
|
|
126
|
+
}
|
|
127
|
+
.docs-motd a {
|
|
128
|
+
color: var(--docs-motd-link-color);
|
|
129
|
+
}
|
|
130
|
+
.docs-motd a:hover, .docs-motd a:focus {
|
|
131
|
+
color: var(--docs-motd-hover-color);
|
|
132
|
+
}
|
|
133
|
+
.docs-motd p:last-child {
|
|
134
|
+
margin-bottom: 0;
|
|
135
|
+
}
|
|
136
|
+
.docs-motd--info {
|
|
137
|
+
border: 2px solid var(--docs-motd-info-accent-color);
|
|
138
|
+
border-top: 1rem solid var(--docs-motd-info-accent-color);
|
|
139
|
+
background-color: var(--docs-motd-info-background-color);
|
|
140
|
+
border-radius: 2px;
|
|
141
|
+
}
|
|
142
|
+
.docs-motd--info .icon--circle {
|
|
143
|
+
color: #fff;
|
|
144
|
+
}
|
|
145
|
+
.docs-motd--info .icon--i {
|
|
146
|
+
color: var(--docs-motd-text-color);
|
|
147
|
+
}
|
|
148
|
+
.docs-motd__icon {
|
|
149
|
+
float: left;
|
|
150
|
+
height: 1.5rem;
|
|
151
|
+
margin: 0 0.4rem 0 0;
|
|
152
|
+
width: 1.5rem;
|
|
153
|
+
}
|
|
154
|
+
.docs-motd__icon .icon,
|
|
155
|
+
.docs-motd__icon .icon-stack {
|
|
156
|
+
height: 1.5rem;
|
|
157
|
+
width: 1.5rem;
|
|
158
|
+
}
|
|
159
|
+
|
|
117
160
|
:root {
|
|
118
161
|
--docs-breakpoint-sm: 640px;
|
|
119
162
|
--docs-breakpoint-md: 1024px;
|
|
@@ -161,4 +204,15 @@ body {
|
|
|
161
204
|
.page-header {
|
|
162
205
|
--docs-text-color-default: var(--docs-header-text-color-default);
|
|
163
206
|
--docs-text-color-discrete: var(--docs-header-text-color-discrete);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.sr-only {
|
|
210
|
+
position: absolute;
|
|
211
|
+
width: 1px;
|
|
212
|
+
height: 1px;
|
|
213
|
+
margin: -1px;
|
|
214
|
+
padding: 0;
|
|
215
|
+
overflow: hidden;
|
|
216
|
+
clip: rect(0, 0, 0, 0);
|
|
217
|
+
border: 0;
|
|
164
218
|
}
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -12754,51 +12754,82 @@ function generateCode(options) {
|
|
|
12754
12754
|
const selector = `#${slug}`;
|
|
12755
12755
|
const asset = `${slug}-${fingerprint}.js`;
|
|
12756
12756
|
const { descriptor, errors } = require$$0.parse(code, { filename });
|
|
12757
|
+
const scopeId = `data-v-${fingerprint}`;
|
|
12757
12758
|
if (errors.length) {
|
|
12758
12759
|
throw new Error(`Errors occured when trying to parse ${filename}.`);
|
|
12759
12760
|
}
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12764
|
-
|
|
12765
|
-
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
);
|
|
12770
|
-
|
|
12771
|
-
|
|
12761
|
+
const hasScoped = descriptor.styles.some((e) => e.scoped);
|
|
12762
|
+
const styleContent = descriptor.styles.map((stylePart) => {
|
|
12763
|
+
const compiledStyle = require$$0.compileStyle({
|
|
12764
|
+
filename: descriptor.filename,
|
|
12765
|
+
source: stylePart.content,
|
|
12766
|
+
isProd: false,
|
|
12767
|
+
id: scopeId,
|
|
12768
|
+
scoped: stylePart.scoped,
|
|
12769
|
+
trim: true
|
|
12770
|
+
});
|
|
12771
|
+
return compiledStyle.code;
|
|
12772
|
+
}).join("\n");
|
|
12772
12773
|
let sourcecode = `import { setup } from "${setupPath}";
|
|
12773
12774
|
`;
|
|
12774
|
-
|
|
12775
|
-
|
|
12776
|
-
|
|
12777
|
-
|
|
12778
|
-
|
|
12775
|
+
let bindings = void 0;
|
|
12776
|
+
if (descriptor.script || descriptor.scriptSetup) {
|
|
12777
|
+
const script = require$$0.compileScript(descriptor, {
|
|
12778
|
+
id: scopeId,
|
|
12779
|
+
isProd: false,
|
|
12780
|
+
sourceMap: false,
|
|
12781
|
+
inlineTemplate: false,
|
|
12782
|
+
genDefaultAs: "exampleComponent",
|
|
12783
|
+
templateOptions: {
|
|
12784
|
+
id: scopeId,
|
|
12785
|
+
filename,
|
|
12786
|
+
source: descriptor.template?.content,
|
|
12787
|
+
scoped: hasScoped,
|
|
12788
|
+
slotted: descriptor.slotted,
|
|
12789
|
+
compilerOptions: {
|
|
12790
|
+
comments: false,
|
|
12791
|
+
whitespace: "condense",
|
|
12792
|
+
scopeId: hasScoped ? scopeId : void 0,
|
|
12793
|
+
mode: "module"
|
|
12794
|
+
}
|
|
12795
|
+
}
|
|
12796
|
+
});
|
|
12797
|
+
bindings = script.bindings;
|
|
12798
|
+
sourcecode += script.content;
|
|
12799
|
+
sourcecode += "\n\n";
|
|
12779
12800
|
} else {
|
|
12780
12801
|
sourcecode += `const exampleComponent = {};
|
|
12802
|
+
|
|
12781
12803
|
`;
|
|
12782
12804
|
}
|
|
12783
12805
|
if (descriptor.template) {
|
|
12784
|
-
const
|
|
12785
|
-
id:
|
|
12806
|
+
const template = require$$0.compileTemplate({
|
|
12807
|
+
id: scopeId,
|
|
12786
12808
|
filename,
|
|
12787
12809
|
source: descriptor.template.content,
|
|
12810
|
+
scoped: hasScoped,
|
|
12811
|
+
slotted: descriptor.slotted,
|
|
12788
12812
|
preprocessLang: descriptor.template.lang,
|
|
12789
12813
|
compilerOptions: {
|
|
12814
|
+
bindingMetadata: bindings,
|
|
12790
12815
|
comments: false,
|
|
12791
|
-
whitespace: "
|
|
12816
|
+
whitespace: "condense",
|
|
12817
|
+
scopeId: hasScoped ? scopeId : void 0,
|
|
12818
|
+
mode: "module"
|
|
12792
12819
|
}
|
|
12793
12820
|
});
|
|
12794
|
-
sourcecode += `${
|
|
12821
|
+
sourcecode += `${template.code}
|
|
12795
12822
|
|
|
12796
12823
|
`;
|
|
12797
12824
|
sourcecode += `exampleComponent.render = render;
|
|
12798
|
-
|
|
12799
12825
|
`;
|
|
12800
12826
|
}
|
|
12801
|
-
|
|
12827
|
+
if (hasScoped) {
|
|
12828
|
+
sourcecode += `exampleComponent.__scopeId = "${scopeId}";
|
|
12829
|
+
`;
|
|
12830
|
+
}
|
|
12831
|
+
sourcecode += `
|
|
12832
|
+
setup({
|
|
12802
12833
|
rootComponent: exampleComponent,
|
|
12803
12834
|
selector: "${selector}"
|
|
12804
12835
|
});
|
package/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{%- macro motd(message) %}
|
|
2
|
+
<div class="docs-motd docs-motd--info">
|
|
3
|
+
<span class="docs-motd__icon">
|
|
4
|
+
<span class="icon-stack icon-stack--info">
|
|
5
|
+
<svg class="icon icon--circle" focusable="false" aria-hidden="true">
|
|
6
|
+
<use xlink:href="#docs-icon-circle"></use>
|
|
7
|
+
</svg>
|
|
8
|
+
<svg class="icon icon--i" focusable="false" aria-hidden="true">
|
|
9
|
+
<use xlink:href="#docs-icon-i"></use>
|
|
10
|
+
</svg>
|
|
11
|
+
</span>
|
|
12
|
+
</span>
|
|
13
|
+
{%- if message -%}
|
|
14
|
+
<span class="sr-only">Informationsmeddelande</span>
|
|
15
|
+
<p>{{ message }}</p>
|
|
16
|
+
{%- else -%}
|
|
17
|
+
<span data-bind="screenreader" class="sr-only"></span>
|
|
18
|
+
<p data-bind="message"></p>
|
|
19
|
+
{%- endif -%}
|
|
20
|
+
</div>
|
|
21
|
+
{% endmacro -%}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
{
|
|
1
|
+
<div class="footer">
|
|
2
|
+
<!-- prettier-ignore -->
|
|
3
|
+
{% container "footer" %}
|
|
4
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{% from "macro/motd.njk.html" import motd -%}
|
|
2
|
+
|
|
3
|
+
{# template used for dynamic messages #}
|
|
4
|
+
<template id="motd-message">
|
|
5
|
+
{{- motd() -}}
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
{# container hold all messages #}
|
|
9
|
+
<div id="motd-container">
|
|
10
|
+
{# render all static messages #}
|
|
11
|
+
{%- if message -%}
|
|
12
|
+
{{- motd(message) -}}
|
|
13
|
+
{%- endif -%}
|
|
14
|
+
</div>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<div id="version-banner" class="message-box message-box--info" style="display: none">
|
|
2
|
-
<span class="message-box__icon">
|
|
3
|
-
<span class="icon-stack icon-stack--info">
|
|
4
|
-
<svg class="icon__info icon" focusable="false" aria-hidden="true">
|
|
5
|
-
<use xlink:href="#docs-icon-circle"></use>
|
|
6
|
-
</svg>
|
|
7
|
-
<svg class="icon" focusable="false" aria-hidden="true">
|
|
8
|
-
<use xlink:href="#docs-icon-i"></use>
|
|
9
|
-
</svg>
|
|
10
|
-
</span>
|
|
11
|
-
</span>
|
|
12
|
-
<span class="sr-only">Informationsmeddelande</span>
|
|
13
|
-
<p>{{ message }}</p>
|
|
14
|
-
</div>
|