@brillout/docpress 0.16.47 → 0.16.49
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/EditLink.tsx +3 -3
- package/ExternalLinks.tsx +2 -2
- package/Layout.tsx +33 -104
- package/MenuModal/NavigationWithColumnLayout.tsx +1 -1
- package/MenuModal.tsx +8 -7
- package/NavItemComponent.css +5 -5
- package/code-blocks/components/Pre.css +1 -0
- package/code-blocks/components/Tabs.css +4 -4
- package/components/index.ts +0 -3
- package/css/code.css +1 -0
- package/css/colorize-on-hover.css +2 -2
- package/css/font.css +2 -2
- package/css/heading.css +8 -3
- package/css/link.css +1 -1
- package/css/table.css +2 -2
- package/css/tokens.css +23 -16
- package/css/tooltip.css +5 -5
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.js +0 -3
- package/dist/renderer/usePageContext.d.ts +0 -16
- package/dist/renderer/usePageContext.js +0 -6
- package/dist/resolvePageContext.d.ts +1 -0
- package/dist/types/Heading.d.ts +6 -0
- package/dist/utils/server.d.ts +0 -2
- package/dist/utils/server.js +0 -2
- package/package.json +5 -2
- package/renderer/usePageContext.tsx +0 -7
- package/types/Heading.ts +6 -0
- package/utils/server.ts +0 -2
- package/components/Comment.tsx +0 -7
- package/components/HorizontalLine.tsx +0 -22
- package/components/P.css +0 -8
- package/components/P.tsx +0 -8
- package/dist/components/Comment.d.ts +0 -3
- package/dist/components/Comment.js +0 -5
- package/dist/components/HorizontalLine.d.ts +0 -5
- package/dist/components/HorizontalLine.js +0 -15
- package/dist/components/P.d.ts +0 -4
- package/dist/components/P.js +0 -6
- package/dist/utils/cls.d.ts +0 -3
- package/dist/utils/cls.js +0 -5
- package/dist/utils/filter.d.ts +0 -2
- package/dist/utils/filter.js +0 -11
- package/dist/utils/objectAssign.d.ts +0 -2
- package/dist/utils/objectAssign.js +0 -5
- package/utils/PassTrough.tsx +0 -7
- package/utils/filesystemPathHandling.ts +0 -42
- package/utils/filter.ts +0 -12
- package/utils/objectAssign.ts +0 -9
package/EditLink.tsx
CHANGED
|
@@ -28,11 +28,11 @@ function EditLink({
|
|
|
28
28
|
paddingBottom: 7,
|
|
29
29
|
paddingLeft: 8,
|
|
30
30
|
paddingRight: 7,
|
|
31
|
-
border: '1px solid var(--color-border, #e0e0e0)',
|
|
31
|
+
border: '1px solid var(--dp-color-border, #e0e0e0)',
|
|
32
32
|
borderRadius: 7,
|
|
33
33
|
fontSize: '0.91em',
|
|
34
|
-
color: 'var(--color-muted, #6c6c6c)',
|
|
35
|
-
background: 'var(--color-surface, #f8f8f8)',
|
|
34
|
+
color: 'var(--dp-color-muted, #6c6c6c)',
|
|
35
|
+
background: 'var(--dp-color-surface, #f8f8f8)',
|
|
36
36
|
letterSpacing: 0.4,
|
|
37
37
|
lineHeight: 0,
|
|
38
38
|
...style,
|
package/ExternalLinks.tsx
CHANGED
|
@@ -63,7 +63,7 @@ function ChangelogButton() {
|
|
|
63
63
|
className="button"
|
|
64
64
|
style={{
|
|
65
65
|
background: '#ffffff4f',
|
|
66
|
-
fontFamily: 'monospace',
|
|
66
|
+
fontFamily: 'var(--dp-font-mono, monospace)',
|
|
67
67
|
letterSpacing: -1,
|
|
68
68
|
display: 'flex',
|
|
69
69
|
alignItems: 'center',
|
|
@@ -83,7 +83,7 @@ function ChangelogButton() {
|
|
|
83
83
|
style={{
|
|
84
84
|
position: 'relative',
|
|
85
85
|
top: 1,
|
|
86
|
-
color: 'var(--color-text)',
|
|
86
|
+
color: 'var(--dp-color-text)',
|
|
87
87
|
}}
|
|
88
88
|
>
|
|
89
89
|
{version}
|
package/Layout.tsx
CHANGED
|
@@ -69,7 +69,8 @@ const whitespaceBuster2: React.CSSProperties = {
|
|
|
69
69
|
|
|
70
70
|
function Layout({ children }: { children: React.ReactNode }) {
|
|
71
71
|
const pageContext = usePageContext()
|
|
72
|
-
const { isLandingPage } = pageContext.resolved
|
|
72
|
+
const { isLandingPage, pageDesign } = pageContext.resolved
|
|
73
|
+
const isTopNavSticky = !isLandingPage && (pageDesign?.topNavSticky ?? true)
|
|
73
74
|
|
|
74
75
|
let content: React.JSX.Element
|
|
75
76
|
if (isLandingPage) {
|
|
@@ -82,10 +83,12 @@ function Layout({ children }: { children: React.ReactNode }) {
|
|
|
82
83
|
return (
|
|
83
84
|
<div
|
|
84
85
|
style={{
|
|
85
|
-
['--color-bg-gray']: 'var(--color-surface, #f5f5f5)',
|
|
86
|
+
['--color-bg-gray']: 'var(--dp-color-surface, #f5f5f5)',
|
|
86
87
|
['--block-margin']: `${blockMargin}px`,
|
|
87
88
|
// ['--nav-head-height']: `${isLandingPage ? 70 : 63}px`,
|
|
88
89
|
['--nav-head-height']: `63px`,
|
|
90
|
+
// Offset for elements sitting below the sticky top nav
|
|
91
|
+
['--nav-head-sticky-offset']: isTopNavSticky ? 'var(--nav-head-height)' : '0px',
|
|
89
92
|
['--main-view-padding']: `${mainViewPadding}px`,
|
|
90
93
|
// We don't add `container` to `body` nor `html` beacuse in Firefox it breaks the `position: fixed` of <MenuModal>
|
|
91
94
|
// https://stackoverflow.com/questions/74601420/css-container-inline-size-and-fixed-child
|
|
@@ -94,9 +97,12 @@ function Layout({ children }: { children: React.ReactNode }) {
|
|
|
94
97
|
margin: 'auto',
|
|
95
98
|
}}
|
|
96
99
|
>
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
<div className={isLandingPage ? 'landing-page' : 'doc-page'} style={whitespaceBuster1}>
|
|
101
|
+
<div style={{ position: isTopNavSticky ? 'sticky' : 'relative', top: 0, zIndex: 100 }}>
|
|
102
|
+
<NavHead />
|
|
103
|
+
{/* <MenuModal> is inside here because `container-type` on the page wrapper traps `position: fixed` — https://github.com/brillout/docpress/pull/177 */}
|
|
104
|
+
<MenuModal isNavLeftAlwaysHidden_={isNavLeftAlwaysHidden_} />
|
|
105
|
+
</div>
|
|
100
106
|
{content}
|
|
101
107
|
</div>
|
|
102
108
|
{/* Early toggling, to avoid layout jumps */}
|
|
@@ -220,10 +226,10 @@ function NavLeft() {
|
|
|
220
226
|
<div
|
|
221
227
|
style={{
|
|
222
228
|
position: 'sticky',
|
|
223
|
-
top
|
|
229
|
+
// Sit below the sticky top nav (or at the very top when the top nav isn't sticky)
|
|
230
|
+
top: 'var(--nav-head-sticky-offset)',
|
|
224
231
|
}}
|
|
225
232
|
>
|
|
226
|
-
<NavHead isNavLeft={true} />
|
|
227
233
|
<div
|
|
228
234
|
style={{
|
|
229
235
|
backgroundColor: 'var(--color-bg-gray)',
|
|
@@ -233,7 +239,7 @@ function NavLeft() {
|
|
|
233
239
|
id="navigation-container"
|
|
234
240
|
style={{
|
|
235
241
|
top: 0,
|
|
236
|
-
height: `calc(100vh - var(--nav-head-
|
|
242
|
+
height: `calc(100vh - var(--nav-head-sticky-offset) - var(--block-margin))`,
|
|
237
243
|
overflowY: 'auto',
|
|
238
244
|
overscrollBehavior: 'contain',
|
|
239
245
|
paddingBottom: 40,
|
|
@@ -296,29 +302,18 @@ const menuLinkStyle: React.CSSProperties = {
|
|
|
296
302
|
justifyContent: 'center',
|
|
297
303
|
}
|
|
298
304
|
|
|
299
|
-
|
|
300
|
-
// - The left-side <NavHead> shown on documentation pages on desktop
|
|
301
|
-
// - The top <NavHead> shown otherwise
|
|
302
|
-
function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
305
|
+
function NavHead() {
|
|
303
306
|
const pageContext = usePageContext()
|
|
304
307
|
const { navMaxWidth, name, algolia } = pageContext.globalContext.config.docpress
|
|
305
308
|
const hideNavHeadLogo = pageContext.resolved.isLandingPage && !navMaxWidth
|
|
306
309
|
|
|
307
310
|
const navHeadSecondary = (
|
|
308
311
|
<div
|
|
309
|
-
className=
|
|
312
|
+
className="nav-head-secondary"
|
|
310
313
|
style={{
|
|
311
314
|
padding: 0,
|
|
312
315
|
display: 'flex',
|
|
313
316
|
height: '100%',
|
|
314
|
-
...(isNavLeft
|
|
315
|
-
? {
|
|
316
|
-
position: 'absolute',
|
|
317
|
-
left: '100%',
|
|
318
|
-
top: 0,
|
|
319
|
-
width: mainViewWidthMax, // guaranteed real estate
|
|
320
|
-
}
|
|
321
|
-
: {}),
|
|
322
317
|
}}
|
|
323
318
|
>
|
|
324
319
|
{pageContext.globalContext.config.docpress.topNavigation}
|
|
@@ -336,35 +331,38 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
336
331
|
|
|
337
332
|
return (
|
|
338
333
|
<div
|
|
339
|
-
className={cls(['nav-head link-hover-animation',
|
|
334
|
+
className={cls(['nav-head link-hover-animation', !!navMaxWidth && 'has-max-width'])}
|
|
340
335
|
style={{
|
|
341
336
|
backgroundColor: 'var(--color-bg-gray)',
|
|
342
|
-
borderBottom: 'var(--block-margin) solid var(--color-bg-white)',
|
|
343
337
|
position: 'relative',
|
|
338
|
+
boxShadow: `0 ${blockMargin}px 0 var(--color-bg-white)`,
|
|
344
339
|
}}
|
|
345
340
|
>
|
|
346
|
-
{isNavLeft && <NavHeadLeftFullWidthBackground />}
|
|
347
341
|
<div
|
|
348
342
|
style={{
|
|
349
343
|
// DON'T REMOVE this container: it's needed for the `cqw` values
|
|
350
344
|
container: 'container-nav-head / inline-size',
|
|
351
345
|
width: '100%',
|
|
346
|
+
// Cap the cqw context so nav-item spacing matches between landing and doc pages.
|
|
347
|
+
maxWidth: bodyMaxWidth,
|
|
348
|
+
margin: '0 auto',
|
|
352
349
|
}}
|
|
353
350
|
>
|
|
354
351
|
<div
|
|
355
352
|
className="nav-head-content"
|
|
356
353
|
style={{
|
|
357
354
|
width: '100%',
|
|
358
|
-
|
|
355
|
+
// Top nav spans the doc-page width so its logo lines up with the sidebar (same width on landing).
|
|
356
|
+
maxWidth: bodyMaxWidth,
|
|
359
357
|
margin: 'auto',
|
|
360
358
|
height: 'var(--nav-head-height)',
|
|
361
359
|
fontSize: `min(14.2px, ${isProjectNameShort(name) ? '4.8cqw' : '4.5cqw'})`,
|
|
362
|
-
color: 'var(--color-muted, #666)',
|
|
360
|
+
color: 'var(--dp-color-muted, #666)',
|
|
363
361
|
display: 'flex',
|
|
364
362
|
justifyContent: 'center',
|
|
365
363
|
}}
|
|
366
364
|
>
|
|
367
|
-
{!hideNavHeadLogo && <NavHeadLogo
|
|
365
|
+
{!hideNavHeadLogo && <NavHeadLogo />}
|
|
368
366
|
<div className="desktop-grow" style={{ display: 'none' }} />
|
|
369
367
|
{algolia && <SearchLink className="always-shown" style={menuLinkStyle} />}
|
|
370
368
|
<MenuToggleMain className="always-shown nav-head-menu-toggle" style={menuLinkStyle} />
|
|
@@ -380,7 +378,7 @@ function getStyleLayout() {
|
|
|
380
378
|
// Mobile
|
|
381
379
|
style += css`
|
|
382
380
|
@media(max-width: ${viewMobile}px) {
|
|
383
|
-
.nav-head
|
|
381
|
+
.nav-head {
|
|
384
382
|
.nav-head-menu-toggle {
|
|
385
383
|
justify-content: flex-end !important;
|
|
386
384
|
padding-right: var(--main-view-padding) !important;
|
|
@@ -397,7 +395,7 @@ function getStyleLayout() {
|
|
|
397
395
|
// Mobile + tablet
|
|
398
396
|
style += css`
|
|
399
397
|
@media(max-width: ${viewTablet}px) {
|
|
400
|
-
.nav-head
|
|
398
|
+
.nav-head {
|
|
401
399
|
.nav-head-secondary {
|
|
402
400
|
display: none !important;
|
|
403
401
|
}
|
|
@@ -407,7 +405,7 @@ function getStyleLayout() {
|
|
|
407
405
|
// Tablet
|
|
408
406
|
style += css`
|
|
409
407
|
@media(max-width: ${viewTablet}px) and (min-width: ${viewMobile + 1}px) {
|
|
410
|
-
.nav-head
|
|
408
|
+
.nav-head {
|
|
411
409
|
.nav-head-content {
|
|
412
410
|
--icon-text-padding: 8px;
|
|
413
411
|
--padding-side: 20px;
|
|
@@ -418,7 +416,7 @@ function getStyleLayout() {
|
|
|
418
416
|
// Desktop small + desktop
|
|
419
417
|
style += css`
|
|
420
418
|
@media(min-width: ${viewTablet + 1}px) {
|
|
421
|
-
.nav-head
|
|
419
|
+
.nav-head {
|
|
422
420
|
.nav-head-content {
|
|
423
421
|
--icon-text-padding: min(8px, 0.5cqw);
|
|
424
422
|
--padding-side: min(20px, 1.2cqw);
|
|
@@ -442,39 +440,6 @@ function getStyleLayout() {
|
|
|
442
440
|
// Desktop
|
|
443
441
|
if (!isNavLeftAlwaysHidden()) {
|
|
444
442
|
style += css`
|
|
445
|
-
@container container-viewport (min-width: ${viewDesktop}px) {
|
|
446
|
-
.nav-head:not(.is-nav-left) {
|
|
447
|
-
display: none !important;
|
|
448
|
-
}
|
|
449
|
-
.nav-head.is-nav-left {
|
|
450
|
-
.nav-head-content {
|
|
451
|
-
--icon-text-padding: min(8px, 7 * (1cqw - 2.5px));
|
|
452
|
-
& > :not(.always-shown) {
|
|
453
|
-
--padding-side: min(24px, 27 * (1cqw - 2.5px));
|
|
454
|
-
}
|
|
455
|
-
& > * {
|
|
456
|
-
flex-grow: 0.5;
|
|
457
|
-
}
|
|
458
|
-
& > .nav-head-menu-toggle {
|
|
459
|
-
flex-grow: 1;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
.show-on-nav-hover {
|
|
464
|
-
opacity: 0;
|
|
465
|
-
transition-property: opacity;
|
|
466
|
-
pointer-events: none;
|
|
467
|
-
}
|
|
468
|
-
html:not(.unexpand-nav) {
|
|
469
|
-
& .nav-head.is-nav-left:hover .show-on-nav-hover,
|
|
470
|
-
&:has(.nav-head:hover) #menu-modal-wrapper.show-on-nav-hover,
|
|
471
|
-
&.menu-modal-show .nav-head.is-nav-left .show-on-nav-hover,
|
|
472
|
-
&.menu-modal-show #menu-modal-wrapper.show-on-nav-hover {
|
|
473
|
-
opacity: 1;
|
|
474
|
-
pointer-events: all;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
443
|
@container container-viewport (max-width: ${viewDesktop - 1}px) {
|
|
479
444
|
#nav-left, #nav-left-margin {
|
|
480
445
|
display: none;
|
|
@@ -514,37 +479,7 @@ function unexpandNav() {
|
|
|
514
479
|
}, 1000)
|
|
515
480
|
}
|
|
516
481
|
|
|
517
|
-
function
|
|
518
|
-
return (
|
|
519
|
-
<>
|
|
520
|
-
<div
|
|
521
|
-
className="nav-head-bg show-on-nav-hover add-transition"
|
|
522
|
-
style={{
|
|
523
|
-
height: '100%',
|
|
524
|
-
zIndex: -1,
|
|
525
|
-
background: 'var(--color-bg-gray)',
|
|
526
|
-
position: 'absolute',
|
|
527
|
-
left: 0,
|
|
528
|
-
top: 0,
|
|
529
|
-
boxSizing: 'content-box',
|
|
530
|
-
borderBottom: 'var(--block-margin) solid var(--color-bg-white)',
|
|
531
|
-
}}
|
|
532
|
-
/>
|
|
533
|
-
<Style>{
|
|
534
|
-
// (min-width: 0px) => trick to always apply => @container seems to always require a condition
|
|
535
|
-
css`
|
|
536
|
-
@container container-viewport (min-width: 0px) {
|
|
537
|
-
.nav-head-bg {
|
|
538
|
-
width: 100cqw;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
`
|
|
542
|
-
}</Style>
|
|
543
|
-
</>
|
|
544
|
-
)
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
function NavHeadLogo({ isNavLeft }: { isNavLeft?: true }) {
|
|
482
|
+
function NavHeadLogo() {
|
|
548
483
|
const pageContext = usePageContext()
|
|
549
484
|
|
|
550
485
|
const { navLogo } = pageContext.globalContext.config.docpress
|
|
@@ -584,14 +519,8 @@ function NavHeadLogo({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
584
519
|
alignItems: 'center',
|
|
585
520
|
height: '100%',
|
|
586
521
|
color: 'inherit',
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
paddingLeft: 'var(--main-view-padding)',
|
|
590
|
-
paddingRight: 'var(--padding-side)',
|
|
591
|
-
}
|
|
592
|
-
: {
|
|
593
|
-
paddingLeft: 15,
|
|
594
|
-
}),
|
|
522
|
+
paddingLeft: 'var(--main-view-padding)',
|
|
523
|
+
paddingRight: 'var(--padding-side)',
|
|
595
524
|
}}
|
|
596
525
|
href="/"
|
|
597
526
|
onContextMenu={!navLogo ? undefined : onContextMenu}
|
|
@@ -670,7 +599,7 @@ function MenuToggle({ menuId, ...props }: PropsDiv & { menuId: number }) {
|
|
|
670
599
|
width: 11,
|
|
671
600
|
marginLeft: 'calc(var(--icon-text-padding) - 1px)',
|
|
672
601
|
flexShrink: 0,
|
|
673
|
-
color: 'var(--color-muted, #888)',
|
|
602
|
+
color: 'var(--dp-color-muted, #888)',
|
|
674
603
|
position: 'relative',
|
|
675
604
|
top: 1,
|
|
676
605
|
}}
|
|
@@ -138,7 +138,7 @@ function NavigationWithColumnLayout(props: { navItems: NavItem[] }) {
|
|
|
138
138
|
${/* Button style */ ''}
|
|
139
139
|
.menu-toggle-${i} {
|
|
140
140
|
html.menu-modal-show.menu-modal-show-${i} & {
|
|
141
|
-
color: var(--color-text, black) !important;
|
|
141
|
+
color: var(--dp-color-text, black) !important;
|
|
142
142
|
[class^='decolorize-'],
|
|
143
143
|
[class*=' decolorize-'] {
|
|
144
144
|
filter: grayscale(0) opacity(1) !important;
|
package/MenuModal.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from './MenuModal/toggleMenuModal.js'
|
|
15
15
|
import { EditLink } from './EditLink.js'
|
|
16
16
|
|
|
17
|
-
function MenuModal({
|
|
17
|
+
function MenuModal({ isNavLeftAlwaysHidden_ }: { isNavLeftAlwaysHidden_: boolean }) {
|
|
18
18
|
return (
|
|
19
19
|
<>
|
|
20
20
|
<Style>{getStyle()}</Style>
|
|
@@ -22,11 +22,12 @@ function MenuModal({ isTopNav, isNavLeftAlwaysHidden_ }: { isTopNav: boolean; is
|
|
|
22
22
|
id="menu-modal-wrapper"
|
|
23
23
|
className="link-hover-animation add-transition show-on-nav-hover"
|
|
24
24
|
style={{
|
|
25
|
-
|
|
25
|
+
// Absolute inside the sticky header so the dropdown tracks the nav on scroll
|
|
26
|
+
position: 'absolute',
|
|
26
27
|
width: '100%',
|
|
27
28
|
top: 'var(--nav-head-height)',
|
|
28
29
|
zIndex: 199, // maximum value, because docsearch's modal has `z-index: 200`
|
|
29
|
-
background: 'var(--color-surface, #ededef)',
|
|
30
|
+
background: 'var(--dp-color-surface, #ededef)',
|
|
30
31
|
transitionProperty: 'opacity',
|
|
31
32
|
transitionTimingFunction: 'ease',
|
|
32
33
|
maxWidth: isNavLeftAlwaysHidden_ ? undefined : bodyMaxWidth,
|
|
@@ -169,8 +170,8 @@ function CloseButton({ className }: { className: string }) {
|
|
|
169
170
|
cx="11.45"
|
|
170
171
|
cy="11.45"
|
|
171
172
|
r="10.607"
|
|
172
|
-
fill="var(--color-surface, #ececec)"
|
|
173
|
-
stroke="var(--color-muted, #666)"
|
|
173
|
+
fill="var(--dp-color-surface, #ececec)"
|
|
174
|
+
stroke="var(--dp-color-muted, #666)"
|
|
174
175
|
strokeDashoffset="251.44"
|
|
175
176
|
strokeLinecap="round"
|
|
176
177
|
strokeLinejoin="round"
|
|
@@ -179,8 +180,8 @@ function CloseButton({ className }: { className: string }) {
|
|
|
179
180
|
/>
|
|
180
181
|
<path
|
|
181
182
|
d="m7.5904 6.2204 3.86 3.86 3.84-3.84a0.92 0.92 0 0 1 0.66-0.29 1 1 0 0 1 1 1 0.9 0.9 0 0 1-0.27 0.66l-3.89 3.84 3.89 3.89a0.9 0.9 0 0 1 0.27 0.61 1 1 0 0 1-1 1 0.92 0.92 0 0 1-0.69-0.27l-3.81-3.86-3.85 3.85a0.92 0.92 0 0 1-0.65 0.28 1 1 0 0 1-1-1 0.9 0.9 0 0 1 0.27-0.66l3.89-3.84-3.89-3.89a0.9 0.9 0 0 1-0.27-0.61 1 1 0 0 1 1-1c0.24 3e-3 0.47 0.1 0.64 0.27z"
|
|
182
|
-
fill="var(--color-muted, #666)"
|
|
183
|
-
stroke="var(--color-muted, #666)"
|
|
183
|
+
fill="var(--dp-color-muted, #666)"
|
|
184
|
+
stroke="var(--dp-color-muted, #666)"
|
|
184
185
|
strokeWidth=".11719"
|
|
185
186
|
/>
|
|
186
187
|
</svg>
|
package/NavItemComponent.css
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
.nav-item-level-4 {
|
|
14
14
|
padding-top: 14px;
|
|
15
15
|
margin-bottom: -1px;
|
|
16
|
-
color: var(--color-muted, #999);
|
|
16
|
+
color: var(--dp-color-muted, #999);
|
|
17
17
|
font-size: 12px;
|
|
18
18
|
font-weight: 400;
|
|
19
19
|
letter-spacing: 0.15ch;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
text-transform: uppercase;
|
|
31
31
|
font-weight: 600;
|
|
32
32
|
letter-spacing: 0.14ch;
|
|
33
|
-
color: var(--color-text);
|
|
33
|
+
color: var(--dp-color-text);
|
|
34
34
|
#menu-modal-wrapper & {
|
|
35
35
|
margin-top: 10px;
|
|
36
36
|
padding-left: 9px;
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
font-size: 14.4px;
|
|
64
64
|
font-weight: 400;
|
|
65
65
|
letter-spacing: 0.15ch;
|
|
66
|
-
color: var(--color-text);
|
|
66
|
+
color: var(--dp-color-text);
|
|
67
67
|
padding-left: var(--padding-left-global);
|
|
68
68
|
padding-right: 0;
|
|
69
69
|
--padding: 4px;
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
font-size: 12px;
|
|
75
75
|
font-weight: 400;
|
|
76
76
|
letter-spacing: 0.15ch;
|
|
77
|
-
color: var(--color-text);
|
|
77
|
+
color: var(--dp-color-text);
|
|
78
78
|
--padding: 5px;
|
|
79
79
|
|
|
80
80
|
padding: var(--padding) 0;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
.nav-item-level-3 {
|
|
84
84
|
--shadow-size: 9px;
|
|
85
|
-
--shadow-color: var(--color-shadow, rgba(0, 0, 0, 0.11));
|
|
85
|
+
--shadow-color: var(--dp-color-shadow, rgba(0, 0, 0, 0.11));
|
|
86
86
|
--shadow-size-minus: calc(-1 * var(--shadow-size));
|
|
87
87
|
--shadow-top: inset 0px var(--shadow-size) var(--shadow-size) var(--shadow-size-minus) var(--shadow-color);
|
|
88
88
|
--shadow-bottom: inset 0px var(--shadow-size-minus) var(--shadow-size) var(--shadow-size-minus) var(--shadow-color);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/* tablist style logic */
|
|
5
5
|
.choice-tabs__tab:has(.choice-tabs__radio:checked) {
|
|
6
6
|
border-bottom: 2px solid #aaa;
|
|
7
|
-
color: var(--color-text);
|
|
7
|
+
color: var(--dp-color-text);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
padding: 6px 12px;
|
|
23
23
|
cursor: pointer;
|
|
24
24
|
font-weight: 500;
|
|
25
|
-
/* lighten --color-text by 20% */
|
|
26
|
-
color: color-mix(in srgb, var(--color-text) 80%, white 20%);
|
|
25
|
+
/* lighten --dp-color-text by 20% */
|
|
26
|
+
color: color-mix(in srgb, var(--dp-color-text) 80%, white 20%);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.choice-tabs__tab-content {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.choice-tabs__tab:hover {
|
|
48
|
-
color: var(--color-text);
|
|
48
|
+
color: var(--dp-color-text);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.choice-tabs__tab--disabled {
|
package/components/index.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export * from '../utils/Emoji/index.js'
|
|
2
2
|
export * from './Link.js'
|
|
3
3
|
export * from './RepoLink.js'
|
|
4
|
-
export * from './P.js'
|
|
5
4
|
export * from './Note.js'
|
|
6
5
|
export * from './ImportMeta.js'
|
|
7
|
-
export * from './HorizontalLine.js'
|
|
8
6
|
export * from './CodeBlockTransformer.js'
|
|
9
|
-
export * from './Comment.js'
|
|
10
7
|
export * from './FileRemoved.js'
|
|
11
8
|
export * from '../code-blocks/components/Tabs.js'
|
package/css/code.css
CHANGED
|
@@ -56,6 +56,6 @@ body {
|
|
|
56
56
|
unthemed site identical to the original `rgba(0, 0, 0, value)`:
|
|
57
57
|
color-mix(in srgb, #000 3%, transparent) === rgba(0, 0, 0, 0.03). */
|
|
58
58
|
--color-active-value: 3%;
|
|
59
|
-
--color-active: color-mix(in srgb, var(--color-text, #000) var(--color-active-value), transparent);
|
|
60
|
-
--color-active-double: color-mix(in srgb, var(--color-text, #000) calc(2 * var(--color-active-value)), transparent);
|
|
59
|
+
--color-active: color-mix(in srgb, var(--dp-color-text, #000) var(--color-active-value), transparent);
|
|
60
|
+
--color-active-double: color-mix(in srgb, var(--dp-color-text, #000) calc(2 * var(--color-active-value)), transparent);
|
|
61
61
|
}
|
package/css/font.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
2
2
|
|
|
3
3
|
body {
|
|
4
|
-
font-family: 'Inter', sans-serif;
|
|
4
|
+
font-family: var(--dp-font-sans, 'Inter', sans-serif);
|
|
5
5
|
}
|
|
6
6
|
button {
|
|
7
7
|
font-family: inherit;
|
|
8
8
|
}
|
|
9
9
|
body {
|
|
10
|
-
color: var(--color-text, #323d48);
|
|
10
|
+
color: var(--dp-color-text, #323d48);
|
|
11
11
|
line-height: 1.5;
|
|
12
12
|
}
|
package/css/heading.css
CHANGED
|
@@ -13,6 +13,11 @@ h3 {
|
|
|
13
13
|
margin-bottom: 20px;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/* Offset headings below the sticky top nav (no offset if top nav isn't sticky). */
|
|
17
|
+
.doc-page :is(h1, h2, h3, h4, h5, h6) {
|
|
18
|
+
scroll-margin-top: calc(var(--nav-head-sticky-offset) + 16px);
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
.doc-page h2,
|
|
17
22
|
.doc-page h3 {
|
|
18
23
|
margin-bottom: 16px;
|
|
@@ -27,7 +32,7 @@ h3 {
|
|
|
27
32
|
height: 1px;
|
|
28
33
|
top: -45px;
|
|
29
34
|
/* Same as <HorizontalLine> */
|
|
30
|
-
background-color: var(--color-border, rgba(0, 0, 0, 0.1));
|
|
35
|
+
background-color: var(--dp-color-border, rgba(0, 0, 0, 0.1));
|
|
31
36
|
--width: min(80%, 500px);
|
|
32
37
|
width: var(--width);
|
|
33
38
|
left: calc((100% - var(--width)) / 2);
|
|
@@ -54,7 +59,7 @@ h3 {
|
|
|
54
59
|
|
|
55
60
|
.doc-page h5 {
|
|
56
61
|
font-size: 0.94em;
|
|
57
|
-
color: var(--color-muted, #777);
|
|
62
|
+
color: var(--dp-color-muted, #777);
|
|
58
63
|
margin-bottom: 10px;
|
|
59
64
|
}
|
|
60
65
|
|
|
@@ -82,7 +87,7 @@ h3 {
|
|
|
82
87
|
font-size: 23px;
|
|
83
88
|
top: 1px;
|
|
84
89
|
left: calc(-1 * (0.75em - var(--hash-offset)));
|
|
85
|
-
color: var(--color-muted, #aaa);
|
|
90
|
+
color: var(--dp-color-muted, #aaa);
|
|
86
91
|
display: flex;
|
|
87
92
|
align-items: center;
|
|
88
93
|
}
|
package/css/link.css
CHANGED
package/css/table.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
table th {
|
|
2
|
-
background-color: var(--color-surface, #f7f7f7);
|
|
2
|
+
background-color: var(--dp-color-surface, #f7f7f7);
|
|
3
3
|
}
|
|
4
4
|
table {
|
|
5
5
|
border-collapse: collapse;
|
|
@@ -7,7 +7,7 @@ table {
|
|
|
7
7
|
table td,
|
|
8
8
|
table th {
|
|
9
9
|
padding: 8px;
|
|
10
|
-
border: 1px solid var(--color-border, #ccc);
|
|
10
|
+
border: 1px solid var(--dp-color-border, #ccc);
|
|
11
11
|
}
|
|
12
12
|
table th {
|
|
13
13
|
text-align: left;
|
package/css/tokens.css
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Color tokens (opt-in, zero default change).
|
|
3
3
|
*
|
|
4
|
+
* The themeable seam is `--dp-`-prefixed (`--dp-color-*`, `--dp-font-*`). The
|
|
5
|
+
* prefix matters: DocPress used to read bare `--color-*` / `--font-*`, which are
|
|
6
|
+
* the same names Tailwind and daisyUI emit to the global `:root`. A host using
|
|
7
|
+
* either could bleed its palette into DocPress (e.g. a leaked `--color-bg` on
|
|
8
|
+
* route prefetch). Reading `--dp-*` instead means only values set FOR DocPress
|
|
9
|
+
* apply.
|
|
10
|
+
*
|
|
4
11
|
* No light palette is defined here on purpose: every consumer reads
|
|
5
|
-
* `var(--color-x, <literal>)` and falls back to its original literal, so an
|
|
12
|
+
* `var(--dp-color-x, <literal>)` and falls back to its original literal, so an
|
|
6
13
|
* unthemed DocPress site renders exactly as before. A site re-themes by setting
|
|
7
|
-
* the `--color-*` variables (on :root or body), and turns on
|
|
8
|
-
* by adding the `dark` class or `[data-theme="dark"]`. There
|
|
9
|
-
* `prefers-color-scheme` switch, so the OS setting never changes a site
|
|
10
|
-
* has not opted in.
|
|
14
|
+
* the `--dp-color-*` / `--dp-font-*` variables (on :root or body), and turns on
|
|
15
|
+
* a dark appearance by adding the `dark` class or `[data-theme="dark"]`. There
|
|
16
|
+
* is no `prefers-color-scheme` switch, so the OS setting never changes a site
|
|
17
|
+
* that has not opted in.
|
|
11
18
|
*/
|
|
12
19
|
:root {
|
|
13
|
-
/* --color-text has a single original value and pre-existing consumers that
|
|
20
|
+
/* --dp-color-text has a single original value and pre-existing consumers that
|
|
14
21
|
read it bare (nav items, tabs), so it is defined here (was `body {}`). It
|
|
15
22
|
stays overridable (a `body`/`:root` override or the dark block below wins).
|
|
16
23
|
The ambiguous greys are intentionally NOT defined here: their consumers fall
|
|
17
24
|
back to their own original literal, so light rendering is unchanged. */
|
|
18
|
-
--color-text: #323d48;
|
|
25
|
+
--dp-color-text: #323d48;
|
|
19
26
|
|
|
20
27
|
/* Long-standing internal aliases, kept resolving to their original defaults. */
|
|
21
|
-
--color-bg-white: var(--color-bg, #fdfdfd);
|
|
22
|
-
--color-bg-gray: var(--color-surface, #f5f5f5);
|
|
28
|
+
--color-bg-white: var(--dp-color-bg, #fdfdfd);
|
|
29
|
+
--color-bg-gray: var(--dp-color-surface, #f5f5f5);
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
:root.dark,
|
|
26
33
|
:root[data-theme='dark'] {
|
|
27
|
-
--color-bg: #0d0f14;
|
|
28
|
-
--color-surface: #161922;
|
|
29
|
-
--color-text: #d7dce5;
|
|
30
|
-
--color-muted: #8b95a5;
|
|
31
|
-
--color-border: #2b313c;
|
|
32
|
-
--color-primary: #8aa0ff;
|
|
33
|
-
--color-shadow: rgba(0, 0, 0, 0.45);
|
|
34
|
+
--dp-color-bg: #0d0f14;
|
|
35
|
+
--dp-color-surface: #161922;
|
|
36
|
+
--dp-color-text: #d7dce5;
|
|
37
|
+
--dp-color-muted: #8b95a5;
|
|
38
|
+
--dp-color-border: #2b313c;
|
|
39
|
+
--dp-color-primary: #8aa0ff;
|
|
40
|
+
--dp-color-shadow: rgba(0, 0, 0, 0.45);
|
|
34
41
|
}
|
package/css/tooltip.css
CHANGED
|
@@ -13,19 +13,19 @@
|
|
|
13
13
|
opacity: 0;
|
|
14
14
|
transition: opacity 0.3s ease-in-out;
|
|
15
15
|
pointer-events: none;
|
|
16
|
-
font-family: monospace;
|
|
16
|
+
font-family: var(--dp-font-mono, monospace);
|
|
17
17
|
font-size: 12px;
|
|
18
18
|
content: attr(aria-label);
|
|
19
19
|
position: absolute;
|
|
20
20
|
left: 50%;
|
|
21
21
|
transform: translate(-50%, 0);
|
|
22
|
-
background: var(--color-bg, #fdfdfd);
|
|
22
|
+
background: var(--dp-color-bg, #fdfdfd);
|
|
23
23
|
padding: 3px 10px;
|
|
24
|
-
box-shadow: var(--color-shadow, rgb(0 0 0 / 8%)) 2px 4px 7px 0px;
|
|
24
|
+
box-shadow: var(--dp-color-shadow, rgb(0 0 0 / 8%)) 2px 4px 7px 0px;
|
|
25
25
|
border-radius: 5px;
|
|
26
|
-
color: var(--color-text, #333);
|
|
26
|
+
color: var(--dp-color-text, #333);
|
|
27
27
|
letter-spacing: -0.02em;
|
|
28
|
-
border: 1px solid var(--color-border, #e3e3e3);
|
|
28
|
+
border: 1px solid var(--dp-color-border, #e3e3e3);
|
|
29
29
|
z-index: 1;
|
|
30
30
|
/* Atlernative: https://stackoverflow.com/questions/30086913/css-positioned-absolute-element-automatic-width-outside-of-parents-bounds/57379329#57379329
|
|
31
31
|
width: max-content;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export * from '../utils/Emoji/index.js';
|
|
2
2
|
export * from './Link.js';
|
|
3
3
|
export * from './RepoLink.js';
|
|
4
|
-
export * from './P.js';
|
|
5
4
|
export * from './Note.js';
|
|
6
5
|
export * from './ImportMeta.js';
|
|
7
|
-
export * from './HorizontalLine.js';
|
|
8
6
|
export * from './CodeBlockTransformer.js';
|
|
9
|
-
export * from './Comment.js';
|
|
10
7
|
export * from './FileRemoved.js';
|
|
11
8
|
export * from '../code-blocks/components/Tabs.js';
|
package/dist/components/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export * from '../utils/Emoji/index.js';
|
|
2
2
|
export * from './Link.js';
|
|
3
3
|
export * from './RepoLink.js';
|
|
4
|
-
export * from './P.js';
|
|
5
4
|
export * from './Note.js';
|
|
6
5
|
export * from './ImportMeta.js';
|
|
7
|
-
export * from './HorizontalLine.js';
|
|
8
6
|
export * from './CodeBlockTransformer.js';
|
|
9
|
-
export * from './Comment.js';
|
|
10
7
|
export * from './FileRemoved.js';
|
|
11
8
|
export * from '../code-blocks/components/Tabs.js';
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
export { PageContextProvider };
|
|
2
2
|
export { usePageContext };
|
|
3
|
-
export { usePageContextLegacy };
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import type { PageContext } from 'vike/types';
|
|
6
|
-
declare function usePageContextLegacy(): {
|
|
7
|
-
navItemsAll: import("../NavItemComponent.js").NavItem[];
|
|
8
|
-
navItemsDetached: import("../NavItemComponent.js").NavItem[] | undefined;
|
|
9
|
-
pageDesign: {
|
|
10
|
-
hideTitle?: true;
|
|
11
|
-
hideMenuLeft?: true;
|
|
12
|
-
contentMaxWidth?: number;
|
|
13
|
-
} | undefined;
|
|
14
|
-
linksAll: import("../components/Link.js").LinkData[];
|
|
15
|
-
isLandingPage: boolean;
|
|
16
|
-
pageTitle: string | null;
|
|
17
|
-
documentTitle: string;
|
|
18
|
-
activeCategoryName: string;
|
|
19
|
-
choices: import("../code-blocks/utils/resolveChoices.js").ResolvedChoices | undefined;
|
|
20
|
-
};
|
|
21
5
|
declare function usePageContext(): PageContext;
|
|
22
6
|
declare function PageContextProvider({ pageContext, children, }: {
|
|
23
7
|
pageContext: PageContext;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
export { PageContextProvider };
|
|
2
2
|
export { usePageContext };
|
|
3
|
-
export { usePageContextLegacy };
|
|
4
3
|
import React, { useContext } from 'react';
|
|
5
4
|
import { getGlobalObject } from '../utils/getGlobalObject.js';
|
|
6
5
|
const globalObject = getGlobalObject('usePageContext.ts', {
|
|
7
6
|
Ctx: React.createContext(undefined),
|
|
8
7
|
});
|
|
9
|
-
function usePageContextLegacy() {
|
|
10
|
-
const { Ctx } = globalObject;
|
|
11
|
-
const pageContext = useContext(Ctx);
|
|
12
|
-
return pageContext.resolved;
|
|
13
|
-
}
|
|
14
8
|
function usePageContext() {
|
|
15
9
|
const pageContext = useContext(globalObject.Ctx);
|
|
16
10
|
return pageContext;
|
package/dist/types/Heading.d.ts
CHANGED
|
@@ -24,6 +24,12 @@ type PageDesign = {
|
|
|
24
24
|
hideTitle?: true;
|
|
25
25
|
hideMenuLeft?: true;
|
|
26
26
|
contentMaxWidth?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the top navigation sticks to the top of the viewport while scrolling.
|
|
29
|
+
*
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
topNavSticky?: boolean;
|
|
27
33
|
};
|
|
28
34
|
type HeadingDetachedResolved = Omit<HeadingResolved, 'level' | 'linkBreadcrumb'> & {
|
|
29
35
|
level: 2;
|
package/dist/utils/server.d.ts
CHANGED
package/dist/utils/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brillout/docpress",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.49",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@brillout/picocolors": "^1.0.10",
|
|
@@ -66,7 +66,10 @@
|
|
|
66
66
|
"vike": "^0.4.255",
|
|
67
67
|
"vite": "^8.0.8"
|
|
68
68
|
},
|
|
69
|
-
"repository":
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "https://github.com/brillout/docpress"
|
|
72
|
+
},
|
|
70
73
|
"license": "MIT",
|
|
71
74
|
"publishConfig": {
|
|
72
75
|
"access": "public"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { PageContextProvider }
|
|
2
2
|
export { usePageContext }
|
|
3
|
-
export { usePageContextLegacy }
|
|
4
3
|
|
|
5
4
|
import React, { useContext } from 'react'
|
|
6
5
|
import type { PageContext } from 'vike/types'
|
|
@@ -10,12 +9,6 @@ const globalObject = getGlobalObject('usePageContext.ts', {
|
|
|
10
9
|
Ctx: React.createContext<PageContext>(undefined as any),
|
|
11
10
|
})
|
|
12
11
|
|
|
13
|
-
function usePageContextLegacy() {
|
|
14
|
-
const { Ctx } = globalObject
|
|
15
|
-
const pageContext = useContext(Ctx)
|
|
16
|
-
return pageContext.resolved
|
|
17
|
-
}
|
|
18
|
-
|
|
19
12
|
function usePageContext(): PageContext {
|
|
20
13
|
const pageContext = useContext(globalObject.Ctx)
|
|
21
14
|
return pageContext
|
package/types/Heading.ts
CHANGED
|
@@ -28,6 +28,12 @@ type PageDesign = {
|
|
|
28
28
|
hideTitle?: true
|
|
29
29
|
hideMenuLeft?: true
|
|
30
30
|
contentMaxWidth?: number
|
|
31
|
+
/**
|
|
32
|
+
* Whether the top navigation sticks to the top of the viewport while scrolling.
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
topNavSticky?: boolean
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
type HeadingDetachedResolved = Omit<HeadingResolved, 'level' | 'linkBreadcrumb'> & {
|
package/utils/server.ts
CHANGED
package/components/Comment.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export { HorizontalLine }
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { cls } from '../utils/cls.js'
|
|
5
|
-
|
|
6
|
-
function HorizontalLine({ primary }: { primary?: true }) {
|
|
7
|
-
return (
|
|
8
|
-
<div className={cls(primary && 'primary')} style={{ textAlign: 'center' }}>
|
|
9
|
-
<hr
|
|
10
|
-
style={{
|
|
11
|
-
display: 'inline-block',
|
|
12
|
-
margin: 0,
|
|
13
|
-
border: 0,
|
|
14
|
-
// Same as `.doc-page h2::after`
|
|
15
|
-
borderTop: '1px solid var(--color-border, rgba(0, 0, 0, 0.1))',
|
|
16
|
-
maxWidth: 500,
|
|
17
|
-
width: '80%',
|
|
18
|
-
}}
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
21
|
-
)
|
|
22
|
-
}
|
package/components/P.css
DELETED
package/components/P.tsx
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { HorizontalLine };
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { cls } from '../utils/cls.js';
|
|
4
|
-
function HorizontalLine({ primary }) {
|
|
5
|
-
return (React.createElement("div", { className: cls(primary && 'primary'), style: { textAlign: 'center' } },
|
|
6
|
-
React.createElement("hr", { style: {
|
|
7
|
-
display: 'inline-block',
|
|
8
|
-
margin: 0,
|
|
9
|
-
border: 0,
|
|
10
|
-
// Same as `.doc-page h2::after`
|
|
11
|
-
borderTop: '1px solid var(--color-border, rgba(0, 0, 0, 0.1))',
|
|
12
|
-
maxWidth: 500,
|
|
13
|
-
width: '80%',
|
|
14
|
-
} })));
|
|
15
|
-
}
|
package/dist/components/P.d.ts
DELETED
package/dist/components/P.js
DELETED
package/dist/utils/cls.d.ts
DELETED
package/dist/utils/cls.js
DELETED
package/dist/utils/filter.d.ts
DELETED
package/dist/utils/filter.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { filter };
|
|
2
|
-
// https://stackoverflow.com/questions/66341757/typescript-how-to-filter-the-object
|
|
3
|
-
function filter(obj, predicate) {
|
|
4
|
-
const result = {};
|
|
5
|
-
Object.keys(obj).forEach((name) => {
|
|
6
|
-
if (predicate(obj[name], name)) {
|
|
7
|
-
result[name] = obj[name];
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
return result;
|
|
11
|
-
}
|
package/utils/PassTrough.tsx
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export { toPosixPath }
|
|
2
|
-
export { assertPosixPath }
|
|
3
|
-
export { toSystemPath }
|
|
4
|
-
|
|
5
|
-
import assert from 'assert'
|
|
6
|
-
|
|
7
|
-
const sepPosix = '/'
|
|
8
|
-
const sepWin32 = '\\'
|
|
9
|
-
|
|
10
|
-
function toPosixPath(path: string) {
|
|
11
|
-
if (isPosix()) {
|
|
12
|
-
assertPosixPath(path)
|
|
13
|
-
return path
|
|
14
|
-
}
|
|
15
|
-
if (isWin32()) {
|
|
16
|
-
const pathPosix = path.split(sepWin32).join(sepPosix)
|
|
17
|
-
assertPosixPath(pathPosix)
|
|
18
|
-
return pathPosix
|
|
19
|
-
}
|
|
20
|
-
assert(false)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function assertPosixPath(path: string) {
|
|
24
|
-
assert(path && !path.includes(sepWin32), `Wrongly formatted path: ${path}`)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function toSystemPath(path: string) {
|
|
28
|
-
if (isPosix()) {
|
|
29
|
-
return toPosixPath(path)
|
|
30
|
-
}
|
|
31
|
-
if (isWin32()) {
|
|
32
|
-
return path.split(sepPosix).join(sepWin32)
|
|
33
|
-
}
|
|
34
|
-
assert(false)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function isWin32() {
|
|
38
|
-
return process.platform === 'win32'
|
|
39
|
-
}
|
|
40
|
-
function isPosix() {
|
|
41
|
-
return !isWin32()
|
|
42
|
-
}
|
package/utils/filter.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { filter }
|
|
2
|
-
|
|
3
|
-
// https://stackoverflow.com/questions/66341757/typescript-how-to-filter-the-object
|
|
4
|
-
function filter<T extends object>(obj: T, predicate: <K extends keyof T>(value: T[K], key: K) => boolean): T {
|
|
5
|
-
const result: { [K in keyof T]?: T[K] } = {}
|
|
6
|
-
;(Object.keys(obj) as Array<keyof T>).forEach((name) => {
|
|
7
|
-
if (predicate(obj[name], name)) {
|
|
8
|
-
result[name] = obj[name]
|
|
9
|
-
}
|
|
10
|
-
})
|
|
11
|
-
return result as T
|
|
12
|
-
}
|
package/utils/objectAssign.ts
DELETED