@brillout/docpress 0.10.20 → 0.10.22

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.
@@ -8,7 +8,7 @@ import type {
8
8
  HeadingResolved,
9
9
  HeadingDetachedResolved,
10
10
  } from '../types/Heading'
11
- import type { Category, Config } from '../types/Config'
11
+ import type { Config } from '../types/Config'
12
12
  import { getConfig } from './getConfig'
13
13
  import type { NavItem } from '../NavItemComponent'
14
14
  import type { LinkData } from '../components'
@@ -28,8 +28,8 @@ type PageSectionResolved = {
28
28
 
29
29
  type ActiveCategory = {
30
30
  name: string
31
- order: NonNullable<Category['order']>
32
- hide: Category['hide']
31
+ order: number
32
+ hide?: boolean
33
33
  }
34
34
 
35
35
  function resolveHeadingsData(pageContext: PageContextOriginal) {
@@ -79,11 +79,15 @@ function resolveHeadingsData(pageContext: PageContextOriginal) {
79
79
  }
80
80
  }
81
81
 
82
- const categoryInfo = config.categories?.[activeCategoryName]
83
- const activeCategory: ActiveCategory = {
82
+ const activeCategory: ActiveCategory = config.categories
83
+ // normalize
84
+ ?.map((c, i) => ({
85
+ order: i,
86
+ ...(typeof c === 'string' ? { name: c } : c),
87
+ }))
88
+ .find((c) => c.name === activeCategoryName) ?? {
84
89
  name: activeCategoryName,
85
- order: categoryInfo?.order ?? 0,
86
- hide: categoryInfo?.hide,
90
+ order: 99999999999,
87
91
  }
88
92
 
89
93
  const pageContextAddendum = {
@@ -1,13 +1,12 @@
1
1
  export { resolveHeadingsData };
2
2
  export type { ActiveCategory };
3
- import type { Category } from '../types/Config';
4
3
  import type { NavItem } from '../NavItemComponent';
5
4
  import type { LinkData } from '../components';
6
5
  import type { PageContextOriginal } from './resolvePageContext';
7
6
  type ActiveCategory = {
8
7
  name: string;
9
- order: NonNullable<Category['order']>;
10
- hide: Category['hide'];
8
+ order: number;
9
+ hide?: boolean;
11
10
  };
12
11
  declare function resolveHeadingsData(pageContext: PageContextOriginal): {
13
12
  navItemsAll: NavItem[];
@@ -58,11 +58,9 @@ function resolveHeadingsData(pageContext) {
58
58
  });
59
59
  }
60
60
  }
61
- var categoryInfo = (_a = config.categories) === null || _a === void 0 ? void 0 : _a[activeCategoryName];
62
- var activeCategory = {
61
+ var activeCategory = (_b = (_a = config.categories) === null || _a === void 0 ? void 0 : _a.map(function (c, i) { return (__assign({ order: i }, (typeof c === 'string' ? { name: c } : c))); }).find(function (c) { return c.name === activeCategoryName; })) !== null && _b !== void 0 ? _b : {
63
62
  name: activeCategoryName,
64
- order: (_b = categoryInfo === null || categoryInfo === void 0 ? void 0 : categoryInfo.order) !== null && _b !== void 0 ? _b : 0,
65
- hide: categoryInfo === null || categoryInfo === void 0 ? void 0 : categoryInfo.hide,
63
+ order: 99999999999,
66
64
  };
67
65
  var pageContextAddendum = {
68
66
  navItemsAll: navItemsAll,
@@ -1,5 +1,4 @@
1
1
  export type { Config };
2
- export type { Category };
3
2
  import type { HeadingDefinition, HeadingDetachedDefinition } from './Heading';
4
3
  type Config = {
5
4
  projectInfo: {
@@ -21,7 +20,7 @@ type Config = {
21
20
  };
22
21
  headings: HeadingDefinition[];
23
22
  headingsDetached: HeadingDetachedDefinition[];
24
- categories?: Record<string, Category>;
23
+ categories?: Category[];
25
24
  /** Sets `<meta name="description" content="${tagline}" />` */
26
25
  tagline: string;
27
26
  websiteUrl: string;
@@ -36,9 +35,9 @@ type Config = {
36
35
  navLogoStyle?: React.CSSProperties;
37
36
  navLogoTextStyle?: React.CSSProperties;
38
37
  };
39
- type Category = {
40
- /** Order in Algolia search results */
41
- order?: number;
38
+ /** Order in Algolia search results */
39
+ type Category = string | {
40
+ name: string;
42
41
  /** Hide from Algolia search */
43
42
  hide?: boolean;
44
43
  };
@@ -17,6 +17,7 @@ function DocSearchInstall() {
17
17
  apiKey={algolia.apiKey}
18
18
  insights={true}
19
19
  hitComponent={Hit}
20
+ maxResultsPerGroup={Infinity}
20
21
  />
21
22
  </div>
22
23
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.10.20",
3
+ "version": "0.10.22",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@brillout/picocolors": "^1.0.10",
package/types/Config.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export type { Config }
2
- export type { Category }
3
2
 
4
3
  import type { HeadingDefinition, HeadingDetachedDefinition } from './Heading'
5
4
 
@@ -23,7 +22,7 @@ type Config = {
23
22
  }
24
23
  headings: HeadingDefinition[]
25
24
  headingsDetached: HeadingDetachedDefinition[]
26
- categories?: Record<string, Category>
25
+ categories?: Category[]
27
26
  /** Sets `<meta name="description" content="${tagline}" />` */
28
27
  tagline: string
29
28
  websiteUrl: string
@@ -39,9 +38,11 @@ type Config = {
39
38
  navLogoTextStyle?: React.CSSProperties
40
39
  }
41
40
 
42
- type Category = {
43
- /** Order in Algolia search results */
44
- order?: number
45
- /** Hide from Algolia search */
46
- hide?: boolean
47
- }
41
+ /** Order in Algolia search results */
42
+ type Category =
43
+ | string
44
+ | {
45
+ name: string
46
+ /** Hide from Algolia search */
47
+ hide?: boolean
48
+ }