@forsakringskassan/docs-generator 2.35.2 → 2.35.4

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/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, b as closest, e as distance, f as fm, i as isCI, h as glob, j as moduleImporter, k as cliProgress, t as tinylr, w as watch, l as createInstance, n as fse, o as inter } from './vendor-BtGCZQy4.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-gWhxglZr.mjs';
7
+ import { g as globSync, m as minimatch, M as MarkdownIt, d as dedent, b as closest, e as distance, f as fm, i as isCI, h as glob, j as moduleImporter, k as cliProgress, t as tinylr, w as watch, l as createInstance, n as fse, o as inter } from './vendor-Dd3EDAs1.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-C3-r8Xp9.mjs';
9
9
  import sp__default from 'node:path';
10
10
  import require$$1 from 'crypto';
11
11
  import 'node:crypto';
@@ -1597,6 +1597,46 @@ function getEventDeprecated(event) {
1597
1597
  return tag.content;
1598
1598
  }
1599
1599
  }
1600
+ function isSimpleName(name) {
1601
+ return /^[a-z0-9]+$/i.test(name);
1602
+ }
1603
+ function getPropType(prop) {
1604
+ const { type } = prop;
1605
+ if (!type) {
1606
+ return null;
1607
+ }
1608
+ if (type.name === "string" && prop.values) {
1609
+ return prop.values.map((value) => `"${value}"`).join(" | ");
1610
+ }
1611
+ if (type.name === "Array") {
1612
+ const param = type;
1613
+ const element = param.elements?.[0];
1614
+ if (!element) {
1615
+ return "any[]";
1616
+ }
1617
+ if (isSimpleName(element.name)) {
1618
+ return `${element.name}[]`;
1619
+ } else {
1620
+ return `Array<${element.name}>`;
1621
+ }
1622
+ }
1623
+ if (type.name === "tuple") {
1624
+ const param = type;
1625
+ if (!param.elements) {
1626
+ return type.name;
1627
+ }
1628
+ const constituents = param.elements.map((it) => it.name).join(", ");
1629
+ return `[${constituents}]`;
1630
+ }
1631
+ if (type.name === "union") {
1632
+ const param = type;
1633
+ if (!param.elements) {
1634
+ return type.name;
1635
+ }
1636
+ return param.elements.map((it) => it.name).join(" | ");
1637
+ }
1638
+ return type.name;
1639
+ }
1600
1640
  function translateProps(props) {
1601
1641
  const isRelevant = (prop) => {
1602
1642
  return prop.tags?.ignore === void 0;
@@ -1606,7 +1646,7 @@ function translateProps(props) {
1606
1646
  return {
1607
1647
  name: prop.name,
1608
1648
  description: prop.description ?? null,
1609
- type: prop.type?.name ?? null,
1649
+ type: getPropType(prop),
1610
1650
  required: Boolean(prop.required),
1611
1651
  default: defaultValue,
1612
1652
  deprecated: getPropSlotDeprecated(prop)