@qualcomm-ui/mdx-vite 3.3.3 → 3.5.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/cli.js CHANGED
@@ -4450,10 +4450,11 @@ function extractPickPropsRecord(node) {
4450
4450
  }
4451
4451
  return result;
4452
4452
  }
4453
- var targetMdxElements = [
4453
+ var docPropsJsxNodes = [
4454
4454
  "TypeDocProps",
4455
4455
  "TypeDocAttributes",
4456
- "TypeDocAngularAttributes"
4456
+ "TypeDocAngularAttributes",
4457
+ "TypeDocFunction"
4457
4458
  ];
4458
4459
  var DocPropsIndexer = class {
4459
4460
  docPropsEntries = [];
@@ -4475,7 +4476,7 @@ var DocPropsIndexer = class {
4475
4476
  getTypeDocPropsNodes = () => {
4476
4477
  return (tree, _file, done) => {
4477
4478
  visit10(tree, "mdxJsxFlowElement", (node) => {
4478
- if (node && "name" in node && targetMdxElements.includes(node.name)) {
4479
+ if (node && "name" in node && docPropsJsxNodes.includes(node.name)) {
4479
4480
  const nameAttr = node.attributes?.find(
4480
4481
  (attr) => attr.name === "name"
4481
4482
  );
@@ -4562,12 +4563,18 @@ var DocPropsIndexer = class {
4562
4563
  }
4563
4564
  return props;
4564
4565
  };
4566
+ const resolvedType = propTypes.resolvedType;
4567
+ const functionParameters = resolvedType?.type === "signature" && resolvedType.functionParameters?.length ? this.assembleFunctionParams(
4568
+ resolvedType.functionParameters,
4569
+ sections
4570
+ ) : void 0;
4565
4571
  this.pageDocProps[entry.name] = {
4566
4572
  ...this.props[entry.name],
4567
4573
  input: assembleProps(propTypes.input),
4568
4574
  output: assembleProps(propTypes.output),
4569
4575
  props: assembleProps(propTypes.props),
4570
- publicMethods: assembleProps(propTypes.publicMethods)
4576
+ publicMethods: assembleProps(propTypes.publicMethods),
4577
+ resolvedType: functionParameters ? { ...resolvedType, functionParameters } : resolvedType
4571
4578
  };
4572
4579
  return sections;
4573
4580
  }).flat();
@@ -4581,6 +4588,14 @@ var DocPropsIndexer = class {
4581
4588
  return acc;
4582
4589
  }, {});
4583
4590
  }
4591
+ assembleFunctionParams(params, sections) {
4592
+ return params.map((param) => {
4593
+ const id = this.idService.add(param.name);
4594
+ sections.push(this.assembleProp(param, id));
4595
+ const args = param.args?.length ? this.assembleFunctionParams(param.args, sections) : void 0;
4596
+ return { ...param, args, id };
4597
+ });
4598
+ }
4584
4599
  assembleProp(prop, id) {
4585
4600
  const name = prop.name;
4586
4601
  const heading = {
@@ -4945,6 +4960,9 @@ function getRouteMeta(pathSegments, metaJson) {
4945
4960
  // src/docs-plugin/nav-builder/nav-builder.ts
4946
4961
  import { sortBy } from "lodash-es";
4947
4962
  import { v4 as uuidv4 } from "uuid";
4963
+ import {
4964
+ isNavBadge
4965
+ } from "@qualcomm-ui/mdx-common";
4948
4966
  import { capitalCase } from "@qualcomm-ui/utils/change-case";
4949
4967
  import { defined } from "@qualcomm-ui/utils/guard";
4950
4968
  var NavBuilder = class {
@@ -5056,6 +5074,7 @@ var NavBuilder = class {
5056
5074
  this.metaJson
5057
5075
  ) ?? {};
5058
5076
  this.flatNavItems.push({
5077
+ badges: isPage ? this.extractBadges(pageFrontmatter) : void 0,
5059
5078
  depth,
5060
5079
  expanded: routeMeta?.expanded || false,
5061
5080
  group: isPage ? routeMeta.group || pageFrontmatter.group : routeMeta.group,
@@ -5228,6 +5247,13 @@ var NavBuilder = class {
5228
5247
  }
5229
5248
  return results;
5230
5249
  }
5250
+ extractBadges(pageFrontmatter) {
5251
+ const badges = pageFrontmatter.badges;
5252
+ if (badges && typeof badges === "object" && Array.isArray(badges)) {
5253
+ return badges.filter((badge) => isNavBadge(badge) && !badge.hideFromNav);
5254
+ }
5255
+ return void 0;
5256
+ }
5231
5257
  };
5232
5258
 
5233
5259
  // src/docs-plugin/nav-builder/page-map.ts
@@ -5605,7 +5631,8 @@ var SearchIndexer = class {
5605
5631
  docPropSections = cached?.pageDocPropSections || (this.docPropsIndexer.build(fileContents, toc) ?? []);
5606
5632
  docProps = cached?.pageDocProps || this.docPropsIndexer.getDocProps();
5607
5633
  }
5608
- if (docPropSections.length) {
5634
+ const hasDocProps = docPropSections.length || Object.keys(docProps).length;
5635
+ if (hasDocProps) {
5609
5636
  this._pageDocProps[defaultSection.pathname] = docProps;
5610
5637
  if (this.config.validatePageLinks) {
5611
5638
  const ids = /* @__PURE__ */ new Set();