@forsakringskassan/docs-generator 2.28.11 → 2.29.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/{create-markdown-renderer-DcyK76t5.mjs → create-markdown-renderer-CQxhXDbC.mjs} +4 -4
- package/dist/{create-markdown-renderer-DcyK76t5.mjs.map → create-markdown-renderer-CQxhXDbC.mjs.map} +1 -1
- package/dist/index.mjs +85 -21
- package/dist/index.mjs.map +1 -1
- package/dist/markdown.mjs +3 -3
- package/dist/runtime.mjs +3206 -3014
- package/dist/{vendor-CMzqoPR8.mjs → vendor-OuaFLIX7.mjs} +6 -5
- package/dist/vendor-OuaFLIX7.mjs.map +1 -0
- package/dist/{vue3-CprzF_70.mjs → vue3-BOnqvtDm.mjs} +24 -24
- package/dist/vue3-BOnqvtDm.mjs.map +1 -0
- package/dist/{worker-DxdZEcOj.mjs → worker-Dal4yTwy.mjs} +3 -3
- package/dist/{worker-DxdZEcOj.mjs.map → worker-Dal4yTwy.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/vendor-CMzqoPR8.mjs.map +0 -1
- package/dist/vue3-CprzF_70.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -4,8 +4,8 @@ const require = $createRequire(import.meta.url);
|
|
|
4
4
|
|
|
5
5
|
import fs from 'node:fs/promises';
|
|
6
6
|
import path from 'node:path/posix';
|
|
7
|
-
import { g as globSync, m as minimatch, M as MarkdownIt, d as dedent, e as closest, f as distance, h as fm, i as isCI, j as glob, k as moduleImporter, l as cliProgress, t as tinylr, w as watch, n as createInstance, o as fse } from './vendor-
|
|
8
|
-
import { g as generateId, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, f as findTag, b as getOutputFilePath, d as htmlencode, e as exampleWorkerUrl, c as createMarkdownRenderer, j as generateExample } from './create-markdown-renderer-
|
|
7
|
+
import { g as globSync, m as minimatch, M as MarkdownIt, d as dedent, e as closest, f as distance, h as fm, i as isCI, j as glob, k as moduleImporter, l as cliProgress, t as tinylr, w as watch, n as createInstance, o as fse } from './vendor-OuaFLIX7.mjs';
|
|
8
|
+
import { g as generateId, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, f as findTag, b as getOutputFilePath, d as htmlencode, e as exampleWorkerUrl, c as createMarkdownRenderer, j as generateExample } from './create-markdown-renderer-CQxhXDbC.mjs';
|
|
9
9
|
import path$1 from 'node:path';
|
|
10
10
|
import require$$1 from 'crypto';
|
|
11
11
|
import 'node:crypto';
|
|
@@ -47,7 +47,7 @@ import 'tls';
|
|
|
47
47
|
import 'tty';
|
|
48
48
|
import 'querystring';
|
|
49
49
|
import 'vue';
|
|
50
|
-
import './vue3-
|
|
50
|
+
import './vue3-BOnqvtDm.mjs';
|
|
51
51
|
|
|
52
52
|
function toArray$2(value) {
|
|
53
53
|
return Array.isArray(value) ? value : [value];
|
|
@@ -284,8 +284,8 @@ function slugify(value) {
|
|
|
284
284
|
return value.toLowerCase().replace(/\//g, "--").replace(/[^a-z]+/g, "-").replace(/(^-+|-+$)/, "");
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
const md$
|
|
288
|
-
md$
|
|
287
|
+
const md$6 = MarkdownIt();
|
|
288
|
+
md$6.renderer.rules.fence = (tokens, idx, _options, collected) => {
|
|
289
289
|
const { content, info } = tokens[idx];
|
|
290
290
|
const { language, tags } = parseInfostring(info);
|
|
291
291
|
if (language === "import") {
|
|
@@ -306,7 +306,7 @@ function findExamples$1(doc) {
|
|
|
306
306
|
return [];
|
|
307
307
|
}
|
|
308
308
|
const collected = [];
|
|
309
|
-
md$
|
|
309
|
+
md$6.render(doc.body, collected);
|
|
310
310
|
return collected;
|
|
311
311
|
}
|
|
312
312
|
function getSuffix(tags) {
|
|
@@ -373,8 +373,8 @@ function extractExamplesProcessor(options) {
|
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
const md$
|
|
377
|
-
md$
|
|
376
|
+
const md$5 = MarkdownIt();
|
|
377
|
+
md$5.renderer.rules.fence = (tokens, idx, _options, collected) => {
|
|
378
378
|
const { content, info, map } = tokens[idx];
|
|
379
379
|
const { language: rawLanguage, tags } = parseInfostring(info);
|
|
380
380
|
const hashContent = `${map?.[0]}:${map?.[1]}:${info}:${content}`;
|
|
@@ -412,7 +412,7 @@ function findExamples(doc) {
|
|
|
412
412
|
return [];
|
|
413
413
|
}
|
|
414
414
|
const collected = [];
|
|
415
|
-
md$
|
|
415
|
+
md$5.render(doc.body, collected);
|
|
416
416
|
return collected;
|
|
417
417
|
}
|
|
418
418
|
function manifestPageFromDocument(doc) {
|
|
@@ -1239,30 +1239,91 @@ function translateSlotBindings(slot) {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
return translatedBindings;
|
|
1241
1241
|
}
|
|
1242
|
+
function filterModels(rawProps, rawEvents) {
|
|
1243
|
+
const modelEvents = rawEvents.filter((it) => it.name.startsWith("update:"));
|
|
1244
|
+
const rawModels = modelEvents.map((it) => {
|
|
1245
|
+
const propName = it.name.slice("update:".length);
|
|
1246
|
+
const prop = rawProps.find((it2) => it2.name === propName);
|
|
1247
|
+
if (!prop) {
|
|
1248
|
+
return null;
|
|
1249
|
+
}
|
|
1250
|
+
return {
|
|
1251
|
+
...prop,
|
|
1252
|
+
name: propName === "modelValue" ? "v-model" : `v-model:${propName}`
|
|
1253
|
+
};
|
|
1254
|
+
});
|
|
1255
|
+
const models = rawModels.filter((model) => model !== null);
|
|
1256
|
+
const events = rawEvents.filter((it) => !it.name.startsWith("update:"));
|
|
1257
|
+
const props = rawProps.filter((prop) => {
|
|
1258
|
+
const hasModelName = models.some(
|
|
1259
|
+
(model) => model.name.slice("v-model:".length) === prop.name
|
|
1260
|
+
);
|
|
1261
|
+
return !(hasModelName || prop.name.startsWith("modelValue"));
|
|
1262
|
+
});
|
|
1263
|
+
return { models, props, events };
|
|
1264
|
+
}
|
|
1242
1265
|
async function translateAPI(filePath) {
|
|
1243
1266
|
const api = await parse(filePath);
|
|
1244
|
-
const
|
|
1245
|
-
const
|
|
1267
|
+
const rawProps = api.props ? translateProps(api.props) : [];
|
|
1268
|
+
const rawEvents = api.events ? translateEvents(api.events) : [];
|
|
1269
|
+
const { models, props, events } = filterModels(rawProps, rawEvents);
|
|
1246
1270
|
const slots = api.slots ? translateSlots(api.slots) : [];
|
|
1247
|
-
for (const event of events) {
|
|
1248
|
-
if (!event.name.startsWith("update:")) {
|
|
1249
|
-
continue;
|
|
1250
|
-
}
|
|
1251
|
-
const prop = event.name.slice("update:".length);
|
|
1252
|
-
const entry = props.find((it) => it.name === prop);
|
|
1253
|
-
if (entry) {
|
|
1254
|
-
entry.name = prop === "modelValue" ? "v-model" : `v-model:${prop}`;
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
1271
|
return {
|
|
1258
1272
|
name: api.displayName,
|
|
1259
1273
|
slug: slugify(api.displayName),
|
|
1274
|
+
models,
|
|
1260
1275
|
props,
|
|
1261
1276
|
events,
|
|
1262
1277
|
slots
|
|
1263
1278
|
};
|
|
1264
1279
|
}
|
|
1265
1280
|
|
|
1281
|
+
const md$4 = MarkdownIt();
|
|
1282
|
+
const EMPTY_CHAR$4 = "‐";
|
|
1283
|
+
function render$5(text) {
|
|
1284
|
+
return text ? md$4.render(text) : EMPTY_CHAR$4;
|
|
1285
|
+
}
|
|
1286
|
+
function renderInline$4(text) {
|
|
1287
|
+
return text ? md$4.renderInline(text) : EMPTY_CHAR$4;
|
|
1288
|
+
}
|
|
1289
|
+
function generateModelTable(slug, models) {
|
|
1290
|
+
return (
|
|
1291
|
+
/* HTML */
|
|
1292
|
+
`
|
|
1293
|
+
<next-heading-level id="${slug}-models">
|
|
1294
|
+
<a class="header-anchor" href="#${slug}-models">Models</a>
|
|
1295
|
+
</next-heading-level>
|
|
1296
|
+
<dl class="docs-api docs-api--models">
|
|
1297
|
+
${models.map((model) => {
|
|
1298
|
+
const { name } = model;
|
|
1299
|
+
const id = `${slug}-model-${slugify(name)}`;
|
|
1300
|
+
return (
|
|
1301
|
+
/* HTML */
|
|
1302
|
+
`
|
|
1303
|
+
<dt>
|
|
1304
|
+
<code id="${id}"
|
|
1305
|
+
><a class="docs-api__anchor" href="#${id}"
|
|
1306
|
+
><span class="docs-api__name"
|
|
1307
|
+
>${htmlencode(name)}</span
|
|
1308
|
+
>: ${htmlencode(model.type ?? "unknown")}</a
|
|
1309
|
+
></code
|
|
1310
|
+
>
|
|
1311
|
+
${model.required ? "" : `<span class="docs-tag docs-tag--default">Optional</span>`}
|
|
1312
|
+
${model.deprecated === null ? "" : `<span class="docs-tag docs-tag--deprecated">Deprecated</span>`}
|
|
1313
|
+
</dt>
|
|
1314
|
+
<dd>
|
|
1315
|
+
${render$5(model.description)}
|
|
1316
|
+
${model.default ? `<p class="doc-api__item">Default: <code>${htmlencode(model.default.value)}</code></p>` : ""}
|
|
1317
|
+
${model.deprecated ? `<p class="doc-api__item docs-deprecated">Deprecated: ${renderInline$4(model.deprecated)}</p>` : ""}
|
|
1318
|
+
</dd>
|
|
1319
|
+
`
|
|
1320
|
+
);
|
|
1321
|
+
}).join("")}
|
|
1322
|
+
</dl>
|
|
1323
|
+
`
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1266
1327
|
const md$3 = MarkdownIt();
|
|
1267
1328
|
const EMPTY_CHAR$3 = "‐";
|
|
1268
1329
|
function render$4(text) {
|
|
@@ -1661,6 +1722,9 @@ function parseAPI(filePath, api) {
|
|
|
1661
1722
|
const parsedPath = path$1.parse(relative);
|
|
1662
1723
|
const componentName = parsedPath.name;
|
|
1663
1724
|
let html = "";
|
|
1725
|
+
if (api.models.length) {
|
|
1726
|
+
html += generateModelTable(api.slug, api.models);
|
|
1727
|
+
}
|
|
1664
1728
|
if (api.props.length) {
|
|
1665
1729
|
html += generatePropTable(api.slug, api.props);
|
|
1666
1730
|
}
|