@mintlify/common 1.0.897 → 1.0.898

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.
@@ -0,0 +1,16 @@
1
+ import { DecoratedNavigationConfig } from '@mintlify/validation';
2
+ /**
3
+ * Generates a map from page paths to whether they are hidden from search,
4
+ * sitemap, AI assistant, and llms.txt indexing. Mirrors generatePathToHiddenDict
5
+ * for nav purposes, but a node with `hidden: true, searchable: true` opts its
6
+ * descendants back into indexing — they remain hidden in the rendered nav.
7
+ *
8
+ * Semantic:
9
+ * - Walking down the tree, an "indexable" chain is broken by `hidden: true`
10
+ * unless the same node also has `searchable: true`, in which case the
11
+ * chain is restored from that point down.
12
+ * - `searchable` on a non-hidden node has no effect.
13
+ * - A page's own frontmatter `hidden: true` is always honored.
14
+ * - Output keys have no leading /.
15
+ */
16
+ export declare function generatePathToHiddenFromSearchDict(decoratedNav: DecoratedNavigationConfig): Map<string, boolean>;
@@ -0,0 +1,61 @@
1
+ import { divisions } from '@mintlify/validation';
2
+ import { isPage } from '../navigation/isPage.js';
3
+ import { optionallyRemoveLeadingSlash } from '../optionallyRemoveLeadingSlash.js';
4
+ import { iterateObjectArrayProperty } from './iterateObjectArrayProperty.js';
5
+ /**
6
+ * Generates a map from page paths to whether they are hidden from search,
7
+ * sitemap, AI assistant, and llms.txt indexing. Mirrors generatePathToHiddenDict
8
+ * for nav purposes, but a node with `hidden: true, searchable: true` opts its
9
+ * descendants back into indexing — they remain hidden in the rendered nav.
10
+ *
11
+ * Semantic:
12
+ * - Walking down the tree, an "indexable" chain is broken by `hidden: true`
13
+ * unless the same node also has `searchable: true`, in which case the
14
+ * chain is restored from that point down.
15
+ * - `searchable` on a non-hidden node has no effect.
16
+ * - A page's own frontmatter `hidden: true` is always honored.
17
+ * - Output keys have no leading /.
18
+ */
19
+ export function generatePathToHiddenFromSearchDict(decoratedNav) {
20
+ const dict = new Map();
21
+ recurse(dict, decoratedNav, false);
22
+ return dict;
23
+ }
24
+ function recurse(dict, nav, ancestorHiddenAndNotOptedIn) {
25
+ var _a;
26
+ if (typeof nav !== 'object')
27
+ return;
28
+ const hasExplicitHidden = 'hidden' in nav && typeof nav.hidden === 'boolean';
29
+ const ownHidden = hasExplicitHidden && nav.hidden === true;
30
+ const ownSearchable = 'searchable' in nav && nav.searchable === true;
31
+ let effectiveHidden;
32
+ if (ownHidden) {
33
+ effectiveHidden = !ownSearchable;
34
+ }
35
+ else if (hasExplicitHidden) {
36
+ effectiveHidden = false;
37
+ }
38
+ else {
39
+ effectiveHidden = ancestorHiddenAndNotOptedIn;
40
+ }
41
+ if (isPage(nav)) {
42
+ const key = optionallyRemoveLeadingSlash(nav.href);
43
+ const pageHidden = (_a = nav.hidden) !== null && _a !== void 0 ? _a : effectiveHidden;
44
+ if (pageHidden && !dict.has(key)) {
45
+ dict.set(key, true);
46
+ }
47
+ }
48
+ if ('pages' in nav && Array.isArray(nav.pages)) {
49
+ if ('root' in nav && typeof nav.root === 'object') {
50
+ recurse(dict, nav.root, effectiveHidden);
51
+ }
52
+ for (const page of nav.pages) {
53
+ if (typeof page === 'object') {
54
+ recurse(dict, page, effectiveHidden);
55
+ }
56
+ }
57
+ }
58
+ for (const key of ['groups', ...divisions]) {
59
+ iterateObjectArrayProperty(nav, key, (item) => recurse(dict, item, effectiveHidden));
60
+ }
61
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './iterateObjectArrayProperty.js';
2
2
  export * from './generatePathToHiddenDict.js';
3
+ export * from './generatePathToHiddenFromSearchDict.js';
3
4
  export * from './generatePathToVersionDict.js';
4
5
  export * from './generatePathToVersionDictForDocsConfig.js';
5
6
  export * from './generatePathToLanguageDict.js';
@@ -1,5 +1,6 @@
1
1
  export * from './iterateObjectArrayProperty.js';
2
2
  export * from './generatePathToHiddenDict.js';
3
+ export * from './generatePathToHiddenFromSearchDict.js';
3
4
  export * from './generatePathToVersionDict.js';
4
5
  export * from './generatePathToVersionDictForDocsConfig.js';
5
6
  export * from './generatePathToLanguageDict.js';