@brillout/docpress 0.10.10 → 0.10.12

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/+config.ts CHANGED
@@ -25,7 +25,7 @@ export default {
25
25
  },
26
26
  } satisfies Config
27
27
 
28
- type ReactComponent = () => JSX.Element
28
+ type ReactComponent = () => React.JSX.Element
29
29
  declare global {
30
30
  namespace Vike {
31
31
  interface PageContext {
package/Layout.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  export { Layout }
2
2
  export { MenuToggle }
3
3
  export { containerQueryMobileLayout }
4
- export { containerQueryMobileMenu }
4
+ export { containerQueryMobileNav as containerQueryMobileMenu }
5
5
  export { navLeftWidthMin }
6
6
  export { navLeftWidthMax }
7
7
  export { unexpandNav }
@@ -27,10 +27,11 @@ import { getRepoHref } from './components'
27
27
  const blockMargin = 3
28
28
  const mainViewPadding = 20
29
29
  const mainViewWidthMax = 800
30
- const navLeftWidthMax = 370
31
- const navLeftWidthMin = 300
32
30
  const mainViewMax = (mainViewWidthMax + mainViewPadding * 2) as 840 // 840 = 800 + 20 * 2
33
- const containerQueryMobileMenu = 1000
31
+ const navLeftWidthMin = 300
32
+ const navLeftWidthMax = 370
33
+ const containerQuerySmallNav = 550
34
+ const containerQueryMobileNav = 1000
34
35
  const containerQueryMobileLayout = (mainViewMax + navLeftWidthMin) as 1143 // 1143 = 840 + 300
35
36
  const containerQueryExtraSpace = (mainViewMax + navLeftWidthMax + blockMargin) as 1213 // 1213 = 840 + 370 + 3
36
37
 
@@ -48,7 +49,7 @@ function Layout({ children }: { children: React.ReactNode }) {
48
49
  const pageContext = usePageContext()
49
50
  const { isLandingPage } = pageContext
50
51
 
51
- let content: JSX.Element
52
+ let content: React.JSX.Element
52
53
  if (isLandingPage) {
53
54
  content = <LayoutLandingPage>{children}</LayoutLandingPage>
54
55
  } else {
@@ -346,10 +347,10 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
346
347
  justifyContent: 'center',
347
348
  }}
348
349
  >
349
- <NavLogo className="mobile-grow-half" />
350
+ <NavLogo className="grow-half" />
350
351
  {!isNavLeft && <div className="desktop-grow" />}
351
- <SearchLink className="mobile-grow-half" style={menuLinkStyle} />
352
- <MenuToggleMain className="mobile-grow-full" style={menuLinkStyle} />
352
+ <SearchLink className="grow-half" style={menuLinkStyle} />
353
+ <MenuToggleMain className="grow-full" style={menuLinkStyle} />
353
354
  {navSecondaryContent}
354
355
  </div>
355
356
  </div>
@@ -359,21 +360,32 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
359
360
 
360
361
  function getStyle() {
361
362
  let style = css`
362
- @container container-nav-head (max-width: 550px) {
363
- .mobile-grow-full {
363
+ @container container-nav-head (max-width: ${containerQuerySmallNav}px) {
364
+ .grow-full {
364
365
  flex-grow: 1;
365
366
  }
366
- .mobile-grow-half {
367
+ .grow-half {
367
368
  flex-grow: 0.5;
368
369
  }
369
370
  .nav-head-content {
370
371
  --padding-side: 0px;
371
372
  }
372
373
  .nav-logo {
374
+ justify-content: flex-start;
373
375
  padding-left: 15px;
374
376
  margin-left: -10px;
375
377
  }
376
378
  }
379
+ @container container-viewport (max-width: ${containerQuerySmallNav}px) {
380
+ .grow-half {
381
+ flex-grow: 1 !important;
382
+ }
383
+ .nav-logo {
384
+ justify-content: center;
385
+ padding: 0;
386
+ margin: 0;
387
+ }
388
+ }
377
389
  @container container-nav-head (min-width: 501px) {
378
390
  .nav-head-content {
379
391
  --padding-side: 24px;
@@ -382,12 +394,12 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
382
394
  padding: 0 var(--padding-side);
383
395
  }
384
396
  }
385
- @container container-nav-head (min-width: ${containerQueryMobileMenu + 100}px) {
397
+ @container container-nav-head (min-width: ${containerQueryMobileNav + 100}px) {
386
398
  .nav-head-content {
387
399
  --padding-side: 35px;
388
400
  }
389
401
  }
390
- @media(max-width: ${containerQueryMobileMenu}px) {
402
+ @media(max-width: ${containerQueryMobileNav}px) {
391
403
  .hide-on-shrink {
392
404
  display: none !important;
393
405
  }
@@ -395,7 +407,7 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
395
407
  `
396
408
  if (navMaxWidth) {
397
409
  style += css`
398
- @media(min-width: ${containerQueryMobileMenu + 1}px) {
410
+ @media(min-width: ${containerQueryMobileNav + 1}px) {
399
411
  .desktop-grow {
400
412
  flex-grow: 1;
401
413
  }
@@ -404,7 +416,7 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
404
416
  }
405
417
  if (isLandingPage && !navMaxWidth)
406
418
  style += css`
407
- @media(min-width: ${containerQueryMobileMenu + 1}px) {
419
+ @media(min-width: ${containerQueryMobileNav + 1}px) {
408
420
  .nav-logo {
409
421
  display: none !important;
410
422
  }
@@ -477,9 +489,8 @@ function NavLogo({ className }: { className: string }) {
477
489
  style={{
478
490
  display: 'flex',
479
491
  alignItems: 'center',
480
- color: 'inherit',
481
492
  height: '100%',
482
- justifyContent: 'flex-start',
493
+ color: 'inherit',
483
494
  }}
484
495
  href="/"
485
496
  >
@@ -525,12 +536,12 @@ function MenuToggleMain(props: PropsDiv) {
525
536
  <MenuIcon /> Menu
526
537
  </span>
527
538
  <Style>{css`
528
- @media(max-width: ${containerQueryMobileMenu}px) {
539
+ @media(max-width: ${containerQueryMobileNav}px) {
529
540
  .text-docs {
530
541
  display: none !important;
531
542
  }
532
543
  }
533
- @media(min-width: ${containerQueryMobileMenu + 1}px) {
544
+ @media(min-width: ${containerQueryMobileNav + 1}px) {
534
545
  .text-menu {
535
546
  display: none;
536
547
  }
@@ -63,7 +63,7 @@ function NavItemComponent({
63
63
  )
64
64
  }
65
65
 
66
- let children: JSX.Element = titleInNavJsx
66
+ let children: React.JSX.Element = titleInNavJsx
67
67
  if (navItem.level === 1) {
68
68
  children = (
69
69
  <>
@@ -28,7 +28,7 @@ function Link({
28
28
  `<Link href /> prop \`href==='${href}'\` but should start with '/' or '#'`,
29
29
  )
30
30
  assertUsage(!text || !children, 'Cannot use both `text` or `children`')
31
- assertWarning(!text, 'prop `text` is deprecated')
31
+ // assertWarning(!text, 'prop `text` is deprecated')
32
32
  text = text ?? children
33
33
 
34
34
  if (isRepoLink(href)) {
@@ -55,10 +55,10 @@ function getLinkText({
55
55
  }: {
56
56
  noBreadcrumb: true | undefined
57
57
  linkData: LinkData
58
- sectionTitle: JSX.Element | null
58
+ sectionTitle: React.JSX.Element | null
59
59
  isLinkOnSamePage: boolean
60
- }): JSX.Element {
61
- const breadcrumbParts: JSX.Element[] = []
60
+ }): React.JSX.Element {
61
+ const breadcrumbParts: React.JSX.Element[] = []
62
62
  if (linkData.linkBreadcrumb) {
63
63
  breadcrumbParts.push(...(linkData.linkBreadcrumb ?? []).slice().reverse().map(parseMarkdownMini))
64
64
  }
@@ -91,7 +91,7 @@ function getLinkTextData(href: string, pageContext: PageContextResolved, doNotIn
91
91
  const isLinkOnSamePage = linkData.url === pageContext.urlPathname
92
92
  if (!hrefPathname) assert(isLinkOnSamePage)
93
93
 
94
- let sectionTitle: JSX.Element | null = null
94
+ let sectionTitle: React.JSX.Element | null = null
95
95
  if (hrefHash) {
96
96
  assert(!hrefHash.startsWith('#'))
97
97
  if (isLinkOnSamePage) {
@@ -39,7 +39,7 @@ function Danger(props: Props) {
39
39
  function NoteWithoutIcon(props: Props) {
40
40
  return <NoteGeneric icon={null} {...props} />
41
41
  }
42
- type CustomIcon = JSX.Element | string
42
+ type CustomIcon = React.JSX.Element | string
43
43
  function NoteWithCustomIcon(props: Props & { icon: CustomIcon }) {
44
44
  const { icon } = props
45
45
  if (!icon) throw new Error(`<NoteWithCustomIcon icon={/*...*/}> property 'icon' is \`${icon}\` which is forbidden`)
package/dist/+config.d.ts CHANGED
@@ -29,7 +29,7 @@ declare const _default: {
29
29
  };
30
30
  };
31
31
  export default _default;
32
- type ReactComponent = () => JSX.Element;
32
+ type ReactComponent = () => React.JSX.Element;
33
33
  declare global {
34
34
  namespace Vike {
35
35
  interface PageContext {
@@ -21,7 +21,7 @@ function Link(_a) {
21
21
  var pageContext = usePageContext();
22
22
  assertUsage(href.startsWith('/') || href.startsWith('#'), "<Link href /> prop `href==='".concat(href, "'` but should start with '/' or '#'"));
23
23
  assertUsage(!text || !children, 'Cannot use both `text` or `children`');
24
- assertWarning(!text, 'prop `text` is deprecated');
24
+ // assertWarning(!text, 'prop `text` is deprecated')
25
25
  text = text !== null && text !== void 0 ? text : children;
26
26
  if (isRepoLink(href)) {
27
27
  return React.createElement(RepoLink, { path: href, text: text });
@@ -17,7 +17,7 @@ declare function Construction(props: Props): React.JSX.Element;
17
17
  declare function Contribution(props: Props): React.JSX.Element;
18
18
  declare function Danger(props: Props): React.JSX.Element;
19
19
  declare function NoteWithoutIcon(props: Props): React.JSX.Element;
20
- type CustomIcon = JSX.Element | string;
20
+ type CustomIcon = React.JSX.Element | string;
21
21
  declare function NoteWithCustomIcon(props: Props & {
22
22
  icon: CustomIcon;
23
23
  }): React.JSX.Element;
@@ -1,2 +1,3 @@
1
1
  export { parseMarkdownMini };
2
- declare function parseMarkdownMini(markdown: string): JSX.Element;
2
+ import React from 'react';
3
+ declare function parseMarkdownMini(markdown: string): React.JSX.Element;
@@ -5,4 +5,4 @@ type EmojiName = 'warning' | 'typescript' | 'shield' | 'mechanical-arm' | 'mount
5
5
  declare function Emoji({ name, style }: {
6
6
  name: EmojiName;
7
7
  style?: React.CSSProperties;
8
- }): JSX.Element;
8
+ }): React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  export { jsxToTextContent };
2
- declare function jsxToTextContent(node: JSX.Element): string;
2
+ declare function jsxToTextContent(node: React.JSX.Element): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.10.10",
3
+ "version": "0.10.12",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@brillout/picocolors": "^1.0.10",
@@ -2,7 +2,7 @@ export { parseMarkdownMini }
2
2
 
3
3
  import React from 'react'
4
4
 
5
- function parseMarkdownMini(markdown: string): JSX.Element {
5
+ function parseMarkdownMini(markdown: string): React.JSX.Element {
6
6
  type Part = { nodeType: 'text' | 'code'; content: string }
7
7
  const parts: Part[] = []
8
8
  let current: Part | undefined
package/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference types="vite/client" />
2
2
 
3
3
  declare module '*.mdx' {
4
- const value: (props?: any) => JSX.Element
4
+ const value: (props?: any) => React.JSX.Element
5
5
  export default value
6
6
  export const headings: { level: number; title: string; id: string }[]
7
7
  }
@@ -37,7 +37,7 @@ type EmojiName =
37
37
  | 'trophy'
38
38
  | 'ribbon'
39
39
 
40
- function Emoji({ name, style }: { name: EmojiName; style?: React.CSSProperties }): JSX.Element {
40
+ function Emoji({ name, style }: { name: EmojiName; style?: React.CSSProperties }): React.JSX.Element {
41
41
  const emoji =
42
42
  // ***
43
43
  // U+26A0
@@ -3,7 +3,7 @@ import { assert } from './assert'
3
3
  export { jsxToTextContent }
4
4
 
5
5
  // https://stackoverflow.com/questions/34204975/react-is-there-something-similar-to-node-textcontent/60564620#60564620
6
- function jsxToTextContent(node: JSX.Element): string {
6
+ function jsxToTextContent(node: React.JSX.Element): string {
7
7
  if (['string', 'number'].includes(typeof node)) return String(node)
8
8
  if (node instanceof Array) return node.map(jsxToTextContent).join('')
9
9
  if (typeof node === 'object' && node) return jsxToTextContent(node.props.children)