@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 +1 -1
- package/Layout.tsx +30 -19
- package/NavItemComponent.tsx +1 -1
- package/components/Link.tsx +5 -5
- package/components/Note.tsx +1 -1
- package/dist/+config.d.ts +1 -1
- package/dist/components/Link.js +1 -1
- package/dist/components/Note.d.ts +1 -1
- package/dist/parseMarkdownMini.d.ts +2 -1
- package/dist/utils/Emoji/Emoji.d.ts +1 -1
- package/dist/utils/jsxToTextContent.d.ts +1 -1
- package/package.json +1 -1
- package/parseMarkdownMini.ts +1 -1
- package/types.d.ts +1 -1
- package/utils/Emoji/Emoji.ts +1 -1
- package/utils/jsxToTextContent.ts +1 -1
package/+config.ts
CHANGED
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
|
|
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="
|
|
350
|
+
<NavLogo className="grow-half" />
|
|
350
351
|
{!isNavLeft && <div className="desktop-grow" />}
|
|
351
|
-
<SearchLink className="
|
|
352
|
-
<MenuToggleMain className="
|
|
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:
|
|
363
|
-
.
|
|
363
|
+
@container container-nav-head (max-width: ${containerQuerySmallNav}px) {
|
|
364
|
+
.grow-full {
|
|
364
365
|
flex-grow: 1;
|
|
365
366
|
}
|
|
366
|
-
.
|
|
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: ${
|
|
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: ${
|
|
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: ${
|
|
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: ${
|
|
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
|
-
|
|
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: ${
|
|
539
|
+
@media(max-width: ${containerQueryMobileNav}px) {
|
|
529
540
|
.text-docs {
|
|
530
541
|
display: none !important;
|
|
531
542
|
}
|
|
532
543
|
}
|
|
533
|
-
@media(min-width: ${
|
|
544
|
+
@media(min-width: ${containerQueryMobileNav + 1}px) {
|
|
534
545
|
.text-menu {
|
|
535
546
|
display: none;
|
|
536
547
|
}
|
package/NavItemComponent.tsx
CHANGED
package/components/Link.tsx
CHANGED
|
@@ -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) {
|
package/components/Note.tsx
CHANGED
|
@@ -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
package/dist/components/Link.js
CHANGED
|
@@ -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,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
package/parseMarkdownMini.ts
CHANGED
|
@@ -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
package/utils/Emoji/Emoji.ts
CHANGED
|
@@ -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)
|