@forsakringskassan/docs-generator 2.9.0 → 2.9.2

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.
@@ -105,6 +105,7 @@ async function compileExample(batch) {
105
105
  external,
106
106
  tsconfig,
107
107
  define: {
108
+ "process.env.NODE_ENV": JSON.stringify("development"),
108
109
  "process.env.DOCS_ICON_LIB": JSON.stringify(iconLib)
109
110
  },
110
111
  plugins: [
package/dist/index.d.ts CHANGED
@@ -371,6 +371,7 @@ export declare interface NavigationSection {
371
371
  readonly path: string;
372
372
  readonly sortorder: number;
373
373
  readonly children: NavigationNode[];
374
+ readonly visible: boolean;
374
375
  }
375
376
 
376
377
  /**
@@ -619,6 +620,8 @@ export declare function themeSelectProcessor(): Processor;
619
620
  export declare interface TopnavEntry {
620
621
  path: string;
621
622
  title: string;
623
+ sortorder?: number;
624
+ visible?: boolean;
622
625
  }
623
626
 
624
627
  /**
package/dist/index.js CHANGED
@@ -440,6 +440,7 @@ function generateNavigation(entries) {
440
440
  key,
441
441
  sortorder: index,
442
442
  children: [],
443
+ visible: true,
443
444
  ...it
444
445
  };
445
446
  });
@@ -447,7 +448,8 @@ function generateNavigation(entries) {
447
448
  key: ".",
448
449
  path: "./index.html",
449
450
  sortorder: Infinity,
450
- children
451
+ children,
452
+ visible: true
451
453
  };
452
454
  }
453
455
  function topnavProcessor(filename, title) {
@@ -789,6 +791,16 @@ async function translateAPI(filePath) {
789
791
  const props = api.props ? translateProps(api.props) : [];
790
792
  const events = api.events ? translateEvents(api.events) : [];
791
793
  const slots = api.slots ? translateSlots(api.slots) : [];
794
+ for (const event of events) {
795
+ if (!event.name.startsWith("update:")) {
796
+ continue;
797
+ }
798
+ const prop = event.name.slice("update:".length);
799
+ const entry = props.find((it) => it.name === prop);
800
+ if (entry) {
801
+ entry.name = prop === "modelValue" ? "v-model" : `v-model:${prop}`;
802
+ }
803
+ }
792
804
  return {
793
805
  props,
794
806
  events,
@@ -1337,18 +1349,20 @@ function getParentKey(name) {
1337
1349
  }
1338
1350
  function generateNavtree(docs) {
1339
1351
  const section = {};
1340
- function createSection(key, title, sortorder) {
1352
+ function createSection(key, title, sortorder, { visible } = {}) {
1341
1353
  const existing = section[key];
1342
1354
  if (existing) {
1343
1355
  existing.title = title;
1344
1356
  existing.sortorder = sortorder;
1357
+ existing.visible = visible ?? true;
1345
1358
  } else {
1346
1359
  const node = {
1347
1360
  key,
1348
1361
  title,
1349
1362
  path: "",
1350
1363
  sortorder,
1351
- children: []
1364
+ children: [],
1365
+ visible: visible ?? true
1352
1366
  };
1353
1367
  section[key] = node;
1354
1368
  if (key !== ".") {
@@ -1368,7 +1382,8 @@ function generateNavtree(docs) {
1368
1382
  title: parentKey.split("/").at(-1) ?? "(missing title)",
1369
1383
  path: "",
1370
1384
  sortorder: Infinity,
1371
- children: []
1385
+ children: [],
1386
+ visible: true
1372
1387
  };
1373
1388
  section[parentKey] = parent;
1374
1389
  let anchestor = parentKey;
@@ -1384,7 +1399,8 @@ function generateNavtree(docs) {
1384
1399
  title: "",
1385
1400
  path: "",
1386
1401
  sortorder: Infinity,
1387
- children: [current]
1402
+ children: [current],
1403
+ visible: true
1388
1404
  };
1389
1405
  section[anchestor] = node;
1390
1406
  current = node;
@@ -1415,7 +1431,7 @@ function generateNavtree(docs) {
1415
1431
  }
1416
1432
  if (!doc.visible) {
1417
1433
  if (isSection) {
1418
- createSection(name, title, sortorder);
1434
+ createSection(name, title, sortorder, { visible: false });
1419
1435
  }
1420
1436
  continue;
1421
1437
  }
@@ -1438,13 +1454,15 @@ function generateNavtree(docs) {
1438
1454
  existing.path = leafNode.path;
1439
1455
  existing.sortorder = sortorder;
1440
1456
  existing.children.unshift(leafNode);
1457
+ existing.visible = true;
1441
1458
  } else {
1442
1459
  const sectionNode = {
1443
1460
  key: name,
1444
1461
  title,
1445
1462
  path: leafNode.path,
1446
1463
  sortorder,
1447
- children: [leafNode]
1464
+ children: [leafNode],
1465
+ visible: true
1448
1466
  };
1449
1467
  section[name] = sectionNode;
1450
1468
  parent.children.push(sectionNode);
@@ -1469,7 +1487,8 @@ function generateNavtree(docs) {
1469
1487
  title: "",
1470
1488
  path: "",
1471
1489
  sortorder: Infinity,
1472
- children: []
1490
+ children: [],
1491
+ visible: true
1473
1492
  };
1474
1493
  }
1475
1494
  }
@@ -2005,9 +2024,10 @@ async function compileVendor(assetFolder, vendor, options) {
2005
2024
  platform: "browser",
2006
2025
  tsconfig,
2007
2026
  define: {
2008
- "process.env.NODE_ENV": JSON.stringify(
2009
- process.env.NODE_ENV ?? "production"
2010
- )
2027
+ "process.env.NODE_ENV": JSON.stringify("development"),
2028
+ __VUE_OPTIONS_API__: "true",
2029
+ __VUE_PROD_DEVTOOLS__: "true",
2030
+ __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false"
2011
2031
  },
2012
2032
  alias: vendor.alias ? { [`${vendor.package}`]: vendor.alias } : void 0,
2013
2033
  ...options
@@ -2237,14 +2257,16 @@ function createContext(templateLoader) {
2237
2257
  title: "",
2238
2258
  path: "",
2239
2259
  sortorder: Infinity,
2240
- children: []
2260
+ children: [],
2261
+ visible: true
2241
2262
  };
2242
2263
  let sidenav = {
2243
2264
  key: ".",
2244
2265
  title: "",
2245
2266
  path: "",
2246
2267
  sortorder: Infinity,
2247
- children: []
2268
+ children: [],
2269
+ visible: true
2248
2270
  };
2249
2271
  const templateData = {};
2250
2272
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/docs-generator",
3
- "version": "2.9.0",
3
+ "version": "2.9.2",
4
4
  "description": "Documentation generator",
5
5
  "keywords": [
6
6
  "documentation"
@@ -5,10 +5,11 @@
5
5
  {% set navPath = nav.path | replace("html", "") %}
6
6
  {% set navPath = navPath | replace(".", "") %}
7
7
  {% set activePage = navPath in doc.fileInfo.fullPath %}
8
+ {% if nav.visible %}
8
9
  <li class="docs-topnav__item {% if activePage %}highlight{% endif %}">
9
10
  <a class="docs-topnav__anchor" href="{{ nav.path | relative(doc) }}"> {{ nav.title }} </a>
10
11
  </li>
11
- {%- endfor -%}
12
+ {% endif %} {%- endfor -%}
12
13
  <li class="docs-topnav__item docs-topnav__item--more" style="visibility: hidden">
13
14
  <button type="button" class="docs-topnav__anchor" aria-expanded="false">
14
15
  <span>Mer</span>
@@ -23,10 +24,11 @@
23
24
  {% set navPath = nav.path | replace("html", "") %}
24
25
  {% set navPath = navPath | replace(".", "") %}
25
26
  {% set activePage = navPath in doc.fileInfo.fullPath %}
27
+ {% if nav.visible %}
26
28
  <li class="docs-contextmenu__item {% if activePage %}highlight{% endif %}" style="display: none">
27
29
  <a class="docs-contextmenu__anchor" href="{{ nav.path | relative(doc) }}"> {{ nav.title }} </a>
28
30
  </li>
29
- {%- endfor -%}
31
+ {% endif %} {%- endfor -%}
30
32
  </ul>
31
33
  </div>
32
34
  </li>