@brillout/docpress 0.7.5 → 0.7.6

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/Layout.tsx CHANGED
@@ -9,11 +9,13 @@ import { NavigationFullscreenButton } from './navigation/navigation-fullscreen/N
9
9
  import { parseTitle } from './parseTitle'
10
10
  import { usePageContext, usePageContext2 } from './renderer/usePageContext'
11
11
  import { Links } from './navigation/NavigationHeader'
12
+ import { hotkeyLabel } from './navigation/navigation-fullscreen/hotkeyLabel'
12
13
 
13
14
  function Layout({ children }: { children: React.ReactNode }) {
14
15
  const pageContext = usePageContext()
15
16
  const pageContext2 = usePageContext2()
16
- const { isLandingPage, pageTitle, navigationData, noSideNavigation, topNavigationList } = pageContext
17
+ const { isLandingPage, pageTitle, navigationData, noSideNavigation, topNavigationList, topNavigationStyle } =
18
+ pageContext
17
19
  const pageTitleParsed = pageTitle && parseTitle(pageTitle)
18
20
  const { globalNote } = pageContext.config
19
21
  const { NavHeader } = pageContext2.config.NavHeader!
@@ -27,23 +29,28 @@ function Layout({ children }: { children: React.ReactNode }) {
27
29
  display: 'flex',
28
30
  color: 'inherit',
29
31
  alignItems: 'center',
30
- justifyContent: 'space-between',
32
+ justifyContent: noSideNavigation === 'no-logo' ? 'center' : 'space-between',
31
33
  textDecoration: 'none',
32
34
  maxWidth: 1024,
33
35
  margin: 'auto',
36
+ ...topNavigationStyle,
34
37
  }}
35
38
  >
36
- <a href="/" style={{ display: 'flex', alignItems: 'center', color: 'inherit' }}>
37
- <NavHeader />
38
- </a>
39
+ {noSideNavigation !== 'no-logo' && (
40
+ <a href="/" style={{ display: 'flex', alignItems: 'center', color: 'inherit' }}>
41
+ <NavHeader />
42
+ </a>
43
+ )}
39
44
  <div style={{ display: 'flex', alignItems: 'center' }}>
40
- <TopNavigationLink id="doclink">Documentation</TopNavigationLink>
45
+ <TopNavigationLink id="doclink" aria-label={hotkeyLabel} data-balloon-pos="left">
46
+ Documentation
47
+ </TopNavigationLink>
41
48
  {topNavigationList.map(({ title, url }) => (
42
49
  <TopNavigationLink href={url!} key={url}>
43
50
  {title}
44
51
  </TopNavigationLink>
45
52
  ))}
46
- <Links style={{ display: 'inline-flex', marginLeft: 10 }} />
53
+ <Links style={{ display: 'inline-flex', marginLeft: 5 }} />
47
54
  </div>
48
55
  </div>
49
56
  )}
@@ -14,7 +14,7 @@
14
14
  }
15
15
  .DocSearch-Button {
16
16
  background: transparent !important;
17
- padding: 3px !important;
17
+ padding: 5px !important;
18
18
  outline: none !important;
19
19
  border: none !important;
20
20
  box-shadow: none !important;
@@ -23,7 +23,7 @@ function resolvePageContext(pageContext: PageContextOriginal) {
23
23
  objectAssign(pageContextResolved, resolveHeadingsData(pageContext))
24
24
 
25
25
  const config = getConfig()
26
- const { faviconUrl, algolia, tagline, twitterHandle, bannerUrl, websiteUrl } = config
26
+ const { faviconUrl, algolia, tagline, twitterHandle, bannerUrl, websiteUrl, topNavigationStyle } = config
27
27
  objectAssign(pageContextResolved, {
28
28
  urlPathname: pageContext.urlPathname, // TODO: remove
29
29
  meta: {
@@ -34,6 +34,7 @@ function resolvePageContext(pageContext: PageContextOriginal) {
34
34
  tagline,
35
35
  algolia,
36
36
  },
37
+ topNavigationStyle,
37
38
  config,
38
39
  })
39
40
 
@@ -13,7 +13,7 @@ declare function resolveHeadingsData(pageContext: PageContextOriginal): {
13
13
  isLandingPage: boolean;
14
14
  pageTitle: string | null;
15
15
  documentTitle: string;
16
- noSideNavigation: true | undefined;
16
+ noSideNavigation: (true | "no-logo") | undefined;
17
17
  topNavigationList: {
18
18
  title: string;
19
19
  url: string | null | undefined;
@@ -20,7 +20,7 @@ declare function resolvePageContext(pageContext: PageContextOriginal): {
20
20
  isLandingPage: boolean;
21
21
  pageTitle: string | null;
22
22
  documentTitle: string;
23
- noSideNavigation: true | undefined;
23
+ noSideNavigation: (true | "no-logo") | undefined;
24
24
  topNavigationList: {
25
25
  title: string;
26
26
  url: string | null | undefined;
@@ -39,5 +39,6 @@ declare function resolvePageContext(pageContext: PageContextOriginal): {
39
39
  indexName: string;
40
40
  } | null;
41
41
  };
42
+ topNavigationStyle: import("react").CSSProperties;
42
43
  config: import("../types/Config").Config;
43
44
  };
@@ -6,7 +6,7 @@ function resolvePageContext(pageContext) {
6
6
  var pageContextResolved = {};
7
7
  objectAssign(pageContextResolved, resolveHeadingsData(pageContext));
8
8
  var config = getConfig();
9
- var faviconUrl = config.faviconUrl, algolia = config.algolia, tagline = config.tagline, twitterHandle = config.twitterHandle, bannerUrl = config.bannerUrl, websiteUrl = config.websiteUrl;
9
+ var faviconUrl = config.faviconUrl, algolia = config.algolia, tagline = config.tagline, twitterHandle = config.twitterHandle, bannerUrl = config.bannerUrl, websiteUrl = config.websiteUrl, topNavigationStyle = config.topNavigationStyle;
10
10
  objectAssign(pageContextResolved, {
11
11
  urlPathname: pageContext.urlPathname, // TODO: remove
12
12
  meta: {
@@ -17,6 +17,7 @@ function resolvePageContext(pageContext) {
17
17
  tagline: tagline,
18
18
  algolia: algolia,
19
19
  },
20
+ topNavigationStyle: topNavigationStyle,
20
21
  config: config,
21
22
  });
22
23
  return pageContextResolved;
@@ -45,10 +45,10 @@ function Links(_a) {
45
45
  return (React.createElement("div", { style: __assign({ display: 'flex', alignItems: 'center', paddingTop: 0, justifyContent: 'left' }, style) },
46
46
  algolia && (React.createElement("div", { className: "decolorize-6 colorize-on-hover" },
47
47
  React.createElement(DocSearch, { appId: algolia.appId, indexName: algolia.indexName, apiKey: algolia.apiKey, insights: true, hitComponent: Hit }))),
48
- React.createElement(LinkIcon, { className: "decolorize-4", icon: iconGithub, href: projectInfo.githubRepository }),
48
+ iconI18n,
49
49
  projectInfo.discordInvite && (React.createElement(LinkIcon, { className: "decolorize-6", icon: iconDiscord, href: projectInfo.discordInvite })),
50
50
  React.createElement(LinkIcon, { className: "decolorize-4", icon: iconTwitter, href: projectInfo.twitterProfile }),
51
- iconI18n,
51
+ React.createElement(LinkIcon, { className: "decolorize-4", icon: iconGithub, href: projectInfo.githubRepository }),
52
52
  React.createElement(ChangelogButton, null)));
53
53
  }
54
54
  function ChangelogButton() {
@@ -58,7 +58,7 @@ function ChangelogButton() {
58
58
  display: 'flex',
59
59
  alignItems: 'center',
60
60
  padding: '1px 7px',
61
- marginLeft: 2,
61
+ marginLeft: 5,
62
62
  fontSize: '0.97em',
63
63
  color: 'inherit',
64
64
  } },
@@ -70,6 +70,6 @@ function ChangelogButton() {
70
70
  function LinkIcon(_a) {
71
71
  var className = _a.className, icon = _a.icon, href = _a.href, style = _a.style;
72
72
  return (React.createElement(React.Fragment, null,
73
- React.createElement("a", { className: 'colorize-on-hover ' + className, href: href, style: { padding: 3, display: 'inline-block', lineHeight: 0 } },
73
+ React.createElement("a", { className: 'colorize-on-hover ' + className, href: href, style: { padding: 5, display: 'inline-block', lineHeight: 0 } },
74
74
  React.createElement("img", { src: icon, height: "20", style: style }))));
75
75
  }
@@ -3,6 +3,7 @@ export { NavigationFullscreenClose };
3
3
  import React from 'react';
4
4
  import './NavigationFullscreenButton.css';
5
5
  import closeIcon from './close.svg';
6
+ import { hotkeyLabel } from './hotkeyLabel';
6
7
  function NavigationFullscreenButton() {
7
8
  return (React.createElement(React.Fragment, null,
8
9
  React.createElement("a", { id: "navigation-fullscreen-button" },
@@ -14,9 +15,9 @@ function NavigationFullscreenButton() {
14
15
  overflow: 'hidden',
15
16
  } },
16
17
  React.createElement("div", null)),
17
- React.createElement("div", { style: { position: 'fixed', height: '100vh', width: 20 }, "aria-label": "Press <Esc>", "data-balloon-pos": "right" }))));
18
+ React.createElement("div", { style: { position: 'fixed', height: '100vh', width: 20 }, "aria-label": hotkeyLabel, "data-balloon-pos": "right" }))));
18
19
  }
19
20
  function NavigationFullscreenClose() {
20
- return (React.createElement("a", { id: "navigation-fullscreen-close", style: { position: 'absolute', top: 11, right: 11, zIndex: 10 }, "aria-label": "Press <Esc>", "data-balloon-pos": "left" },
21
+ return (React.createElement("a", { id: "navigation-fullscreen-close", style: { position: 'absolute', top: 11, right: 11, zIndex: 10 }, "aria-label": hotkeyLabel, "data-balloon-pos": "left" },
21
22
  React.createElement("img", { src: closeIcon, height: 50, width: 50, style: { display: 'block' } })));
22
23
  }
@@ -0,0 +1 @@
1
+ export declare const hotkeyLabel = "Hotkey <Esc>";
@@ -0,0 +1 @@
1
+ export var hotkeyLabel = 'Hotkey <Esc>';
@@ -18,6 +18,7 @@ type Config = {
18
18
  };
19
19
  headings: HeadingDefinition[];
20
20
  headingsDetached: HeadingDetachedDefinition[];
21
+ topNavigationStyle: React.CSSProperties;
21
22
  /** Sets `<meta name="description" content="${tagline}" />` */
22
23
  tagline: string;
23
24
  websiteUrl: string;
@@ -7,7 +7,7 @@ type HeadingResolved = {
7
7
  level: number;
8
8
  title: string;
9
9
  titleInNav: string;
10
- noSideNavigation?: true;
10
+ noSideNavigation?: NoSideNavigation;
11
11
  topNavigation?: true | string;
12
12
  linkBreadcrumb: string[];
13
13
  sectionTitles?: string[];
@@ -27,7 +27,7 @@ type HeadingDetachedDefinition = HeadingDefinitionCommon & {
27
27
  type HeadingDefinition = HeadingDefinitionCommon & {
28
28
  url?: null | string;
29
29
  titleInNav?: string;
30
- noSideNavigation?: true;
30
+ noSideNavigation?: NoSideNavigation;
31
31
  } & HeadingDefinitionLevel & Tmp;
32
32
  type IsCategory = {
33
33
  url?: undefined;
@@ -47,3 +47,4 @@ type HeadingDefinitionLevel = ({
47
47
  type Tmp = {
48
48
  titleDocument?: string;
49
49
  };
50
+ type NoSideNavigation = true | 'no-logo';
@@ -81,12 +81,12 @@ function Links({ style }: { style?: React.CSSProperties }) {
81
81
  />
82
82
  </div>
83
83
  )}
84
- <LinkIcon className="decolorize-4" icon={iconGithub} href={projectInfo.githubRepository} />
84
+ {iconI18n}
85
85
  {projectInfo.discordInvite && (
86
86
  <LinkIcon className="decolorize-6" icon={iconDiscord} href={projectInfo.discordInvite} />
87
87
  )}
88
88
  <LinkIcon className="decolorize-4" icon={iconTwitter} href={projectInfo.twitterProfile} />
89
- {iconI18n}
89
+ <LinkIcon className="decolorize-4" icon={iconGithub} href={projectInfo.githubRepository} />
90
90
  <ChangelogButton />
91
91
  </div>
92
92
  )
@@ -103,7 +103,7 @@ function ChangelogButton() {
103
103
  display: 'flex',
104
104
  alignItems: 'center',
105
105
  padding: '1px 7px',
106
- marginLeft: 2,
106
+ marginLeft: 5,
107
107
  fontSize: '0.97em',
108
108
  color: 'inherit',
109
109
  }}
@@ -122,7 +122,7 @@ function LinkIcon({ className, icon, href, style }: { className: string; icon: s
122
122
  <a
123
123
  className={'colorize-on-hover ' + className}
124
124
  href={href}
125
- style={{ padding: 3, display: 'inline-block', lineHeight: 0 }}
125
+ style={{ padding: 5, display: 'inline-block', lineHeight: 0 }}
126
126
  >
127
127
  <img src={icon} height="20" style={style} />
128
128
  </a>
@@ -4,6 +4,7 @@ export { NavigationFullscreenClose }
4
4
  import React from 'react'
5
5
  import './NavigationFullscreenButton.css'
6
6
  import closeIcon from './close.svg'
7
+ import { hotkeyLabel } from './hotkeyLabel'
7
8
 
8
9
  function NavigationFullscreenButton() {
9
10
  return (
@@ -22,7 +23,7 @@ function NavigationFullscreenButton() {
22
23
  </div>
23
24
  <div
24
25
  style={{ position: 'fixed', height: '100vh', width: 20 }}
25
- aria-label="Press <Esc>"
26
+ aria-label={hotkeyLabel}
26
27
  data-balloon-pos="right"
27
28
  ></div>
28
29
  </a>
@@ -35,7 +36,7 @@ function NavigationFullscreenClose() {
35
36
  <a
36
37
  id="navigation-fullscreen-close"
37
38
  style={{ position: 'absolute', top: 11, right: 11, zIndex: 10 }}
38
- aria-label="Press <Esc>"
39
+ aria-label={hotkeyLabel}
39
40
  data-balloon-pos="left"
40
41
  >
41
42
  <img src={closeIcon} height={50} width={50} style={{ display: 'block' }} />
@@ -0,0 +1 @@
1
+ export const hotkeyLabel = 'Hotkey <Esc>'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@brillout/picocolors": "^1.0.10",
package/types/Config.ts CHANGED
@@ -20,6 +20,7 @@ type Config = {
20
20
  }
21
21
  headings: HeadingDefinition[]
22
22
  headingsDetached: HeadingDetachedDefinition[]
23
+ topNavigationStyle: React.CSSProperties
23
24
 
24
25
  /** Sets `<meta name="description" content="${tagline}" />` */
25
26
  tagline: string
package/types/Heading.ts CHANGED
@@ -8,7 +8,7 @@ type HeadingResolved = {
8
8
  level: number
9
9
  title: string
10
10
  titleInNav: string
11
- noSideNavigation?: true
11
+ noSideNavigation?: NoSideNavigation
12
12
  topNavigation?: true | string
13
13
  linkBreadcrumb: string[]
14
14
  sectionTitles?: string[]
@@ -32,7 +32,7 @@ type HeadingDetachedDefinition = HeadingDefinitionCommon & {
32
32
  type HeadingDefinition = HeadingDefinitionCommon & {
33
33
  url?: null | string
34
34
  titleInNav?: string
35
- noSideNavigation?: true
35
+ noSideNavigation?: NoSideNavigation
36
36
  } & HeadingDefinitionLevel &
37
37
  Tmp
38
38
  type IsCategory = {
@@ -54,3 +54,5 @@ type Tmp = {
54
54
  // TODO: remove? Both Vike and Telefunc set it to the same value than docpress.config.js#projectInfo.projectName
55
55
  titleDocument?: string
56
56
  }
57
+
58
+ type NoSideNavigation = true | 'no-logo'