= ({
+ children,
+}) => {children}
diff --git a/src/ui/components/InlineCode/styles.css.ts b/src/ui/components/InlineCode/styles.css.ts
new file mode 100644
index 00000000..981bd9c2
--- /dev/null
+++ b/src/ui/components/InlineCode/styles.css.ts
@@ -0,0 +1,8 @@
+import { style } from '@vanilla-extract/css'
+
+export const code = style({
+ fontFamily: 'monospace',
+ display: 'block',
+ textIndent: '-10px',
+ paddingLeft: '10px',
+})
diff --git a/src/ui/components/TypeDocInterface/index.tsx b/src/ui/components/TypeDocInterface/index.tsx
index 3fdd1238..6c7966b8 100644
--- a/src/ui/components/TypeDocInterface/index.tsx
+++ b/src/ui/components/TypeDocInterface/index.tsx
@@ -9,6 +9,7 @@ import type {
import { InlineTypeContext } from '~/ui/contexts/InlineTypeContext'
import { findSource, ParentTypesMap } from '~/utils/docs'
import { IdHightlight } from '../IdHighlight'
+import { InlineCode } from '../InlineCode'
import { Markdown } from '../Markdown'
import { SourceLink } from '../SourceLink'
import { TypeDocType } from '../TypeDocType'
@@ -58,7 +59,11 @@ export function TypeDocInterface<
- {item.type && }
+ {item.type && (
+
+
+
+ )}
diff --git a/src/ui/components/TypeDocReflection/Object/index.tsx b/src/ui/components/TypeDocReflection/Object/index.tsx
new file mode 100644
index 00000000..c2647993
--- /dev/null
+++ b/src/ui/components/TypeDocReflection/Object/index.tsx
@@ -0,0 +1,34 @@
+import { Fragment, FunctionComponent, h } from 'preact'
+import { useContext } from 'preact/hooks'
+import type { DeclarationReflection } from 'typedoc'
+import { TypeIndentContext } from '~/ui/contexts/TypeIndentContext'
+import { Debug } from '../../Debug'
+import { TypeDocSignature } from '../../TypeDocSignature'
+import { TypeDocType } from '../../TypeDocType'
+
+interface TypeDocReflectionObjectProps {
+ declaration: DeclarationReflection
+}
+
+export const TypeDocReflectionObject: FunctionComponent = ({
+ declaration,
+}) => {
+ const indent = useContext(TypeIndentContext)
+ const localIndent = indent + 2
+
+ return (
+
+ {'{'}
+ {declaration.children?.map((child) => (
+ <>
+
+ {' '.repeat(localIndent)}
+ {child.name}
+ {child.flags.isOptional && '?'}:
+ >
+ ))}
+
+ {' '.repeat(indent) + '}'}
+
+ )
+}
diff --git a/src/ui/components/TypeDocReflection/Signature/styles.css.ts b/src/ui/components/TypeDocReflection/Object/styles.css.ts
similarity index 100%
rename from src/ui/components/TypeDocReflection/Signature/styles.css.ts
rename to src/ui/components/TypeDocReflection/Object/styles.css.ts
diff --git a/src/ui/components/TypeDocReflection/Signature/index.tsx b/src/ui/components/TypeDocReflection/Signature/index.tsx
index b7f13de0..2cb95a50 100644
--- a/src/ui/components/TypeDocReflection/Signature/index.tsx
+++ b/src/ui/components/TypeDocReflection/Signature/index.tsx
@@ -2,12 +2,12 @@ import { Fragment, FunctionComponent, h } from 'preact'
import type { SignatureReflection } from 'typedoc'
import { TypeDocSignature } from '../../TypeDocSignature'
-interface TypeDocReflectionProps {
+interface TypeDocReflectionSignatureProps {
signature: SignatureReflection
listed: boolean | undefined
}
-export const TypeDocReflectionSignature: FunctionComponent = ({
+export const TypeDocReflectionSignature: FunctionComponent = ({
signature,
listed,
}) => {
diff --git a/src/ui/components/TypeDocReflection/index.tsx b/src/ui/components/TypeDocReflection/index.tsx
index cb9daeb5..480dee3c 100644
--- a/src/ui/components/TypeDocReflection/index.tsx
+++ b/src/ui/components/TypeDocReflection/index.tsx
@@ -1,7 +1,7 @@
import { FunctionComponent, h } from 'preact'
import type { ReflectionType } from 'typedoc'
-import { ParentTypesMap } from '~/utils/docs'
import { Missing } from '../Missing'
+import { TypeDocReflectionObject } from './Object'
import { TypeDocReflectionSignature } from './Signature'
interface TypeDocReflection {
@@ -27,5 +27,6 @@ export const TypeDocReflection: FunctionComponent = ({
/>
)
}
- return
+
+ return
}
diff --git a/src/ui/components/TypeDocSignature/Arguments/index.tsx b/src/ui/components/TypeDocSignature/Arguments/index.tsx
index efe603a6..531f4d41 100644
--- a/src/ui/components/TypeDocSignature/Arguments/index.tsx
+++ b/src/ui/components/TypeDocSignature/Arguments/index.tsx
@@ -1,5 +1,7 @@
import { Fragment, FunctionComponent, h } from 'preact'
+import { useContext } from 'preact/hooks'
import type { ParameterReflection } from 'typedoc'
+import { TypeIndentContext } from '~/ui/contexts/TypeIndentContext'
import { ParentTypesMap } from '~/utils/docs'
import { TypeDocType } from '../../TypeDocType'
@@ -10,13 +12,16 @@ interface TypeDocSignatureArgumentsProps {
export const TypeDocSignatureArguments: FunctionComponent = ({
args,
}) => {
+ const indent = useContext(TypeIndentContext)
+ const localIndent = indent + 2
+
return (
- <>
+
{args.map((arg, index) => (
<>
- {' '}
+ {' '.repeat(localIndent)}
{arg.name}
{arg.flags.isOptional && '?'}
{arg.type && (
@@ -29,6 +34,6 @@ export const TypeDocSignatureArguments: FunctionComponent
>
))}
- >
+
)
}
diff --git a/src/ui/components/TypeDocSignature/Generics/index.tsx b/src/ui/components/TypeDocSignature/Generics/index.tsx
index 067dd501..b007a41d 100644
--- a/src/ui/components/TypeDocSignature/Generics/index.tsx
+++ b/src/ui/components/TypeDocSignature/Generics/index.tsx
@@ -1,4 +1,4 @@
-import { FunctionComponent, h } from 'preact'
+import { FunctionComponent, h, Fragment } from 'preact'
import { useContext } from 'preact/hooks'
import type { TypeParameterReflection } from 'typedoc'
import { InlineTypeContext } from '~/ui/contexts/InlineTypeContext'
@@ -16,12 +16,12 @@ export const TypeDocSignatureGenerics: FunctionComponent
+ <>
{'<'}
{params.map((param, index) => {
const id = inline.buildId?.(param)
return (
-
+ <>
{inline ? (
@@ -33,22 +33,22 @@ export const TypeDocSignatureGenerics: FunctionComponent
+ <>
{' '}
extends
-
+ >
)}
{param.default && (
-
+ <>
{' '}
=
-
+ >
)}
{index < params.length - 1 && ', '}
-
+ >
)
})}
{'>'}
-
+ >
)
}
diff --git a/src/ui/components/TypeDocType/index.tsx b/src/ui/components/TypeDocType/index.tsx
index 78b57126..866e0755 100644
--- a/src/ui/components/TypeDocType/index.tsx
+++ b/src/ui/components/TypeDocType/index.tsx
@@ -23,15 +23,15 @@ export const TypeDocType: FunctionComponent = ({
switch (type.type) {
case 'intrinsic':
- return {type.name}
+ return <>{type.name}>
case 'array':
return (
-
+ <>
Array{'<'}
{'>'}
-
+ >
)
case 'reference':
@@ -40,107 +40,104 @@ export const TypeDocType: FunctionComponent = ({
const hash = inline.parentTypesMap?.[id] || typeHash(type.name, id)
const typeArguments = type.typeArguments
return (
-
-
- {type.package ? (
- {type.name}
- ) : (
- {type.name}
- )}
+ <>
+ <>
+ {type.package ? <>{type.name}> : {type.name} }
{typeArguments && '<'}
-
+ >
{typeArguments && (
<>
{typeArguments.map((arg, index) => (
<>
-
-
- {index < typeArguments.length - 1 && ', '}
-
+
+ {index < typeArguments.length - 1 && <>, >}
>
))}
{'>'}
>
)}
-
+ >
)
case 'union':
return (
-
+ <>
{type.types.map((t, index) => (
-
+ <>
+ {index !== 0 && <>| >}
- {index < type.types.length - 1 && ' | '}
-
+ {index < type.types.length - 1 && <> >}
+ >
))}
-
+ >
)
+ case 'intersection':
+
case 'literal':
- return {JSON.stringify(type.value)}
+ return <>{JSON.stringify(type.value)}>
case 'reflection':
return
case 'typeOperator':
return (
-
+ <>
{type.operator}
-
+ >
)
case 'tuple':
return (
-
+ <>
[
{type.elements.map((t, index) => (
-
+ <>
{index < type.elements.length - 1 && ', '}
-
+ >
))}
]
-
+ >
)
case 'conditional':
return (
-
-
+ <>
+ <>
extends{' '}
- {' '}
-
+ >{' '}
+ <>
?
- {' '}
-
+ >{' '}
+ <>
:
-
-
+ >
+ >
)
case 'mapped':
return (
-
+ <>
{'{'}{' '}
-
+ <>
[{type.parameter} in
]:
- {' '}
+ >{' '}
{'}'}
-
+ >
)
case 'indexedAccess':
return (
-
-
+ <>
+ <>
[
-
+ >
]
-
+ >
)
case 'query':
@@ -148,7 +145,6 @@ export const TypeDocType: FunctionComponent = ({
case 'conditional':
case 'inferred':
case 'unknown':
- case 'intersection':
case 'typeOperator':
case 'template-literal':
case 'named-tuple-member':
diff --git a/src/ui/contexts/InlineTypeContext/index.tsx b/src/ui/contexts/InlineTypeContext/index.ts
similarity index 100%
rename from src/ui/contexts/InlineTypeContext/index.tsx
rename to src/ui/contexts/InlineTypeContext/index.ts
diff --git a/src/ui/contexts/TypeIndentContext/index.ts b/src/ui/contexts/TypeIndentContext/index.ts
new file mode 100644
index 00000000..ce7caa09
--- /dev/null
+++ b/src/ui/contexts/TypeIndentContext/index.ts
@@ -0,0 +1,3 @@
+import { createContext } from 'preact'
+
+export const TypeIndentContext = createContext(0)
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
index b71e3bec..4d2e4351 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
@@ -3,6 +3,7 @@ import { h } from 'preact'
import { useMemo } from 'preact/hooks'
import type { DeclarationReflection, SignatureReflection } from 'typedoc'
import { Code } from '~/ui/components/Code'
+import { DocUsage } from '~/ui/components/DocUsage'
import { Item } from '~/ui/components/Item'
import { Markdown } from '~/ui/components/Markdown'
import { Missing } from '~/ui/components/Missing'
@@ -14,11 +15,13 @@ import { TypeDocType } from '~/ui/components/TypeDocType'
import { InlineTypeContext } from '~/ui/contexts/InlineTypeContext'
import {
findSource,
+ generateTypeUsage,
inlineTypeHash,
inlineTypeId,
inlineTypeIdHighlightMatch,
ParentTypesMap,
typeHash,
+ typeId as typeIdStr,
} from '~/utils/docs'
import * as styles from './styles.css'
@@ -35,9 +38,13 @@ export const useTypesModal = createModal(
const map = useMemo(() => buildMap(types), [types])
const type = map[typeId] as DeclarationReflection | undefined
const parentTypesMap = buildParentTypesMap(type)
-
- console.log('>>> TYPE', type)
- console.log('>>> MAP', parentTypesMap)
+ const usage = useMemo(
+ () =>
+ type?.kindString &&
+ kindHasUsage(type.kindString) &&
+ generateTypeUsage(type.name),
+ [type]
+ )
return (
(
)}
+ {usage && (
+
+ )}
+
{type.type && (
Type
@@ -237,6 +253,18 @@ function buildMap(types: DeclarationReflection[]) {
return map
}
+function kindHasUsage(kindString: string): boolean {
+ switch (kindString) {
+ case 'Type alias':
+ case 'Interface':
+ return true
+
+ case 'Type parameter':
+ default:
+ return false
+ }
+}
+
function kindToBadgeStyle(kindString: string): keyof typeof styles.badge {
switch (kindString) {
case 'Type alias':
diff --git a/src/utils/docs/index.ts b/src/utils/docs/index.ts
index 2fffda0c..919371e1 100644
--- a/src/utils/docs/index.ts
+++ b/src/utils/docs/index.ts
@@ -25,6 +25,19 @@ export function generateUsage(name: string, module = name) {
return { usage, usageTabs }
}
+export function generateTypeUsage(name: string) {
+ const usage = {
+ esm: {
+ code: `import type { ${name} } from "date-fns";`,
+ title: 'ESM',
+ },
+ }
+
+ const usageTabs = ['esm']
+
+ return { usage, usageTabs }
+}
+
export function extractCodeFromTagString(example: string): string {
return example.match(/```ts\n([\s\S]+?)\n```/)?.[1] ?? ''
}
From a785f4320039b9e5f0b16a8843450b9dbf640580 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Tue, 7 Feb 2023 10:44:52 +0800
Subject: [PATCH 18/36] Add section headers to types
---
.../screens/Docs/Doc/TypeDoc/Types/index.tsx | 21 +++++++++----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
index 4d2e4351..434aac86 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
@@ -9,6 +9,7 @@ import { Markdown } from '~/ui/components/Markdown'
import { Missing } from '~/ui/components/Missing'
import { createModal } from '~/ui/components/Modals'
import { RichText } from '~/ui/components/RichText'
+import { SectionHeader } from '~/ui/components/SectionHeader'
import { SourceLink } from '~/ui/components/SourceLink'
import { TypeDocInterface } from '~/ui/components/TypeDocInterface'
import { TypeDocType } from '~/ui/components/TypeDocType'
@@ -45,6 +46,7 @@ export const useTypesModal = createModal(
generateTypeUsage(type.name),
[type]
)
+ const scope = type && typeIdStr(type.name, type.id)
return (
(
usage={usage.usage}
usageTabs={usage.usageTabs}
header="h3"
- scope={typeIdStr(type.name, type.id)}
+ scope={scope}
/>
)}
{type.type && (
)}
{type.typeParameters && (
)}
-
+
@@ -159,17 +159,17 @@ export const useTypesModal = createModal(
interface ContentProps {
type: DeclarationReflection
+ scope: string | undefined
}
-function TypeContent({ type }: ContentProps) {
+function TypeContent({ type, scope }: ContentProps) {
switch (type.kindString) {
case 'Interface':
if (!type.children?.length) return null
return (
-
Interface
-
+
)
@@ -179,8 +179,7 @@ function TypeContent({ type }: ContentProps) {
{type.default && (
-
Default type
-
+
} />
)}
From 9650bd7ecc10156649439d436e8ddd2bbc8ad5d4 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Fri, 10 Mar 2023 13:30:08 +0800
Subject: [PATCH 19/36] Commit bunch of changes
---
package.json | 2 +-
src/ui/components/DocDescription/index.tsx | 6 +-
src/ui/components/HighlightQuery/index.tsx | 4 +-
src/ui/components/IdHighlight/index.tsx | 12 +-
src/ui/components/Item/index.tsx | 28 ++++-
src/ui/components/Item/styles.css.ts | 2 +-
src/ui/components/NoSearchResults/index.tsx | 13 +--
src/ui/components/RichText/styles.css.ts | 2 +-
src/ui/components/Search/index.tsx | 7 +-
src/ui/components/Search/styles.css.ts | 2 +-
.../TypeDocSignature/Generics/index.tsx | 6 +-
src/ui/components/TypeDocSignature/index.tsx | 5 +-
.../contexts/IgnoreParentTypesSource/index.ts | 3 +
src/ui/hooks/useActiveItem/index.ts | 19 ++++
src/ui/hooks/useQuery/index.tsx | 13 +++
.../Docs/Doc/TypeDoc/Constants/index.tsx | 11 +-
.../Doc/TypeDoc/Function/Signature/index.tsx | 5 +-
.../Docs/Doc/TypeDoc/Function/index.tsx | 44 +++++++-
.../screens/Docs/Doc/TypeDoc/Types/index.tsx | 106 +++++++++++++-----
.../Docs/Doc/TypeDoc/Types/styles.css.ts | 21 +++-
src/ui/screens/Docs/Finder/Categories.tsx | 3 +
src/ui/screens/Docs/Finder/Items.tsx | 63 ++++++-----
src/ui/screens/Docs/Finder/index.tsx | 6 +-
src/utils/docs/index.ts | 31 ++++-
src/utils/dom/index.ts | 75 +++++++++++++
yarn.lock | 8 +-
26 files changed, 383 insertions(+), 114 deletions(-)
create mode 100644 src/ui/contexts/IgnoreParentTypesSource/index.ts
create mode 100644 src/ui/hooks/useActiveItem/index.ts
create mode 100644 src/ui/hooks/useQuery/index.tsx
create mode 100644 src/utils/dom/index.ts
diff --git a/package.json b/package.json
index cb41cca8..960c881a 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"start": "env NODE_ENV=development ts-node -r tsconfig-paths/register devServer.ts"
},
"dependencies": {
- "@date-fns/docs": "0.22.0",
+ "@date-fns/docs": "0.24.0",
"@sentry/browser": "^5.30.0",
"@sentry/tracing": "^5.30.0",
"@switcher/preact": "2.3.0",
diff --git a/src/ui/components/DocDescription/index.tsx b/src/ui/components/DocDescription/index.tsx
index 21b750eb..d3730758 100644
--- a/src/ui/components/DocDescription/index.tsx
+++ b/src/ui/components/DocDescription/index.tsx
@@ -6,15 +6,19 @@ interface DocDescriptionProps {
description: string
scope?: string
header?: 'h2' | 'h3'
+ skipHeader?: boolean
}
export const DocDescription: FunctionComponent = ({
description,
header,
scope,
+ skipHeader,
}) => (
-
+ {!skipHeader && (
+
+ )}
)
diff --git a/src/ui/components/HighlightQuery/index.tsx b/src/ui/components/HighlightQuery/index.tsx
index feeaadca..2204c160 100644
--- a/src/ui/components/HighlightQuery/index.tsx
+++ b/src/ui/components/HighlightQuery/index.tsx
@@ -5,7 +5,7 @@ import * as styles from './styles.css'
interface HighlightQueryProps {
text: string
- query: string
+ query: string | undefined
}
export const HighlightQuery: FunctionComponent = ({
@@ -33,7 +33,7 @@ interface Chunk {
type: 'chunk' | 'query'
}
-function highlightText(text: string, query: string): Chunk[] {
+function highlightText(text: string, query: string | undefined): Chunk[] {
if (!text || !query) return [{ text, type: 'chunk' }]
const chunks: Chunk[] = []
diff --git a/src/ui/components/IdHighlight/index.tsx b/src/ui/components/IdHighlight/index.tsx
index d15b0cd3..9b622cc5 100644
--- a/src/ui/components/IdHighlight/index.tsx
+++ b/src/ui/components/IdHighlight/index.tsx
@@ -1,6 +1,7 @@
import { match } from 'assert'
import { FunctionComponent, h } from 'preact'
import { useEffect, useRef } from 'preact/hooks'
+import { isInViewport } from '~/utils/dom'
import * as styles from './styles.css'
interface IdHightlightProps {
@@ -62,14 +63,3 @@ export const IdHightlight: FunctionComponent = ({
)
}
-
-function isInViewport(element: HTMLElement): boolean {
- const rect = element.getBoundingClientRect()
- return (
- rect.top >= 0 &&
- rect.left >= 0 &&
- rect.bottom <=
- (window.innerHeight || document.documentElement.clientHeight) &&
- rect.right <= (window.innerWidth || document.documentElement.clientWidth)
- )
-}
diff --git a/src/ui/components/Item/index.tsx b/src/ui/components/Item/index.tsx
index 203874a2..986fb5e2 100644
--- a/src/ui/components/Item/index.tsx
+++ b/src/ui/components/Item/index.tsx
@@ -1,27 +1,45 @@
import classNames from 'classnames'
import { Fragment, FunctionComponent, h } from 'preact'
+import { Ref } from 'preact/hooks'
+import { highlightMarkdown } from '~/utils/docs'
+import { HighlightQuery } from '../HighlightQuery'
+import { Markdown } from '../Markdown'
+import { RichText } from '../RichText'
import * as styles from './styles.css'
interface Props {
title: string
summary: string | undefined
- selected: boolean
+ active: boolean
code: boolean
+ query?: string
+ activeRef?: Ref
}
export const Item: FunctionComponent = ({
title,
summary,
- selected,
+ active,
code,
+ query,
+ activeRef,
}) => (
-
+
- {title}
+
- {styles.summary &&
{summary}
}
+ {summary && (
+
+
+
+
+
+ )}
diff --git a/src/ui/components/Item/styles.css.ts b/src/ui/components/Item/styles.css.ts
index 699b74d4..bdf28c69 100644
--- a/src/ui/components/Item/styles.css.ts
+++ b/src/ui/components/Item/styles.css.ts
@@ -24,7 +24,7 @@ export const icon = style({
marginLeft: '10px',
})
-export const selected = style({
+export const active = style({
backgroundColor: '#fff0f3',
':hover': {
diff --git a/src/ui/components/NoSearchResults/index.tsx b/src/ui/components/NoSearchResults/index.tsx
index a6957372..c7b6bb0e 100644
--- a/src/ui/components/NoSearchResults/index.tsx
+++ b/src/ui/components/NoSearchResults/index.tsx
@@ -1,21 +1,18 @@
-import classNames from 'classnames'
import { Fragment, FunctionComponent, h } from 'preact'
-import { useMemo } from 'preact/hooks'
+import { RichText } from '../RichText'
import * as styles from './styles.css'
interface NoSearchResultsProps {
noun: string
- query: string
- setQuery: (query: string) => void
+ query: [string, (query: string) => void]
}
export const NoSearchResults: FunctionComponent
= ({
noun,
- query,
- setQuery,
+ query: [query, setQuery],
}) => {
return (
-
+
)
}
diff --git a/src/ui/components/RichText/styles.css.ts b/src/ui/components/RichText/styles.css.ts
index ea380557..470bf023 100644
--- a/src/ui/components/RichText/styles.css.ts
+++ b/src/ui/components/RichText/styles.css.ts
@@ -2,7 +2,7 @@ import { style, globalStyle } from '@vanilla-extract/css'
export const content = style({
fontSize: '1rem',
- lineHeight: '1.6em',
+ lineHeight: '1.6',
})
globalStyle(`${content} a`, {
diff --git a/src/ui/components/Search/index.tsx b/src/ui/components/Search/index.tsx
index 1145f715..df3cb6b6 100644
--- a/src/ui/components/Search/index.tsx
+++ b/src/ui/components/Search/index.tsx
@@ -1,18 +1,20 @@
import { FunctionComponent, h } from 'preact'
// import { trackAction } from 'app/acts/tracking_acts'
import debounce from 'lodash/debounce'
-import { StateUpdater, useCallback } from 'preact/hooks'
+import { Ref, StateUpdater, useCallback } from 'preact/hooks'
import * as styles from './styles.css'
import classNames from 'classnames'
interface SearchProps {
- query: [string, StateUpdater]
+ query: [string, (query: string) => void]
bordered?: boolean
+ inputRef?: Ref
}
export const Search: FunctionComponent = ({
query: [query, setQuery],
bordered,
+ inputRef,
}) => {
const trackSearch = useCallback(
debounce((newQuery: string) => {
@@ -36,6 +38,7 @@ export const Search: FunctionComponent = ({
trackSearch(newQuery)
setQuery(newQuery)
}}
+ ref={inputRef}
/>
{query.trim().length > 0 && }
diff --git a/src/ui/components/Search/styles.css.ts b/src/ui/components/Search/styles.css.ts
index 64571ba7..1531077d 100644
--- a/src/ui/components/Search/styles.css.ts
+++ b/src/ui/components/Search/styles.css.ts
@@ -28,7 +28,7 @@ export const cancel = style({
backgroundImage: `url('${cancelURL}')`,
backgroundSize: '16px',
position: 'absolute',
- right: '1.5rem',
+ right: '1rem',
})
export const input = style({
diff --git a/src/ui/components/TypeDocSignature/Generics/index.tsx b/src/ui/components/TypeDocSignature/Generics/index.tsx
index b007a41d..9f1a6469 100644
--- a/src/ui/components/TypeDocSignature/Generics/index.tsx
+++ b/src/ui/components/TypeDocSignature/Generics/index.tsx
@@ -1,6 +1,7 @@
import { FunctionComponent, h, Fragment } from 'preact'
import { useContext } from 'preact/hooks'
import type { TypeParameterReflection } from 'typedoc'
+import { IgnoreParentTypesSourceContext } from '~/ui/contexts/IgnoreParentTypesSource'
import { InlineTypeContext } from '~/ui/contexts/InlineTypeContext'
import { ParentTypesMap, typeHash } from '~/utils/docs'
import { IdHightlight } from '../../IdHighlight'
@@ -14,6 +15,7 @@ export const TypeDocSignatureGenerics: FunctionComponent {
const inline = useContext(InlineTypeContext)
+ const ignoreSource = useContext(IgnoreParentTypesSourceContext)
return (
<>
@@ -22,7 +24,9 @@ export const TypeDocSignatureGenerics: FunctionComponent
- {inline ? (
+ {inline && ignoreSource && inline.parentTypesMap?.[param.id] ? (
+ {param.name}
+ ) : inline && !ignoreSource ? (
{param.name}
diff --git a/src/ui/components/TypeDocSignature/index.tsx b/src/ui/components/TypeDocSignature/index.tsx
index 886b5b95..2336cd3d 100644
--- a/src/ui/components/TypeDocSignature/index.tsx
+++ b/src/ui/components/TypeDocSignature/index.tsx
@@ -1,11 +1,8 @@
-import classNames from 'classnames'
import { Fragment, FunctionComponent, h } from 'preact'
-import type { SignatureReflection, TypeParameterReflection } from 'typedoc'
-import { ParentTypesMap } from '~/utils/docs'
+import type { SignatureReflection } from 'typedoc'
import { TypeDocType } from '../TypeDocType'
import { TypeDocSignatureArguments as Arguments } from './Arguments'
import { TypeDocSignatureGenerics as Generics } from './Generics'
-import * as styles from './styles.css'
interface TypeDocSignatureProps {
name?: string
diff --git a/src/ui/contexts/IgnoreParentTypesSource/index.ts b/src/ui/contexts/IgnoreParentTypesSource/index.ts
new file mode 100644
index 00000000..d751b1a3
--- /dev/null
+++ b/src/ui/contexts/IgnoreParentTypesSource/index.ts
@@ -0,0 +1,3 @@
+import { createContext } from 'preact'
+
+export const IgnoreParentTypesSourceContext = createContext(false)
diff --git a/src/ui/hooks/useActiveItem/index.ts b/src/ui/hooks/useActiveItem/index.ts
new file mode 100644
index 00000000..6d033738
--- /dev/null
+++ b/src/ui/hooks/useActiveItem/index.ts
@@ -0,0 +1,19 @@
+import { useEffect, useRef, useState } from 'preact/hooks'
+import {
+ scrollIntoViewIfNeeded,
+ ScrollIntoViewIfNeededOptions,
+} from '~/utils/dom'
+
+export function useActiveItem(
+ id: unknown,
+ options?: ScrollIntoViewIfNeededOptions
+) {
+ const activeRef = useRef(null)
+
+ useEffect(() => {
+ console.log('item', activeRef.current)
+ scrollIntoViewIfNeeded(activeRef.current, options)
+ }, [id])
+
+ return { activeRef }
+}
diff --git a/src/ui/hooks/useQuery/index.tsx b/src/ui/hooks/useQuery/index.tsx
new file mode 100644
index 00000000..26019bde
--- /dev/null
+++ b/src/ui/hooks/useQuery/index.tsx
@@ -0,0 +1,13 @@
+import { useRef, useState } from 'preact/hooks'
+
+export function useQuery() {
+ const searchRef = useRef(null)
+ const [query, setQueryState] = useState('')
+
+ function setQuery(str: string) {
+ setQueryState(str)
+ searchRef.current?.focus()
+ }
+
+ return { query, setQuery, searchRef }
+}
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Constants/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Constants/index.tsx
index dd1b60ff..9033c0c8 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Constants/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Constants/index.tsx
@@ -22,11 +22,12 @@ import { Search } from '~/ui/components/Search'
import { SectionHeader } from '~/ui/components/SectionHeader'
import { SourceLink } from '~/ui/components/SourceLink'
import { TypeDocType } from '~/ui/components/TypeDocType'
+import { useQuery } from '~/ui/hooks/useQuery'
import {
extractCodeFromTagString,
findSource,
generateUsage,
- hightlightMarkdown,
+ highlightMarkdown,
} from '~/utils/docs'
import * as styles from './styles.css'
@@ -47,7 +48,7 @@ export const TypeDocConstants: FunctionComponent = ({
}) => {
const description = useMemo(() => findDescription(doc), [doc])
- const [query, setQuery] = useState('')
+ const { query, setQuery, searchRef } = useQuery()
const constants: ConstantItem[] = useMemo(
() =>
@@ -80,7 +81,7 @@ export const TypeDocConstants: FunctionComponent = ({
-
+
{filtered.length ? (
@@ -90,7 +91,7 @@ export const TypeDocConstants: FunctionComponent = ({
))}
) : (
-
+
)}
@@ -136,7 +137,7 @@ function Constant({ item, query }: ConstantProps) {
{description && (
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx
index f4507e90..dcc033f1 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx
@@ -2,6 +2,7 @@ import { findSignatureReturns } from '@date-fns/docs/utils'
import { h, FunctionComponent, Fragment } from 'preact'
import { useMemo } from 'preact/hooks'
import type { SignatureReflection, TypeParameterReflection } from 'typedoc'
+import { IgnoreParentTypesSourceContext } from '~/ui/contexts/IgnoreParentTypesSource'
import { Arguments } from '../Arguments'
import { Generics } from '../Generics'
import { Returns } from '../Returns'
@@ -27,7 +28,9 @@ export const Signature: FunctionComponent = ({
return (
<>
-
+
+
+
{signature.typeParameter && (
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
index 1553a03c..bebf91a6 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
@@ -1,17 +1,28 @@
import type { DateFnsDocs } from '@date-fns/docs/types'
-import { findFn, findFnDescription, findFnExamples } from '@date-fns/docs/utils'
+import {
+ findFn,
+ findFnDescription,
+ findFnExamples,
+ traverseType,
+} from '@date-fns/docs/utils'
import { FunctionComponent, h } from 'preact'
import { useMemo } from 'preact/hooks'
-import type { DeclarationReflection } from 'typedoc'
+import type { DeclarationReflection, SignatureReflection } from 'typedoc'
import { DocDescription } from '~/ui/components/DocDescription'
import { DocExamples } from '~/ui/components/DocExamples'
import { DocHeader } from '~/ui/components/DocHeader'
import { DocLinks } from '~/ui/components/DocLinks'
import { DocUsage } from '~/ui/components/DocUsage'
+import { InlineTypeContext } from '~/ui/contexts/InlineTypeContext'
import {
extractCodeFromTagString,
findSource,
generateUsage,
+ inlineTypeHash,
+ pageTypeHash,
+ pageTypeId,
+ pageTypeIdHighlightMatch,
+ ParentTypesMap,
} from '~/utils/docs'
import { Signatures } from './Signatures'
@@ -25,6 +36,7 @@ export const TypeDocFunction: FunctionComponent = ({
doc,
}) => {
const fn = useMemo(() => findFn(doc), [doc])
+ const parentTypesMap = useMemo(() => buildParentTypesMap(fn), [fn])
const description = useMemo(() => fn && findFnDescription(fn), [fn])
const { usage, usageTabs } = useMemo(() => generateUsage(doc.name), [doc])
const signatures = fn && fn.signatures
@@ -33,11 +45,19 @@ export const TypeDocFunction: FunctionComponent = ({
[fn]
)
+ console.log('+++++++++++++++++++++++', parentTypesMap)
+
return (
-
+ pageTypeId(refl.name, refl.id),
+ idHighlightMatch: pageTypeIdHighlightMatch,
+ parentTypesMap,
+ }}
+ >
{page.title}
- {description && }
+ {description && }
@@ -50,6 +70,20 @@ export const TypeDocFunction: FunctionComponent = ({
-
+
)
}
+
+function buildParentTypesMap(
+ refl: DeclarationReflection | undefined
+): ParentTypesMap {
+ const map: ParentTypesMap = {}
+
+ refl?.signatures?.forEach((signature) => {
+ signature?.typeParameter?.map((r) => {
+ map[r.id] = pageTypeHash(r.name, r.id)
+ })
+ })
+
+ return map
+}
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
index 434aac86..989c222c 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
@@ -1,4 +1,9 @@
-import { joinCommentParts, traverseType } from '@date-fns/docs/utils'
+import {
+ findDescription,
+ findSummary,
+ joinCommentParts,
+ traverseType,
+} from '@date-fns/docs/utils'
import { h } from 'preact'
import { useMemo } from 'preact/hooks'
import type { DeclarationReflection, SignatureReflection } from 'typedoc'
@@ -8,12 +13,16 @@ import { Item } from '~/ui/components/Item'
import { Markdown } from '~/ui/components/Markdown'
import { Missing } from '~/ui/components/Missing'
import { createModal } from '~/ui/components/Modals'
+import { NoSearchResults } from '~/ui/components/NoSearchResults'
import { RichText } from '~/ui/components/RichText'
+import { Search } from '~/ui/components/Search'
import { SectionHeader } from '~/ui/components/SectionHeader'
import { SourceLink } from '~/ui/components/SourceLink'
import { TypeDocInterface } from '~/ui/components/TypeDocInterface'
import { TypeDocType } from '~/ui/components/TypeDocType'
import { InlineTypeContext } from '~/ui/contexts/InlineTypeContext'
+import { useQuery } from '~/ui/hooks/useQuery'
+import { useActiveItem } from '~/ui/hooks/useActiveItem'
import {
findSource,
generateTypeUsage,
@@ -33,12 +42,18 @@ export interface TypesModalProps {
nestedId: number | undefined
}
+interface TypeItem {
+ type: DeclarationReflection
+ summary: string | undefined
+ description: string | undefined
+}
+
export const useTypesModal = createModal(
({ parent, typeId, doc }) => {
const types = useMemo(() => extractTypes(doc), [doc])
const map = useMemo(() => buildMap(types), [types])
const type = map[typeId] as DeclarationReflection | undefined
- const parentTypesMap = buildParentTypesMap(type)
+ const parentTypesMap = useMemo(() => buildParentTypesMap(type), [type])
const usage = useMemo(
() =>
type?.kindString &&
@@ -48,15 +63,39 @@ export const useTypesModal = createModal(
)
const scope = type && typeIdStr(type.name, type.id)
+ const { query, setQuery, searchRef } = useQuery()
+
+ const navItems: TypeItem[] = useMemo(
+ () =>
+ types.map((t) => {
+ const summary = findSummary(t)
+ const description = findDescription(t)
+ return { type: t, summary, description }
+ }) || [],
+ [types]
+ )
+
+ const filteredNav = useMemo(
+ () =>
+ query
+ ? navItems.filter(
+ (item) =>
+ item.type.name.toLowerCase().includes(query.toLowerCase()) ||
+ item.summary?.toLowerCase().includes(query.toLowerCase()) ||
+ item.description?.toLowerCase().includes(query.toLowerCase())
+ )
+ : navItems,
+ [navItems, query]
+ )
+
+ const { activeRef } = useActiveItem(type?.id)
+
return (
{
- console.log(type, inlineTypeId(type, t))
- return inlineTypeId(type, t)
- },
+ buildId: inlineTypeId.bind(null, type),
idHighlightMatch: inlineTypeIdHighlightMatch,
parentTypesMap,
}
@@ -68,22 +107,31 @@ export const useTypesModal = createModal(
{parent} types
-
+
- {types.map((type) => (
-
-
-
- ))}
+
+
+
+ {filteredNav.length ? (
+ filteredNav.map(({ type, summary, description }) => (
+
+
+
+ ))
+ ) : (
+
+
+
+ )}
+
{type ? (
@@ -216,16 +264,17 @@ function extractTypes(
switch (child.kindString) {
// Ignore these types and their children
case 'Module':
- return
-
- // Process function singatures and add their type parameters
case 'Function':
- child.signatures?.forEach((signature) => {
- // @ts-ignore: For some reason TypeDoc contains the error, it's typeParameter not typeParameters
- signature.typeParameter?.forEach((param) => types.push(param))
- })
return
+ // // Process function singatures and add their type parameters
+ // case 'Function':
+ // child.signatures?.forEach((signature) => {
+ // // @ts-ignore: For some reason TypeDoc contains the error, it's typeParameter not typeParameters
+ // signature.typeParameter?.forEach((param) => types.push(param))
+ // })
+ // return
+
// Add these types, but not process their children
case 'Interface':
case 'Type alias':
@@ -310,7 +359,6 @@ function buildParentTypesMap(
type?.type &&
traverseType(type.type, (ref) => {
- console.log(' ~~~', ref)
if (ref.type === 'reflection') {
ref.declaration?.signatures?.forEach((signature) => {
buildParentTypesMap(refl, signature, map)
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts b/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts
index e41a1849..29c1100f 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts
@@ -1,6 +1,10 @@
import { globalStyle, style, styleVariants } from '@vanilla-extract/css'
-export const wrapper = style({})
+export const wrapper = style({
+ height: 'min(calc(100vh - 8rem), 50rem)',
+ display: 'grid',
+ gridTemplateRows: 'auto 1fr',
+})
export const title = style({
background: '#ebe1d8',
@@ -23,11 +27,11 @@ export const titleParent = style({
fontFamily: 'monospace',
})
-export const inner = style({
+export const main = style({
display: 'grid',
gridTemplateColumns: '23rem auto',
- maxHeight: '50rem',
gridTemplateRows: '1fr',
+ overflow: 'hidden',
})
export const item = style({
@@ -36,9 +40,20 @@ export const item = style({
export const nav = style({
borderRight: '1px solid #e6e0e6',
+ display: 'grid',
+ gridTemplateRows: 'auto 1fr',
+ overflow: 'hidden',
+})
+
+export const list = style({
overflowY: 'auto',
})
+export const noResults = style({
+ textAlign: 'center',
+ padding: '1rem',
+})
+
export const content = style({
padding: '2rem',
overflowY: 'auto',
diff --git a/src/ui/screens/Docs/Finder/Categories.tsx b/src/ui/screens/Docs/Finder/Categories.tsx
index 04fb7efa..5108efee 100644
--- a/src/ui/screens/Docs/Finder/Categories.tsx
+++ b/src/ui/screens/Docs/Finder/Categories.tsx
@@ -10,6 +10,7 @@ interface Props {
selectedSubmodule: DateFnsDocs.Submodule
selectedPage: string
onNavigate(): void
+ query: string
}
export const Categories: FunctionComponent
= ({
@@ -19,6 +20,7 @@ export const Categories: FunctionComponent = ({
selectedSubmodule,
selectedPage,
onNavigate,
+ query,
}) => (
{categories.map((category) => {
@@ -39,6 +41,7 @@ export const Categories: FunctionComponent = ({
selectedSubmodule={selectedSubmodule}
selectedPage={selectedPage}
onNavigate={onNavigate}
+ query={query}
/>
diff --git a/src/ui/screens/Docs/Finder/Items.tsx b/src/ui/screens/Docs/Finder/Items.tsx
index 4af3ab7a..62af86ff 100644
--- a/src/ui/screens/Docs/Finder/Items.tsx
+++ b/src/ui/screens/Docs/Finder/Items.tsx
@@ -4,6 +4,7 @@ import { RouterLink } from '~/ui/router'
import { docLink } from '~/ui/router/docLink'
import * as styles from './styles.css'
import { Item } from '~/ui/components/Item'
+import { useActiveItem } from '~/ui/hooks/useActiveItem'
interface Props {
pages: DateFnsDocs.PagePreview[]
@@ -11,6 +12,7 @@ interface Props {
selectedSubmodule: DateFnsDocs.Submodule
selectedPage: string
onNavigate(): void
+ query: string
}
export const Items: FunctionComponent
= ({
@@ -19,29 +21,38 @@ export const Items: FunctionComponent = ({
selectedSubmodule,
selectedPage,
onNavigate,
-}) => (
- <>
- {pages.map((page) => (
-
-
-
- ))}
- >
-)
+ query,
+}) => {
+ const { activeRef } = useActiveItem(selectedPage, {
+ marginTop: 33,
+ })
+
+ return (
+ <>
+ {pages.map((page) => (
+
+
+
+ ))}
+ >
+ )
+}
diff --git a/src/ui/screens/Docs/Finder/index.tsx b/src/ui/screens/Docs/Finder/index.tsx
index 5191005c..2a1a9c58 100644
--- a/src/ui/screens/Docs/Finder/index.tsx
+++ b/src/ui/screens/Docs/Finder/index.tsx
@@ -11,6 +11,7 @@ import { NoResults } from './NoResults'
import * as styles from './styles.css'
import { filterPages } from './utils'
import { Widget } from './Widget'
+import { useQuery } from '~/ui/hooks/useQuery'
interface FinderProps {
selectedVersion: string
@@ -25,7 +26,7 @@ export const Finder: FunctionComponent = ({
selectedPage,
onNavigate,
}) => {
- const [query, setQuery] = useState('')
+ const { query, setQuery, searchRef } = useQuery()
const [versions, { loading }] = useRead(
db.versions.query(($) => [
@@ -40,7 +41,7 @@ export const Finder: FunctionComponent = ({
return (
-
+
{filteredPages.length === 0 ? (
@@ -53,6 +54,7 @@ export const Finder: FunctionComponent = ({
selectedSubmodule={selectedSubmodule}
selectedPage={selectedPage}
onNavigate={onNavigate}
+ query={query}
/>
)}
diff --git a/src/utils/docs/index.ts b/src/utils/docs/index.ts
index 919371e1..1ac6579a 100644
--- a/src/utils/docs/index.ts
+++ b/src/utils/docs/index.ts
@@ -55,12 +55,20 @@ export function findSource(
return trimHash ? url.replace(/#.*$/, '') : url
}
-export function hightlightMarkdown(text: string, query: string) {
+export function highlightMarkdown(text: string, query: string | undefined) {
if (!query) return text
const regex = new RegExp(query, 'gi')
return text.replace(regex, (match) => `==${match}==`)
}
+export function pageTypeHash(name: string, id: number) {
+ return `#${pageTypeId(name, id)}`
+}
+
+export function pageTypeId(name: string, id: number) {
+ return `page/${name}/${id}/${rand()}`
+}
+
export function typeHash(name: string, id: number, nested?: string) {
return `#${typeId(name, id, nested)}`
}
@@ -86,6 +94,27 @@ export function matchTypeHash(hash: string) {
return { typeId, nestedId }
}
+const pageTypeHashRE = /types\/\w+\/(\d+)(?:\/\w+)?/
+
+export function matchPageTypeHash(hash: string) {
+ const captures = hash.match(pageTypeHashRE)
+ if (!captures) return
+
+ const type = captures[1]
+ if (!type) return
+
+ const typeId = parseInt(type)
+ if (isNaN(typeId)) return
+
+ return typeId
+}
+
+export function pageTypeIdHighlightMatch(id: string, hash: string) {
+ const idMatch = matchPageTypeHash(id)
+ const hashMatch = matchPageTypeHash(hash)
+ return (idMatch && idMatch === hashMatch) || false
+}
+
export function inlineTypeHash(
refl: DeclarationReflection,
type: TypeParameterReflection | ParameterReflection | DeclarationReflection
diff --git a/src/utils/dom/index.ts b/src/utils/dom/index.ts
new file mode 100644
index 00000000..965c52ec
--- /dev/null
+++ b/src/utils/dom/index.ts
@@ -0,0 +1,75 @@
+import { consoleTestResultHandler } from 'tslint/lib/test'
+
+export interface ScrollIntoViewIfNeededOptions extends ScrollToOptions {
+ marginTop?: number
+}
+
+export function scrollIntoViewIfNeeded(
+ element: HTMLElement | null,
+ { marginTop, behavior }: ScrollIntoViewIfNeededOptions = {}
+): void {
+ if (!element) return
+
+ const rect = element.getBoundingClientRect()
+ const scrollParent = findParentWithScroll(element)
+ console.log({ scrollParent })
+
+ if (!scrollParent) return
+
+ const parentRect = scrollParent.getBoundingClientRect()
+
+ const inViewport =
+ rect.top >= parentRect.top + (marginTop || 0) + scrollParent.scrollTop &&
+ rect.left >= parentRect.left &&
+ rect.bottom <= parentRect.bottom + scrollParent.scrollTop &&
+ rect.right <= parentRect.right
+
+ console.log({
+ rect,
+ parentRect,
+ marginTop,
+ inViewport,
+ scrollTop: scrollParent.scrollTop,
+ })
+
+ if (inViewport) return
+
+ scrollParent.scrollTo({
+ top: rect.top - parentRect.top - (marginTop || 0),
+ behavior,
+ })
+
+ // element.scrollIntoView({ behavior })
+}
+
+export function isInViewport(
+ element: HTMLElement,
+ marginTop?: number
+): boolean {
+ const rect = element.getBoundingClientRect()
+ const scrollParent = findParentWithScroll(element)
+
+ if (!scrollParent) return true
+
+ const parentRect = scrollParent.getBoundingClientRect()
+
+ console.log({ rect, parentRect, marginTop })
+
+ return (
+ rect.top >= parentRect.top + (marginTop || 0) &&
+ rect.left >= parentRect.left &&
+ rect.bottom <= parentRect.bottom &&
+ rect.right <= parentRect.right
+ )
+}
+
+function findParentWithScroll(element: HTMLElement): HTMLElement | null {
+ let current: HTMLElement | null = element
+ while (current) {
+ if (current.offsetHeight < current.scrollHeight) {
+ return current
+ }
+ current = current.parentElement
+ }
+ return null
+}
diff --git a/yarn.lock b/yarn.lock
index 03967a03..2f8fed30 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -251,10 +251,10 @@
dependencies:
"@jridgewell/trace-mapping" "0.3.9"
-"@date-fns/docs@0.22.0":
- version "0.22.0"
- resolved "https://registry.yarnpkg.com/@date-fns/docs/-/docs-0.22.0.tgz#aaaafdba6b5c192ef2e2cb8a969821498592f42d"
- integrity sha512-LKpsZZZXy2oqAW62TQ7UZCN3uoO1eCj6RTaEHE9h6fruQ9EoxjHV7kl+ENtNPpL4zUCTxwiQgkeRDytH8z0G8Q==
+"@date-fns/docs@0.24.0":
+ version "0.24.0"
+ resolved "https://registry.yarnpkg.com/@date-fns/docs/-/docs-0.24.0.tgz#a69db423f5ffe78992cbbb2094c631da696c3cb0"
+ integrity sha512-/mI63fs/kVMThANrSSDiLsHi8polkI9Ase4S7rkMh5r77pxmhvhSoA78m7mLIRyst5u5dlP9052hKspSxtf92A==
dependencies:
firebase-admin "^11.4.1"
js-fns "^2.5.2"
From f8ac43760bd47e8723364bf9c5a9e51ccc3f0827 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Sat, 11 Mar 2023 09:52:31 +0800
Subject: [PATCH 20/36] Fix in page generic navigation
---
src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx | 2 --
src/utils/docs/index.ts | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
index bebf91a6..dabadd5f 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
@@ -45,8 +45,6 @@ export const TypeDocFunction: FunctionComponent = ({
[fn]
)
- console.log('+++++++++++++++++++++++', parentTypesMap)
-
return (
Date: Sat, 11 Mar 2023 09:52:37 +0800
Subject: [PATCH 21/36] I've had enough
---
package.json | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/package.json b/package.json
index 960c881a..e0252c15 100644
--- a/package.json
+++ b/package.json
@@ -83,20 +83,6 @@
"webpack-node-externals": "^3.0.0",
"yarn": "^1.22.10"
},
- "husky": {
- "hooks": {
- "pre-commit": "lint-staged"
- }
- },
- "lint-staged": {
- "*.{js,jsx,json,css,md}": [
- "yarn format"
- ],
- "*.{ts,tsx}": [
- "yarn format",
- "yarn lint"
- ]
- },
"prettier": {
"singleQuote": true,
"semi": false
From b896bab2d19bf8775baaf64eb114845e5751cdc6 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Sat, 11 Mar 2023 13:32:29 +0800
Subject: [PATCH 22/36] Improve function doc
- Add throws
- Extract description from examples
- Add description to singnatures
---
src/ui/components/DocExamples/index.tsx | 54 ++++++++++++++-----
src/ui/components/DocExamples/styles.css.ts | 4 ++
.../Doc/TypeDoc/Function/Signature/index.tsx | 16 +++++-
.../Doc/TypeDoc/Function/Signatures/index.tsx | 19 +++++--
.../Doc/TypeDoc/Function/Throws/index.tsx | 49 +++++++++++++++++
5 files changed, 122 insertions(+), 20 deletions(-)
create mode 100644 src/ui/screens/Docs/Doc/TypeDoc/Function/Throws/index.tsx
diff --git a/src/ui/components/DocExamples/index.tsx b/src/ui/components/DocExamples/index.tsx
index b7d382b1..34993d3c 100644
--- a/src/ui/components/DocExamples/index.tsx
+++ b/src/ui/components/DocExamples/index.tsx
@@ -1,12 +1,12 @@
-import isArray from 'lodash/isArray'
import { Fragment, FunctionComponent, h } from 'preact'
+import { useMemo } from 'preact/hooks'
import { Code } from '~/ui/components/Code'
import { Markdown } from '~/ui/components/Markdown'
import { SectionHeader } from '../SectionHeader'
import * as styles from './styles.css'
interface Props {
- examples: string[] | string
+ examples: string[]
scope?: string
header?: 'h2' | 'h3'
}
@@ -15,18 +15,44 @@ export const DocExamples: FunctionComponent = ({
examples,
scope,
header,
-}) => (
-
-
+}) => {
+ const richExamples = useMemo(() => enrichExamples(examples), [examples])
- {isArray(examples) ? (
- examples.map((example, index) => (
+ return (
+
+
+
+ {richExamples.map((example, index) => (
-
+ {example.description && (
+
+
+
+ )}
+
+
- ))
- ) : (
-
- )}
-
-)
+ ))}
+
+ )
+}
+
+interface Example {
+ description?: string
+ code: string
+}
+
+function enrichExamples(examples: string[]): Example[] {
+ return examples.map((example) => {
+ const captures = example.match(/^((?:\/\/.+\n)*)((?:.*\n?)*)/)
+ if (!captures) return { code: example }
+
+ return {
+ description: captures[1]
+ .split(/\n/)
+ .map((str) => str.replace(/^\/\/\s?/, '').trim())
+ .join(' '),
+ code: captures[2],
+ }
+ })
+}
diff --git a/src/ui/components/DocExamples/styles.css.ts b/src/ui/components/DocExamples/styles.css.ts
index 17ff6572..706b4e18 100644
--- a/src/ui/components/DocExamples/styles.css.ts
+++ b/src/ui/components/DocExamples/styles.css.ts
@@ -3,3 +3,7 @@ import { style } from '@vanilla-extract/css'
export const codeContainer = style({
marginBottom: '10px',
})
+
+export const description = style({
+ marginBottom: '10px',
+})
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx
index dcc033f1..5ffb3751 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx
@@ -1,11 +1,12 @@
-import { findSignatureReturns } from '@date-fns/docs/utils'
-import { h, FunctionComponent, Fragment } from 'preact'
+import { findSignatureReturns, findTags } from '@date-fns/docs/utils'
+import { Fragment, FunctionComponent, h } from 'preact'
import { useMemo } from 'preact/hooks'
import type { SignatureReflection, TypeParameterReflection } from 'typedoc'
import { IgnoreParentTypesSourceContext } from '~/ui/contexts/IgnoreParentTypesSource'
import { Arguments } from '../Arguments'
import { Generics } from '../Generics'
import { Returns } from '../Returns'
+import { Throws } from '../Throws'
import { Type } from '../Type'
interface SignatureProps {
@@ -20,6 +21,15 @@ export const Signature: FunctionComponent = ({
header,
}) => {
const returns = useMemo(() => findSignatureReturns(signature), [signature])
+ const throws = useMemo(
+ () =>
+ findTags(signature, '@throws').map((str) => {
+ const captures = str.match(/^(?:(\w+) - )?(.*)$/)
+ if (!captures) return { type: undefined, description: str }
+ return { type: captures[1], description: captures[2] || str }
+ }),
+ [signature]
+ )
// @ts-ignore: Typing is inproper in TypeDoc
const typeParameters = signature.typeParameter as
@@ -48,6 +58,8 @@ export const Signature: FunctionComponent = ({
/>
)}
+ {throws.length > 0 && }
+
{JSON.stringify(signature, null, 2)}
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/Signatures/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/Signatures/index.tsx
index 1606280d..fa92e6f3 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Function/Signatures/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/Signatures/index.tsx
@@ -2,6 +2,7 @@ import { Fragment, FunctionComponent, h } from 'preact'
import type { SignatureReflection } from 'typedoc'
import { DocHeaderAnchor } from '~/ui/components/DocHeaderAnchor'
import { Entities } from '~/ui/components/Entities'
+import { RichText } from '~/ui/components/RichText'
import { Signature } from '../Signature'
interface SignaturesProps {
@@ -17,10 +18,20 @@ export const Signatures: FunctionComponent = ({
return (
{!solo && (
-
- Signatures
-
-
+
+
+ Signatures
+
+
+
+
+
+ This function has multiple signatures, meaning it can be called
+ with a different set of arguments, and it might return different
+ types. Check out every signature to find which one you need.
+
+
+
)}
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/Throws/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/Throws/index.tsx
new file mode 100644
index 00000000..e38be920
--- /dev/null
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/Throws/index.tsx
@@ -0,0 +1,49 @@
+import { Fragment, FunctionComponent, h } from 'preact'
+import { InlineCode } from '~/ui/components/InlineCode'
+import { Markdown } from '~/ui/components/Markdown'
+import { SectionHeader } from '~/ui/components/SectionHeader'
+
+export interface TypeDocThrow {
+ type: string | undefined
+ description: string
+}
+
+export interface TypeDocThrowsProps {
+ throws: TypeDocThrow[]
+ scope?: string
+ header?: 'h2' | 'h3'
+}
+
+export const Throws: FunctionComponent = ({
+ throws,
+ scope,
+ header,
+}) => {
+ return (
+
+
+
+
+
+
+ Type
+ Description
+
+
+
+
+ {throws.map((throwData, index) => (
+
+
+ {throwData.type && {throwData.type} }
+
+
+
+
+
+ ))}
+
+
+
+ )
+}
From 14fce1977ebfb0ef5e1ba444fba77aa4ef5a9018 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Mon, 13 Mar 2023 09:15:38 +0800
Subject: [PATCH 23/36] Add CDN to usage
---
src/ui/components/DocUsage/Content.tsx | 21 -----
src/ui/components/DocUsage/index.tsx | 107 ++++++++++++++++++++---
src/ui/components/DocUsage/styles.css.ts | 7 ++
src/ui/hooks/useActiveItem/index.ts | 1 -
src/utils/docs/index.ts | 41 ++++++++-
5 files changed, 141 insertions(+), 36 deletions(-)
delete mode 100644 src/ui/components/DocUsage/Content.tsx
diff --git a/src/ui/components/DocUsage/Content.tsx b/src/ui/components/DocUsage/Content.tsx
deleted file mode 100644
index a398f349..00000000
--- a/src/ui/components/DocUsage/Content.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { h, FunctionComponent } from 'preact'
-import { Code } from '~/ui/components/Code'
-import { Markdown } from '~/ui/components/Markdown'
-
-interface Props {
- code: string
- text?: string
-}
-
-export const Content: FunctionComponent = ({ code, text }) => (
-
-
-
-
- {text && (
-
-
-
- )}
-
-)
diff --git a/src/ui/components/DocUsage/index.tsx b/src/ui/components/DocUsage/index.tsx
index 948c58fc..6888fcbe 100644
--- a/src/ui/components/DocUsage/index.tsx
+++ b/src/ui/components/DocUsage/index.tsx
@@ -1,17 +1,19 @@
-import { h, Fragment, FunctionComponent } from 'preact'
-import { useEffect, useState } from 'preact/hooks'
import type { DateFnsDocs } from '@date-fns/docs/types'
-import { Content } from './Content'
-import { DocHeaderAnchor } from '~/ui/components/DocHeaderAnchor'
-import * as styles from './styles.css'
import classNames from 'classnames'
+import { Fragment, FunctionComponent, h } from 'preact'
+import { useEffect, useState } from 'preact/hooks'
+import { Code } from '~/ui/components/Code'
+import { Markdown } from '~/ui/components/Markdown'
+import { Usage } from '~/utils/docs'
import { SectionHeader } from '../SectionHeader'
+import * as styles from './styles.css'
const LOCALSTORAGE_KEY = 'usageSource'
const DEFAULT_SOURCE = 'commonjs'
+const LS_SELECTED_OPTIONS_KEY = 'usageSelectedOptions'
interface Props {
- usage: DateFnsDocs.FnUsage
+ usage: Usage
usageTabs: string[]
scope?: string
header?: 'h2' | 'h3'
@@ -24,6 +26,19 @@ export const DocUsage: FunctionComponent = ({
header,
}) => {
const [source, setSource] = useState(DEFAULT_SOURCE)
+ const [selectedOptions, setSelectedOptionsState] = useState<
+ Record
+ >(getSelectedOptions())
+
+ function setSelectedOptions(newOptions: Record) {
+ setSelectedOptionsState(newOptions)
+ try {
+ window.localStorage.setItem(
+ LS_SELECTED_OPTIONS_KEY,
+ JSON.stringify(newOptions)
+ )
+ } catch (_e) {}
+ }
useEffect(() => {
const localStorageSource = window.localStorage.getItem(LOCALSTORAGE_KEY)
@@ -38,6 +53,18 @@ export const DocUsage: FunctionComponent = ({
const selectedTab = usageTabs.includes(source) ? source : usageTabs[0]
const selectedUsage = usage[selectedTab]
+ useEffect(() => {
+ if (!('options' in selectedUsage)) return
+
+ if (!selectedOptions[selectedTab]) {
+ const firstOption = selectedUsage.options[0]
+ setSelectedOptions({
+ ...selectedOptions,
+ [selectedTab]: firstOption,
+ })
+ }
+ }, [selectedTab, selectedUsage])
+
return (
@@ -45,10 +72,7 @@ export const DocUsage: FunctionComponent = ({
{usageTabs.map((usageTab) => {
const usageItem = usage[usageTab]
-
- if (!usageItem) {
- return null
- }
+ if (!usageItem) return null
return (
@@ -67,13 +91,74 @@ export const DocUsage: FunctionComponent = ({
}}
>
{usageItem.title}
+
+ {'options' in usageItem && (
+ {
+ setSelectedOptions({
+ ...selectedOptions,
+ [usageTab]: (e.target as HTMLInputElement).value,
+ })
+ }}
+ value={
+ selectedOptions[usageTab] ||
+ Object.values(usageItem.options)[0]
+ }
+ >
+ {Object.entries(usageItem.options).map(([title, value]) => (
+
+ {title}
+
+ ))}
+
+ )}
)
})}
-
+
)
}
+
+function getSelectedOptions() {
+ try {
+ return JSON.parse(
+ window.localStorage.getItem(LS_SELECTED_OPTIONS_KEY) || '{}'
+ )
+ } catch (_e) {
+ return {}
+ }
+}
+
+interface ContentProps {
+ code: string
+ text?: string
+}
+
+export const Content: FunctionComponent = ({ code, text }) => (
+
+
+
+
+
+ {text && (
+
+
+
+ )}
+
+)
diff --git a/src/ui/components/DocUsage/styles.css.ts b/src/ui/components/DocUsage/styles.css.ts
index e8702555..63ec308a 100644
--- a/src/ui/components/DocUsage/styles.css.ts
+++ b/src/ui/components/DocUsage/styles.css.ts
@@ -27,3 +27,10 @@ export const options = style({
justifyContent: 'left',
margin: '0 !important',
})
+
+export const optionSelect = style({
+ borderColor: '#5844521a',
+ backgroundColor: 'transparent',
+ marginLeft: '0.25rem',
+ color: '#5d3861',
+})
diff --git a/src/ui/hooks/useActiveItem/index.ts b/src/ui/hooks/useActiveItem/index.ts
index 6d033738..e3e0755e 100644
--- a/src/ui/hooks/useActiveItem/index.ts
+++ b/src/ui/hooks/useActiveItem/index.ts
@@ -11,7 +11,6 @@ export function useActiveItem(
const activeRef = useRef(null)
useEffect(() => {
- console.log('item', activeRef.current)
scrollIntoViewIfNeeded(activeRef.current, options)
}, [id])
diff --git a/src/utils/docs/index.ts b/src/utils/docs/index.ts
index 7d322278..2e5bf318 100644
--- a/src/utils/docs/index.ts
+++ b/src/utils/docs/index.ts
@@ -7,8 +7,31 @@ import type {
export type ParentTypesMap = Record
-export function generateUsage(name: string, module = name) {
- const usage = {
+export interface Usage {
+ [usageTab: string]: UsageTab | UsageTabWithOptions
+}
+
+export interface UsageBase {
+ title: string
+ text?: string
+}
+
+export interface UsageTab extends UsageBase {
+ code: string
+}
+
+export interface UsageTabWithOptions extends UsageBase {
+ code: (option: string) => string
+ options: Record
+}
+
+export interface UsageMap {
+ usage: Usage
+ usageTabs: string[]
+}
+
+export function generateUsage(name: string, module = name): UsageMap {
+ const usage: Usage = {
esm: {
code: `import { ${name} } from "date-fns";`,
title: 'ESM',
@@ -18,9 +41,21 @@ export function generateUsage(name: string, module = name) {
code: `const ${name} = require("date-fns/${module}");`,
title: 'CommonJS',
},
+
+ cdn: {
+ title: 'CDN',
+ code: (cdn) => `import ${name} from "${cdn}/date-fns/${name}.mjs";`,
+ options: {
+ unpkg: 'https://unpkg.com',
+ Skypack: 'https://cdn.skypack.dev',
+ 'esm.sh': 'https://esm.sh',
+ JSPM: 'https://jspm.io',
+ jsDelivr: 'https://cdn.jsdelivr.net/npm',
+ },
+ },
}
- const usageTabs = ['esm', 'commonjs']
+ const usageTabs = ['esm', 'commonjs', 'cdn']
return { usage, usageTabs }
}
From 709b2301df59fe8316ebbf45adfe61fc5e8b9fa3 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Sun, 19 Mar 2023 14:45:05 +0800
Subject: [PATCH 24/36] Fix scroll in docs lists
---
src/ui/components/Item/index.tsx | 5 +-
src/ui/hooks/useActiveItem/index.ts | 29 +++++-----
.../screens/Docs/Doc/TypeDoc/Types/index.tsx | 2 +-
src/ui/screens/Docs/Finder/Categories.tsx | 5 +-
src/ui/screens/Docs/Finder/Items.tsx | 11 ++--
src/ui/screens/Docs/Finder/index.tsx | 7 ++-
src/utils/dom/index.ts | 55 ++++++++-----------
7 files changed, 54 insertions(+), 60 deletions(-)
diff --git a/src/ui/components/Item/index.tsx b/src/ui/components/Item/index.tsx
index 986fb5e2..817eb816 100644
--- a/src/ui/components/Item/index.tsx
+++ b/src/ui/components/Item/index.tsx
@@ -1,6 +1,5 @@
import classNames from 'classnames'
import { Fragment, FunctionComponent, h } from 'preact'
-import { Ref } from 'preact/hooks'
import { highlightMarkdown } from '~/utils/docs'
import { HighlightQuery } from '../HighlightQuery'
import { Markdown } from '../Markdown'
@@ -13,7 +12,7 @@ interface Props {
active: boolean
code: boolean
query?: string
- activeRef?: Ref
+ activeRef?: (element: HTMLDivElement | null) => void
}
export const Item: FunctionComponent = ({
@@ -26,7 +25,7 @@ export const Item: FunctionComponent = ({
}) => (
diff --git a/src/ui/hooks/useActiveItem/index.ts b/src/ui/hooks/useActiveItem/index.ts
index e3e0755e..0940a493 100644
--- a/src/ui/hooks/useActiveItem/index.ts
+++ b/src/ui/hooks/useActiveItem/index.ts
@@ -1,18 +1,19 @@
-import { useEffect, useRef, useState } from 'preact/hooks'
-import {
- scrollIntoViewIfNeeded,
- ScrollIntoViewIfNeededOptions,
-} from '~/utils/dom'
+import { useCallback, useRef } from 'preact/hooks'
+import { scrollIntoViewIfNeeded } from '~/utils/dom'
-export function useActiveItem(
- id: unknown,
- options?: ScrollIntoViewIfNeededOptions
-) {
- const activeRef = useRef(null)
-
- useEffect(() => {
- scrollIntoViewIfNeeded(activeRef.current, options)
- }, [id])
+export function useActiveItem(marginTop?: number) {
+ const prevRef = useRef(null)
+ const activeRef = useCallback((element: HTMLDivElement | null) => {
+ const first = prevRef.current === null
+ prevRef.current = element
+ // Delay to let DOM update
+ setTimeout(() =>
+ scrollIntoViewIfNeeded(element, {
+ marginTop,
+ behavior: first ? 'auto' : 'smooth',
+ })
+ )
+ }, [])
return { activeRef }
}
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
index 989c222c..233d189a 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Types/index.tsx
@@ -88,7 +88,7 @@ export const useTypesModal = createModal(
[navItems, query]
)
- const { activeRef } = useActiveItem(type?.id)
+ const { activeRef } = useActiveItem()
return (
void
}
export const Categories: FunctionComponent = ({
@@ -21,6 +22,7 @@ export const Categories: FunctionComponent = ({
selectedPage,
onNavigate,
query,
+ activeRef,
}) => (
{categories.map((category) => {
@@ -42,6 +44,7 @@ export const Categories: FunctionComponent = ({
selectedPage={selectedPage}
onNavigate={onNavigate}
query={query}
+ activeRef={activeRef}
/>
diff --git a/src/ui/screens/Docs/Finder/Items.tsx b/src/ui/screens/Docs/Finder/Items.tsx
index 62af86ff..552b8ec8 100644
--- a/src/ui/screens/Docs/Finder/Items.tsx
+++ b/src/ui/screens/Docs/Finder/Items.tsx
@@ -1,10 +1,9 @@
-import { h, FunctionComponent, Fragment } from 'preact'
import type { DateFnsDocs } from '@date-fns/docs/types'
+import { Fragment, FunctionComponent, h } from 'preact'
+import { Item } from '~/ui/components/Item'
import { RouterLink } from '~/ui/router'
import { docLink } from '~/ui/router/docLink'
import * as styles from './styles.css'
-import { Item } from '~/ui/components/Item'
-import { useActiveItem } from '~/ui/hooks/useActiveItem'
interface Props {
pages: DateFnsDocs.PagePreview[]
@@ -13,6 +12,7 @@ interface Props {
selectedPage: string
onNavigate(): void
query: string
+ activeRef: (element: HTMLDivElement | null) => void
}
export const Items: FunctionComponent
= ({
@@ -22,11 +22,8 @@ export const Items: FunctionComponent = ({
selectedPage,
onNavigate,
query,
+ activeRef,
}) => {
- const { activeRef } = useActiveItem(selectedPage, {
- marginTop: 33,
- })
-
return (
<>
{pages.map((page) => (
diff --git a/src/ui/screens/Docs/Finder/index.tsx b/src/ui/screens/Docs/Finder/index.tsx
index 2a1a9c58..893ee28d 100644
--- a/src/ui/screens/Docs/Finder/index.tsx
+++ b/src/ui/screens/Docs/Finder/index.tsx
@@ -4,14 +4,14 @@ import { packageName } from '@date-fns/docs/consts'
import { db } from '@date-fns/docs/db'
import type { DateFnsDocs } from '@date-fns/docs/types'
import { useRead } from '@typesaurus/preact'
-import { useState } from 'preact/hooks'
import { Search } from '~/ui/components/Search'
+import { useActiveItem } from '~/ui/hooks/useActiveItem'
+import { useQuery } from '~/ui/hooks/useQuery'
import { Categories } from './Categories'
import { NoResults } from './NoResults'
import * as styles from './styles.css'
import { filterPages } from './utils'
import { Widget } from './Widget'
-import { useQuery } from '~/ui/hooks/useQuery'
interface FinderProps {
selectedVersion: string
@@ -35,6 +35,8 @@ export const Finder: FunctionComponent = ({
])
)
+ const { activeRef } = useActiveItem(33)
+
if (versions && versions.length >= 1) {
const { pages, categories } = versions[0].data
const filteredPages = filterPages(pages, query, selectedSubmodule)
@@ -55,6 +57,7 @@ export const Finder: FunctionComponent = ({
selectedPage={selectedPage}
onNavigate={onNavigate}
query={query}
+ activeRef={activeRef}
/>
)}
diff --git a/src/utils/dom/index.ts b/src/utils/dom/index.ts
index 965c52ec..3274018a 100644
--- a/src/utils/dom/index.ts
+++ b/src/utils/dom/index.ts
@@ -10,51 +10,42 @@ export function scrollIntoViewIfNeeded(
): void {
if (!element) return
- const rect = element.getBoundingClientRect()
- const scrollParent = findParentWithScroll(element)
- console.log({ scrollParent })
-
- if (!scrollParent) return
-
- const parentRect = scrollParent.getBoundingClientRect()
-
- const inViewport =
- rect.top >= parentRect.top + (marginTop || 0) + scrollParent.scrollTop &&
- rect.left >= parentRect.left &&
- rect.bottom <= parentRect.bottom + scrollParent.scrollTop &&
- rect.right <= parentRect.right
+ const parent = findParentWithScroll(element)
+ if (!parent) return
- console.log({
- rect,
- parentRect,
- marginTop,
- inViewport,
- scrollTop: scrollParent.scrollTop,
- })
-
- if (inViewport) return
+ const rect = element.getBoundingClientRect()
+ const parentRect = parent.getBoundingClientRect()
- scrollParent.scrollTo({
- top: rect.top - parentRect.top - (marginTop || 0),
- behavior,
- })
+ if (isRectInViewport({ rect, parentRect, marginTop })) return
- // element.scrollIntoView({ behavior })
+ const top = element.offsetTop - parent.offsetTop - (marginTop || 0)
+ parent.scrollTo({ top, behavior })
}
export function isInViewport(
element: HTMLElement,
marginTop?: number
): boolean {
- const rect = element.getBoundingClientRect()
- const scrollParent = findParentWithScroll(element)
+ const parent = findParentWithScroll(element)
+ if (!parent) return true
- if (!scrollParent) return true
+ const rect = element.getBoundingClientRect()
+ const parentRect = parent.getBoundingClientRect()
- const parentRect = scrollParent.getBoundingClientRect()
+ return isRectInViewport({ rect, parentRect, marginTop })
+}
- console.log({ rect, parentRect, marginTop })
+interface IsRectInViewportProps {
+ rect: DOMRect
+ parentRect: DOMRect
+ marginTop: number | undefined
+}
+function isRectInViewport({
+ rect,
+ parentRect,
+ marginTop,
+}: IsRectInViewportProps) {
return (
rect.top >= parentRect.top + (marginTop || 0) &&
rect.left >= parentRect.left &&
From 9508755243c154315a64a71a992c5916283637bd Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Sun, 19 Mar 2023 15:28:59 +0800
Subject: [PATCH 25/36] Fallback description to summary
---
src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
index dabadd5f..b367e3fc 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
@@ -3,11 +3,11 @@ import {
findFn,
findFnDescription,
findFnExamples,
- traverseType,
+ findSummary,
} from '@date-fns/docs/utils'
import { FunctionComponent, h } from 'preact'
import { useMemo } from 'preact/hooks'
-import type { DeclarationReflection, SignatureReflection } from 'typedoc'
+import type { DeclarationReflection } from 'typedoc'
import { DocDescription } from '~/ui/components/DocDescription'
import { DocExamples } from '~/ui/components/DocExamples'
import { DocHeader } from '~/ui/components/DocHeader'
@@ -18,7 +18,6 @@ import {
extractCodeFromTagString,
findSource,
generateUsage,
- inlineTypeHash,
pageTypeHash,
pageTypeId,
pageTypeIdHighlightMatch,
@@ -37,7 +36,10 @@ export const TypeDocFunction: FunctionComponent = ({
}) => {
const fn = useMemo(() => findFn(doc), [doc])
const parentTypesMap = useMemo(() => buildParentTypesMap(fn), [fn])
- const description = useMemo(() => fn && findFnDescription(fn), [fn])
+ const description = useMemo(
+ () => fn && (findFnDescription(fn) || findSummary(fn)),
+ [fn]
+ )
const { usage, usageTabs } = useMemo(() => generateUsage(doc.name), [doc])
const signatures = fn && fn.signatures
const examples = useMemo(
From f40917e0b414a4400cf9a01a614a46e1e03ad7a1 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Sun, 19 Mar 2023 15:38:36 +0800
Subject: [PATCH 26/36] Unique signature header links
---
.../Doc/TypeDoc/Function/Returns/index.tsx | 3 +++
.../Doc/TypeDoc/Function/Signature/index.tsx | 19 +++++++++++++++----
.../Doc/TypeDoc/Function/Signatures/index.tsx | 1 +
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/Returns/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/Returns/index.tsx
index 2a56ab97..799bde6e 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Function/Returns/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/Returns/index.tsx
@@ -7,12 +7,14 @@ interface Props {
type: SomeType | undefined
description: string
header: 'h2' | 'h3'
+ scope?: string | undefined
}
export const Returns: FunctionComponent = ({
type,
description,
header,
+ scope,
}) => {
return (
= ({
},
]}
header={header}
+ scope={scope}
/>
)
}
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx
index 5ffb3751..3e205e67 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/Signature/index.tsx
@@ -13,12 +13,14 @@ interface SignatureProps {
name: string
signature: SignatureReflection
header: 'h2' | 'h3'
+ index: number | undefined
}
export const Signature: FunctionComponent = ({
name,
signature,
header,
+ index,
}) => {
const returns = useMemo(() => findSignatureReturns(signature), [signature])
const throws = useMemo(
@@ -36,18 +38,24 @@ export const Signature: FunctionComponent = ({
| TypeParameterReflection[]
| undefined
+ const scope = index === undefined ? undefined : `${index + 1}`
+
return (
<>
-
+
{signature.typeParameter && (
-
+
)}
{signature.parameters && signature.parameters.length > 0 && (
-
+
)}
{signature.type && (
@@ -55,10 +63,13 @@ export const Signature: FunctionComponent = ({
description={returns || ''}
type={signature.type}
header={header}
+ scope={scope}
/>
)}
- {throws.length > 0 && }
+ {throws.length > 0 && (
+
+ )}
{JSON.stringify(signature, null, 2)}
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/Signatures/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/Signatures/index.tsx
index fa92e6f3..9ab62c63 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Function/Signatures/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/Signatures/index.tsx
@@ -40,6 +40,7 @@ export const Signatures: FunctionComponent = ({
name={name}
signature={signature}
header={solo ? 'h2' : 'h3'}
+ index={solo ? undefined : index}
/>
))}
From f7352c0ec5520b29dc7d3d2508e248358ccd1404 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Sun, 19 Mar 2023 19:00:11 +0800
Subject: [PATCH 27/36] Center layout
---
src/ui/screens/Docs/Doc/index.tsx | 24 ++------
src/ui/screens/Docs/Doc/styles.css.ts | 7 +--
src/ui/screens/Docs/Finder/styles.css.ts | 1 +
src/ui/screens/Docs/NavBar/index.tsx | 76 ++++++++++++------------
src/ui/screens/Docs/NavBar/styles.css.ts | 9 ++-
src/ui/screens/Docs/styles.css.ts | 32 +++++++---
6 files changed, 77 insertions(+), 72 deletions(-)
diff --git a/src/ui/screens/Docs/Doc/index.tsx b/src/ui/screens/Docs/Doc/index.tsx
index c8387f32..9706425b 100644
--- a/src/ui/screens/Docs/Doc/index.tsx
+++ b/src/ui/screens/Docs/Doc/index.tsx
@@ -53,34 +53,22 @@ export const Doc: FunctionComponent = ({
value={{ version: selectedVersion, submodule: selectedSubmodule }}
>
)
} else if (pages && pages.length === 0) {
return (
-
- This page is not available for this version or this submodule
-
+ This page is not available for this version or this submodule
)
} else if (loading) {
- return (
-
- )
+ return Loading...
} else {
// FIXME:
- return (
-
- )
+ return Error!
}
}
diff --git a/src/ui/screens/Docs/Doc/styles.css.ts b/src/ui/screens/Docs/Doc/styles.css.ts
index 7f2cff1d..e7ed6c84 100644
--- a/src/ui/screens/Docs/Doc/styles.css.ts
+++ b/src/ui/screens/Docs/Doc/styles.css.ts
@@ -4,11 +4,6 @@ export const wrapper = style({
padding: '30px',
color: '#4a3142',
backgroundColor: '#fffdf9',
- width: '100%',
+ maxWidth: '55rem',
minHeight: '100%',
})
-
-export const inner = style({
- maxWidth: '60rem',
- margin: '0 auto',
-})
diff --git a/src/ui/screens/Docs/Finder/styles.css.ts b/src/ui/screens/Docs/Finder/styles.css.ts
index 6c00f285..ac370022 100644
--- a/src/ui/screens/Docs/Finder/styles.css.ts
+++ b/src/ui/screens/Docs/Finder/styles.css.ts
@@ -30,6 +30,7 @@ export const container = style({
flexDirection: 'column',
alignItems: 'stretch',
borderRight: '1px solid #e6e0e6',
+ borderLeft: '1px solid #e6e0e6',
})
export const content = style({
diff --git a/src/ui/screens/Docs/NavBar/index.tsx b/src/ui/screens/Docs/NavBar/index.tsx
index daa3524a..9a6a32d1 100644
--- a/src/ui/screens/Docs/NavBar/index.tsx
+++ b/src/ui/screens/Docs/NavBar/index.tsx
@@ -31,50 +31,52 @@ export const NavBar: FunctionComponent = ({
return (
-
-
diff --git a/src/ui/screens/Docs/NavBar/styles.css.ts b/src/ui/screens/Docs/NavBar/styles.css.ts
index 03216364..f2e4886b 100644
--- a/src/ui/screens/Docs/NavBar/styles.css.ts
+++ b/src/ui/screens/Docs/NavBar/styles.css.ts
@@ -7,18 +7,23 @@ export const container = style({
backgroundImage: `url('${backgroundURL}'})`,
backgroundSize: 'cover',
backgroundPosition: 'top center',
- height: '100%',
width: '100%',
+ height: '2rem',
})
-export const inner = style({
+export const outer = style({
background: 'rgba(118,10,61,0.7)',
+})
+
+export const inner = style({
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
width: '100%',
height: '2rem',
padding: '0 1rem',
+ maxWidth: '80rem',
+ margin: '0 auto',
})
export const latestLink = style({
diff --git a/src/ui/screens/Docs/styles.css.ts b/src/ui/screens/Docs/styles.css.ts
index c4d67983..bdb1b98f 100644
--- a/src/ui/screens/Docs/styles.css.ts
+++ b/src/ui/screens/Docs/styles.css.ts
@@ -1,5 +1,12 @@
import { style } from '@vanilla-extract/css'
+export const screen = style({
+ height: '100%',
+ width: '100%',
+ overflowY: 'auto',
+ background: '#fffdf9',
+})
+
export const content = style({
flex: 'auto',
display: 'flex',
@@ -7,6 +14,9 @@ export const content = style({
alignItems: 'stretch',
minHeight: '0',
position: 'relative',
+ maxWidth: '80rem',
+ margin: '0 auto',
+ width: '100%',
})
export const loading = style({
@@ -16,15 +26,9 @@ export const loading = style({
export const navBarContainer = style({
flex: 'none',
height: '2rem',
-})
-
-export const screen = style({
- display: 'flex',
- height: '100%',
- width: '100%',
- flexDirection: 'column',
- alignItems: 'stretch',
- overflow: 'hidden',
+ position: 'sticky',
+ top: 0,
+ zIndex: 1,
})
export const docContainer = style({
@@ -32,6 +36,7 @@ export const docContainer = style({
minHeight: '100%',
flex: 'auto',
overflowY: 'auto',
+ marginLeft: '25rem',
':after': {
display: 'none',
@@ -44,6 +49,12 @@ export const docContainer = style({
top: '0',
position: 'absolute',
},
+
+ '@media': {
+ 'screen and (max-width: 767px)': {
+ marginLeft: 0,
+ },
+ },
})
export const docContainerMenuOpen = style({
@@ -66,6 +77,9 @@ export const finderContainer = style({
flex: 'none',
width: '25rem',
maxWidth: '100%',
+ position: 'fixed',
+ bottom: 0,
+ top: '2rem',
'@media': {
'screen and (max-width: 767px)': {
From 19052f7d9e35511c7877289c681195f83b6722e8 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Tue, 21 Mar 2023 08:29:04 +0800
Subject: [PATCH 28/36] Dark mode foundation
---
src/ui/components/Code/index.tsx | 3 +-
src/ui/components/Code/styles.css.ts | 14 ++
src/ui/components/Code/theme.css | 169 ++++++++++++++++++
src/ui/components/DocUsage/styles.css.ts | 14 ++
src/ui/components/Home/styles.css.ts | 46 ++++-
src/ui/global.css | 13 ++
src/ui/screens/Home/Examples/styles.css.ts | 14 ++
src/ui/screens/Home/Features/features.tsx | 39 ++--
.../Home/Features/icons/ComingIcon.tsx | 13 ++
.../Home/Features/icons/ConsistentIcon.tsx | 21 +++
.../screens/Home/Features/icons/DocsIcon.tsx | 13 ++
src/ui/screens/Home/Features/icons/FPIcon.tsx | 27 +++
.../screens/Home/Features/icons/FastIcon.tsx | 14 ++
.../screens/Home/Features/icons/I18nIcon.tsx | 14 ++
.../Home/Features/icons/ImmutableIcon.tsx | 14 ++
.../Home/Features/icons/ModularIcon.tsx | 14 ++
.../Home/Features/icons/NativeIcon.tsx | 15 ++
.../Home/Features/icons/ReliableIcon.tsx | 14 ++
.../screens/Home/Features/icons/SafeIcon.tsx | 14 ++
.../Home/Features/icons/SimpleIcon.tsx | 14 ++
.../screens/Home/Features/icons/TypesIcon.tsx | 23 +++
src/ui/screens/Home/Features/img/coming.svg | 12 --
.../screens/Home/Features/img/consistent.svg | 14 --
src/ui/screens/Home/Features/img/docs.svg | 12 --
src/ui/screens/Home/Features/img/fast.svg | 10 --
src/ui/screens/Home/Features/img/fp.svg | 17 --
src/ui/screens/Home/Features/img/i18n.svg | 10 --
.../screens/Home/Features/img/immutable.svg | 10 --
src/ui/screens/Home/Features/img/modular.svg | 10 --
src/ui/screens/Home/Features/img/native.svg | 10 --
src/ui/screens/Home/Features/img/reliable.svg | 10 --
src/ui/screens/Home/Features/img/safe.svg | 10 --
src/ui/screens/Home/Features/img/simple.svg | 10 --
src/ui/screens/Home/Features/img/types.svg | 16 --
src/ui/screens/Home/Features/index.tsx | 3 +-
src/ui/screens/Home/Features/styles.css.ts | 65 ++++---
src/ui/screens/Home/Promo/styles.css.ts | 12 ++
.../screens/Home/Testimonials/styles.css.ts | 31 ++++
38 files changed, 582 insertions(+), 202 deletions(-)
create mode 100644 src/ui/components/Code/theme.css
create mode 100644 src/ui/screens/Home/Features/icons/ComingIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/ConsistentIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/DocsIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/FPIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/FastIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/I18nIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/ImmutableIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/ModularIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/NativeIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/ReliableIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/SafeIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/SimpleIcon.tsx
create mode 100644 src/ui/screens/Home/Features/icons/TypesIcon.tsx
delete mode 100644 src/ui/screens/Home/Features/img/coming.svg
delete mode 100644 src/ui/screens/Home/Features/img/consistent.svg
delete mode 100644 src/ui/screens/Home/Features/img/docs.svg
delete mode 100644 src/ui/screens/Home/Features/img/fast.svg
delete mode 100644 src/ui/screens/Home/Features/img/fp.svg
delete mode 100644 src/ui/screens/Home/Features/img/i18n.svg
delete mode 100644 src/ui/screens/Home/Features/img/immutable.svg
delete mode 100644 src/ui/screens/Home/Features/img/modular.svg
delete mode 100644 src/ui/screens/Home/Features/img/native.svg
delete mode 100644 src/ui/screens/Home/Features/img/reliable.svg
delete mode 100644 src/ui/screens/Home/Features/img/safe.svg
delete mode 100644 src/ui/screens/Home/Features/img/simple.svg
delete mode 100644 src/ui/screens/Home/Features/img/types.svg
diff --git a/src/ui/components/Code/index.tsx b/src/ui/components/Code/index.tsx
index cf37a230..4b60b99b 100644
--- a/src/ui/components/Code/index.tsx
+++ b/src/ui/components/Code/index.tsx
@@ -1,7 +1,6 @@
import { FunctionComponent, h } from 'preact'
import Prism from 'prismjs'
-import 'prismjs/themes/prism.css?global'
-import './global.css?global'
+import './theme.css?global'
import * as styles from './styles.css'
interface CodeProps {
diff --git a/src/ui/components/Code/styles.css.ts b/src/ui/components/Code/styles.css.ts
index 01068bb6..17c55959 100644
--- a/src/ui/components/Code/styles.css.ts
+++ b/src/ui/components/Code/styles.css.ts
@@ -13,6 +13,13 @@ export const code = style({
'::before': {
display: 'none',
},
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#c5c4c2',
+ backgroundColor: '#1e0814',
+ },
+ },
})
export const pre = style({
@@ -20,4 +27,11 @@ export const pre = style({
border: '1px solid #b9a2b2',
backgroundColor: '#fffffe',
padding: '.25rem .5rem',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#1e0814',
+ borderColor: '#361e2a',
+ },
+ },
})
diff --git a/src/ui/components/Code/theme.css b/src/ui/components/Code/theme.css
new file mode 100644
index 00000000..81839c2c
--- /dev/null
+++ b/src/ui/components/Code/theme.css
@@ -0,0 +1,169 @@
+/**
+ * Custom date-fns theme for Prism, based on the default Prism theme
+ * by Lea Verou (which was based on dabblet http://dabblet.com).
+ */
+
+code[class*='language-'],
+pre[class*='language-'] {
+ color: black;
+ background: none;
+ text-shadow: 0 1px white;
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
+ font-size: 1em;
+ text-align: left;
+ white-space: pre;
+ word-spacing: normal;
+ word-break: normal;
+ word-wrap: normal;
+ line-height: 1.5;
+
+ -moz-tab-size: 4;
+ -o-tab-size: 4;
+ tab-size: 4;
+
+ -webkit-hyphens: none;
+ -moz-hyphens: none;
+ -ms-hyphens: none;
+ hyphens: none;
+}
+
+pre[class*='language-']::-moz-selection,
+pre[class*='language-'] ::-moz-selection,
+code[class*='language-']::-moz-selection,
+code[class*='language-'] ::-moz-selection {
+ text-shadow: none;
+ background: #b3d4fc;
+}
+
+pre[class*='language-']::selection,
+pre[class*='language-'] ::selection,
+code[class*='language-']::selection,
+code[class*='language-'] ::selection {
+ text-shadow: none;
+ background: #b3d4fc;
+}
+
+@media print {
+ code[class*='language-'],
+ pre[class*='language-'] {
+ text-shadow: none;
+ }
+}
+
+/* Code blocks */
+pre[class*='language-'] {
+ padding: 1em;
+ margin: 0.5em 0;
+ overflow: auto;
+}
+
+:not(pre) > code[class*='language-'],
+pre[class*='language-'] {
+ background: #f5f2f0;
+}
+
+/* Inline code */
+:not(pre) > code[class*='language-'] {
+ padding: 0.1em;
+ border-radius: 0.3em;
+ white-space: normal;
+}
+
+.token.prolog,
+.token.doctype,
+.token.cdata {
+ color: slategray;
+}
+
+.token.comment {
+ color: #9e9a95;
+}
+
+.token.punctuation {
+ color: #999;
+}
+
+.token.namespace {
+ opacity: 0.7;
+}
+
+.token.number,
+.token.string,
+.token.property,
+.token.tag,
+.token.boolean,
+.token.constant,
+.token.symbol,
+.token.deleted {
+ color: #905;
+}
+
+.token.selector,
+.token.attr-name,
+.token.char,
+.token.builtin,
+.token.inserted {
+ color: #690;
+}
+
+.token.operator,
+.token.entity,
+.token.url,
+.language-css .token.string,
+.style .token.string {
+ color: #9a6e3a;
+}
+
+.token.atrule,
+.token.attr-value {
+ color: #07a;
+}
+
+.token.keyword {
+ color: #770c56;
+}
+
+.token.function,
+.token.class-name {
+ color: #8e3608;
+}
+
+.token.regex,
+.token.important,
+.token.variable {
+ color: #e90;
+}
+
+.token.important,
+.token.bold {
+ font-weight: bold;
+}
+.token.italic {
+ font-style: italic;
+}
+
+.token.entity {
+ cursor: help;
+}
+
+@media (prefers-color-scheme: dark) {
+ .token.keyword {
+ color: #e170be;
+ }
+
+ .token.number,
+ .token.string,
+ .token.property,
+ .token.tag,
+ .token.boolean,
+ .token.constant,
+ .token.symbol,
+ .token.deleted {
+ color: #cfc0c8;
+ }
+
+ .token.function,
+ .token.class-name {
+ color: #db8e66;
+ }
+}
diff --git a/src/ui/components/DocUsage/styles.css.ts b/src/ui/components/DocUsage/styles.css.ts
index 63ec308a..dd58efa3 100644
--- a/src/ui/components/DocUsage/styles.css.ts
+++ b/src/ui/components/DocUsage/styles.css.ts
@@ -14,11 +14,25 @@ export const optionLink = style({
borderTopRightRadius: '3px',
borderTopLeftRadius: '3px',
backgroundColor: '#faf6f0',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#4a2f3e',
+ color: '#c9bec5',
+ },
+ },
})
export const optionLinkIsCurrent = style({
color: '#000',
backgroundColor: '#e8d6e3',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#8c1b54',
+ color: '#fff',
+ },
+ },
})
export const options = style({
diff --git a/src/ui/components/Home/styles.css.ts b/src/ui/components/Home/styles.css.ts
index 87075ffc..f417856f 100644
--- a/src/ui/components/Home/styles.css.ts
+++ b/src/ui/components/Home/styles.css.ts
@@ -39,6 +39,24 @@ export const header = style({
color: '#770c56',
fontWeight: '600',
fontSize: '20px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#c79ab9',
+ },
+ },
+})
+
+export const subHeader = style({
+ color: '#770c56',
+ marginTop: '0.8rem',
+ fontSize: '1rem',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#c79ab9',
+ },
+ },
})
export const innerContainer = style({
@@ -52,18 +70,18 @@ export const innerContainer = style({
export const link = style({
color: '#862d5b',
textDecoration: 'none',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ffe7f7',
+ },
+ },
})
export const linkDecorated = style({
textDecoration: 'underline',
})
-export const subHeader = style({
- color: '#770c56',
- marginTop: '0.8rem',
- fontSize: '1rem',
-})
-
export const actions = style({
display: 'flex',
alignItems: 'center',
@@ -93,6 +111,22 @@ export const block = style({
backgroundColor: '#fffdfa',
},
},
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#31292d',
+
+ selectors: {
+ '&:nth-child(even)': {
+ backgroundColor: '#240e19',
+ },
+
+ '&:nth-child(odd)': {
+ backgroundColor: '#160e12',
+ },
+ },
+ },
+ },
})
export const content = style({
diff --git a/src/ui/global.css b/src/ui/global.css
index 57e993b1..1f851f41 100644
--- a/src/ui/global.css
+++ b/src/ui/global.css
@@ -48,4 +48,17 @@ code:after {
:root {
--color-tooltip-canvas: #280027;
--color-tooltip-ink: #fff5ff;
+ --icon-color: #770c5699;
+}
+
+@media (prefers-color-scheme: dark) {
+ :root {
+ color-scheme: dark;
+ --icon-color: #dfc2d6;
+ }
+
+ code {
+ background-color: #1e0814;
+ color: #c5c4c2;
+ }
}
diff --git a/src/ui/screens/Home/Examples/styles.css.ts b/src/ui/screens/Home/Examples/styles.css.ts
index 3fb2d114..2639804f 100644
--- a/src/ui/screens/Home/Examples/styles.css.ts
+++ b/src/ui/screens/Home/Examples/styles.css.ts
@@ -20,11 +20,25 @@ export const optionLink = style({
borderTopRightRadius: '3px',
borderTopLeftRadius: '3px',
backgroundColor: '#efe8df',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#4a2f3e',
+ color: '#c9bec5',
+ },
+ },
})
export const optionLinkIsCurrent = style({
color: 'white',
backgroundColor: '#770c56',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#8c1b54',
+ color: '#fff',
+ },
+ },
})
export const options = style({
diff --git a/src/ui/screens/Home/Features/features.tsx b/src/ui/screens/Home/Features/features.tsx
index f3f868f8..5d719705 100644
--- a/src/ui/screens/Home/Features/features.tsx
+++ b/src/ui/screens/Home/Features/features.tsx
@@ -1,10 +1,21 @@
import { h, Fragment, VNode } from 'preact'
-import { iconType } from './styles.css'
+import ComingIcon from './icons/ComingIcon'
+import ConsistentIcon from './icons/ConsistentIcon'
+import DocsIcon from './icons/DocsIcon'
+import FastIcon from './icons/FastIcon'
+import FPIcon from './icons/FPIcon'
+import I18nIcon from './icons/I18nIcon'
+import ImmutableIcon from './icons/ImmutableIcon'
+import ModularIcon from './icons/ModularIcon'
+import NativeIcon from './icons/NativeIcon'
+import ReliableIcon from './icons/ReliableIcon'
+import SimpleIcon from './icons/SimpleIcon'
+import TypesIcon from './icons/TypesIcon'
export interface Feature {
title: string
description: VNode
- icon: keyof typeof iconType
+ icon: VNode
}
export const features: Feature[] = [
@@ -24,7 +35,7 @@ export const features: Feature[] = [
>
),
- icon: 'modular',
+ icon: ,
},
{
@@ -42,7 +53,7 @@ export const features: Feature[] = [
>
),
- icon: 'native',
+ icon: ,
},
{
@@ -57,7 +68,7 @@ export const features: Feature[] = [
It helps to prevent bugs and avoid long debugging sessions.
>
),
- icon: 'immutable',
+ icon: ,
},
{
@@ -75,7 +86,7 @@ export const features: Feature[] = [
>
),
- icon: 'types',
+ icon: ,
},
{
@@ -87,7 +98,7 @@ export const features: Feature[] = [
bloat your build.
>
),
- icon: 'fp',
+ icon: ,
},
{
@@ -98,7 +109,7 @@ export const features: Feature[] = [
Only the ones that you use will be included in your project.
>
),
- icon: 'i18n',
+ icon: ,
},
{
@@ -115,7 +126,7 @@ export const features: Feature[] = [
>
),
- icon: 'consistent',
+ icon: ,
},
{
@@ -132,7 +143,7 @@ export const features: Feature[] = [
>
),
- icon: 'reliable',
+ icon: ,
},
{
@@ -150,7 +161,7 @@ export const features: Feature[] = [
>
),
- icon: 'simple',
+ icon: ,
},
{
@@ -161,7 +172,7 @@ export const features: Feature[] = [
users will have the best user experience.
>
),
- icon: 'fast',
+ icon: ,
},
{
@@ -173,7 +184,7 @@ export const features: Feature[] = [
thanks to JSDoc annotations.
>
),
- icon: 'docs',
+ icon: ,
},
{
@@ -184,6 +195,6 @@ export const features: Feature[] = [
features.
>
),
- icon: 'coming',
+ icon: ,
},
]
diff --git a/src/ui/screens/Home/Features/icons/ComingIcon.tsx b/src/ui/screens/Home/Features/icons/ComingIcon.tsx
new file mode 100644
index 00000000..ff5ad423
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/ComingIcon.tsx
@@ -0,0 +1,13 @@
+import { h } from 'preact'
+
+export default function ComingIcon() {
+ return (
+
+
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/ConsistentIcon.tsx b/src/ui/screens/Home/Features/icons/ConsistentIcon.tsx
new file mode 100644
index 00000000..30803953
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/ConsistentIcon.tsx
@@ -0,0 +1,21 @@
+import { h } from 'preact'
+
+export default function ConsistentIcon() {
+ return (
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/DocsIcon.tsx b/src/ui/screens/Home/Features/icons/DocsIcon.tsx
new file mode 100644
index 00000000..f1ccb96c
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/DocsIcon.tsx
@@ -0,0 +1,13 @@
+import { h } from 'preact'
+
+export default function DocsIcon() {
+ return (
+
+
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/FPIcon.tsx b/src/ui/screens/Home/Features/icons/FPIcon.tsx
new file mode 100644
index 00000000..0b459df5
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/FPIcon.tsx
@@ -0,0 +1,27 @@
+import { h } from 'preact'
+
+export default function FPIcon() {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/FastIcon.tsx b/src/ui/screens/Home/Features/icons/FastIcon.tsx
new file mode 100644
index 00000000..e2e79ac1
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/FastIcon.tsx
@@ -0,0 +1,14 @@
+import { h } from 'preact'
+
+export default function FastIcon() {
+ return (
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/I18nIcon.tsx b/src/ui/screens/Home/Features/icons/I18nIcon.tsx
new file mode 100644
index 00000000..c6036cba
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/I18nIcon.tsx
@@ -0,0 +1,14 @@
+import { h } from 'preact'
+
+export default function I18nIcon() {
+ return (
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/ImmutableIcon.tsx b/src/ui/screens/Home/Features/icons/ImmutableIcon.tsx
new file mode 100644
index 00000000..26c3925a
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/ImmutableIcon.tsx
@@ -0,0 +1,14 @@
+import { h } from 'preact'
+
+export default function ImmutableIcon() {
+ return (
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/ModularIcon.tsx b/src/ui/screens/Home/Features/icons/ModularIcon.tsx
new file mode 100644
index 00000000..55a46df2
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/ModularIcon.tsx
@@ -0,0 +1,14 @@
+import { h } from 'preact'
+
+export default function ModularIcon() {
+ return (
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/NativeIcon.tsx b/src/ui/screens/Home/Features/icons/NativeIcon.tsx
new file mode 100644
index 00000000..d3851859
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/NativeIcon.tsx
@@ -0,0 +1,15 @@
+import { h } from 'preact'
+
+export default function NativeIcon() {
+ return (
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/ReliableIcon.tsx b/src/ui/screens/Home/Features/icons/ReliableIcon.tsx
new file mode 100644
index 00000000..e00cc471
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/ReliableIcon.tsx
@@ -0,0 +1,14 @@
+import { h } from 'preact'
+
+export default function ReliableIcon() {
+ return (
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/SafeIcon.tsx b/src/ui/screens/Home/Features/icons/SafeIcon.tsx
new file mode 100644
index 00000000..43b2f0d8
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/SafeIcon.tsx
@@ -0,0 +1,14 @@
+import { h } from 'preact'
+
+export default function SafeIcon() {
+ return (
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/SimpleIcon.tsx b/src/ui/screens/Home/Features/icons/SimpleIcon.tsx
new file mode 100644
index 00000000..60303b6c
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/SimpleIcon.tsx
@@ -0,0 +1,14 @@
+import { h } from 'preact'
+
+export default function SimpleIcon() {
+ return (
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/icons/TypesIcon.tsx b/src/ui/screens/Home/Features/icons/TypesIcon.tsx
new file mode 100644
index 00000000..e08abcd1
--- /dev/null
+++ b/src/ui/screens/Home/Features/icons/TypesIcon.tsx
@@ -0,0 +1,23 @@
+import { h } from 'preact'
+
+export default function TypesIcon() {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/src/ui/screens/Home/Features/img/coming.svg b/src/ui/screens/Home/Features/img/coming.svg
deleted file mode 100644
index 3f19dfd5..00000000
--- a/src/ui/screens/Home/Features/img/coming.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- Group 7
- Created with Sketch.
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/consistent.svg b/src/ui/screens/Home/Features/img/consistent.svg
deleted file mode 100644
index 23acd204..00000000
--- a/src/ui/screens/Home/Features/img/consistent.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- Untitled 5
- Created with Sketch.
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/docs.svg b/src/ui/screens/Home/Features/img/docs.svg
deleted file mode 100644
index 00f5c3a2..00000000
--- a/src/ui/screens/Home/Features/img/docs.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- noun_1121101
- Created with Sketch.
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/fast.svg b/src/ui/screens/Home/Features/img/fast.svg
deleted file mode 100644
index 233413f0..00000000
--- a/src/ui/screens/Home/Features/img/fast.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Untitled 15
- Created with Sketch.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/fp.svg b/src/ui/screens/Home/Features/img/fp.svg
deleted file mode 100644
index 54666973..00000000
--- a/src/ui/screens/Home/Features/img/fp.svg
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- Group 4
- Created with Sketch.
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/i18n.svg b/src/ui/screens/Home/Features/img/i18n.svg
deleted file mode 100644
index d55f4152..00000000
--- a/src/ui/screens/Home/Features/img/i18n.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Ы
- Created with Sketch.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/immutable.svg b/src/ui/screens/Home/Features/img/immutable.svg
deleted file mode 100644
index 71c9c12f..00000000
--- a/src/ui/screens/Home/Features/img/immutable.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Untitled 17
- Created with Sketch.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/modular.svg b/src/ui/screens/Home/Features/img/modular.svg
deleted file mode 100644
index 8527ff2e..00000000
--- a/src/ui/screens/Home/Features/img/modular.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Untitled 16
- Created with Sketch.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/native.svg b/src/ui/screens/Home/Features/img/native.svg
deleted file mode 100644
index 54539f12..00000000
--- a/src/ui/screens/Home/Features/img/native.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Shape
- Created with Sketch.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/reliable.svg b/src/ui/screens/Home/Features/img/reliable.svg
deleted file mode 100644
index 8c9c9618..00000000
--- a/src/ui/screens/Home/Features/img/reliable.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Untitled 12
- Created with Sketch.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/safe.svg b/src/ui/screens/Home/Features/img/safe.svg
deleted file mode 100644
index 56020d61..00000000
--- a/src/ui/screens/Home/Features/img/safe.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Untitled 14
- Created with Sketch.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/simple.svg b/src/ui/screens/Home/Features/img/simple.svg
deleted file mode 100644
index 99545cc9..00000000
--- a/src/ui/screens/Home/Features/img/simple.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Untitled 12
- Created with Sketch.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/img/types.svg b/src/ui/screens/Home/Features/img/types.svg
deleted file mode 100644
index 6d4cac83..00000000
--- a/src/ui/screens/Home/Features/img/types.svg
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- Group 2
- Created with Sketch.
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/screens/Home/Features/index.tsx b/src/ui/screens/Home/Features/index.tsx
index 11d32f39..1e50a048 100644
--- a/src/ui/screens/Home/Features/index.tsx
+++ b/src/ui/screens/Home/Features/index.tsx
@@ -2,14 +2,13 @@ import { h } from 'preact'
import { HomeBlock } from '~/ui/components/Home'
import { features } from './features'
import * as styles from './styles.css'
-import classNames from 'classnames'
export const Features = () => (
{features.map((feature) => (
-
+ {feature.icon}
{feature.title}
{feature.description}
diff --git a/src/ui/screens/Home/Features/styles.css.ts b/src/ui/screens/Home/Features/styles.css.ts
index 5b20d81f..90bdf83b 100644
--- a/src/ui/screens/Home/Features/styles.css.ts
+++ b/src/ui/screens/Home/Features/styles.css.ts
@@ -1,17 +1,4 @@
import { style, globalStyle, styleVariants } from '@vanilla-extract/css'
-import comingURL from './img/coming.svg'
-import consistentURL from './img/consistent.svg'
-import docsURL from './img/docs.svg'
-import fastURL from './img/fast.svg'
-import fpURL from './img/fp.svg'
-import i18nURL from './img/i18n.svg'
-import immutableURL from './img/immutable.svg'
-import modularURL from './img/modular.svg'
-import nativeURL from './img/native.svg'
-import reliableURL from './img/reliable.svg'
-import safeURL from './img/safe.svg'
-import simpleURL from './img/simple.svg'
-import typesURL from './img/types.svg'
export const content = style({
marginLeft: '15px',
@@ -21,88 +8,100 @@ export const icon = style({
width: '38px',
height: '38px',
backgroundSize: '40px',
- border: '1px solid rgba(119,12,86,0.6)',
+ border: '1px solid var(--icon-color)',
borderRadius: '50%',
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center',
flexShrink: '0',
marginTop: '2px',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {},
+ },
+})
+
+globalStyle(`${icon} > svg`, {
+ height: '60%',
+ display: 'inline-block',
})
export const iconType = styleVariants({
coming: {
- backgroundImage: `url(${comingURL})`,
+ // backgroundImage: `url(${comingURL})`,
backgroundSize: '20px',
backgroundPosition: 'center 8px',
},
consistent: {
- backgroundImage: `url('${consistentURL}')`,
+ // backgroundImage: `url('${consistentURL}')`,
backgroundSize: '21px',
backgroundPosition: 'center 7px',
},
docs: {
- backgroundImage: `url('${docsURL}')`,
+ // backgroundImage: `url('${docsURL}')`,
backgroundSize: '19px',
backgroundPosition: 'center 7px',
},
fast: {
- backgroundImage: `url('${fastURL}')`,
+ // backgroundImage: `url('${fastURL}')`,
backgroundSize: '15px',
backgroundPosition: 'center 8px',
},
fp: {
- backgroundImage: `url('${fpURL}')`,
+ // backgroundImage: `url('${fpURL}')`,
backgroundSize: '16px',
backgroundPosition: 'center 8px',
},
i18n: {
- backgroundImage: `url('${i18nURL}')`,
+ // backgroundImage: `url('${i18nURL}')`,
backgroundSize: '16px',
backgroundPosition: 'center 9px',
},
immutable: {
- backgroundImage: `url('${immutableURL}')`,
+ // backgroundImage: `url('${immutableURL}')`,
backgroundSize: '17px',
backgroundPosition: 'center 6px',
},
modular: {
- backgroundImage: `url('${modularURL}')`,
+ // backgroundImage: `url('${modularURL}')`,
backgroundSize: '17px',
backgroundPosition: 'center 6px',
},
native: {
- backgroundImage: `url('${nativeURL}')`,
+ // backgroundImage: `url('${nativeURL}')`,
backgroundSize: '24px',
backgroundPosition: 'center 6px',
},
reliable: {
- backgroundImage: `url('${reliableURL}')`,
+ // backgroundImage: `url('${reliableURL}')`,
backgroundSize: '21px',
backgroundPosition: 'center 6px',
},
safe: {
- backgroundImage: `url('${safeURL}')`,
+ // backgroundImage: `url('${safeURL}')`,
backgroundSize: '18px',
},
simple: {
- backgroundImage: `url('${simpleURL}')`,
+ // backgroundImage: `url('${simpleURL}')`,
backgroundSize: '20px',
backgroundPosition: 'center 8px',
},
types: {
- backgroundImage: `url('${typesURL}')`,
+ // backgroundImage: `url('${typesURL}')`,
backgroundSize: '20px',
backgroundPosition: 'center 8px',
},
@@ -114,6 +113,12 @@ export const list = style({
fontSize: '17px',
display: 'flex',
flexWrap: 'wrap',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ddd2d9',
+ },
+ },
})
export const title = style({
@@ -127,6 +132,12 @@ export const description = style({
fontWeight: '400',
fontSize: '16px',
lineHeight: '22px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#cbc0c7',
+ },
+ },
})
globalStyle(`${description} p`, {
diff --git a/src/ui/screens/Home/Promo/styles.css.ts b/src/ui/screens/Home/Promo/styles.css.ts
index f91d4e8c..1cc15f9a 100644
--- a/src/ui/screens/Home/Promo/styles.css.ts
+++ b/src/ui/screens/Home/Promo/styles.css.ts
@@ -9,6 +9,12 @@ export const outer = style({
backgroundSize: 'cover',
backgroundPosition: 'top center',
overflowY: 'auto',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderBottom: '1px solid #31292d',
+ },
+ },
})
export const inner = style({
@@ -18,6 +24,12 @@ export const inner = style({
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ background: 'linear-gradient(#34031bb3, #1e0b14)',
+ },
+ },
})
export const logo = style({
diff --git a/src/ui/screens/Home/Testimonials/styles.css.ts b/src/ui/screens/Home/Testimonials/styles.css.ts
index ff8aebaa..7554dbf0 100644
--- a/src/ui/screens/Home/Testimonials/styles.css.ts
+++ b/src/ui/screens/Home/Testimonials/styles.css.ts
@@ -11,6 +11,12 @@ export const avatarImage = style({
height: '60px',
borderRadius: '50%',
border: '1px solid #e4e4dd',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '1px solid #31292d',
+ },
+ },
})
export const list = style({
@@ -33,6 +39,13 @@ export const quote = style({
padding: '16px 15px 15px',
flexGrow: '1',
position: 'relative',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#31292d',
+ backgroundColor: '#14070e',
+ },
+ },
})
export const quoteTriangle = style({
@@ -44,6 +57,12 @@ export const quoteTriangle = style({
position: 'absolute',
top: '16px',
left: '-12px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderRightColor: '#31292d',
+ },
+ },
})
export const quoteTriangleInner = style({
@@ -55,6 +74,12 @@ export const quoteTriangleInner = style({
borderTop: '11px solid rgba(0,0,0,0)',
borderBottom: '11px solid rgba(0,0,0,0)',
borderRight: '11px solid #fff',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderRightColor: '#14070e',
+ },
+ },
})
export const text = style({
@@ -62,6 +87,12 @@ export const text = style({
fontWeight: '400',
fontSize: '16px',
lineHeight: '22px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#cbc0c7',
+ },
+ },
})
export const item = style({
From 1793bdb74ba06de0b42c34445a23bbed1e5d1174 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Sun, 26 Mar 2023 15:29:59 +0800
Subject: [PATCH 29/36] Full home page dark mode, docs
---
src/ui/components/Code/styles.css.ts | 7 ++--
src/ui/components/Home/styles.css.ts | 35 +++++++++++++++----
src/ui/components/Item/styles.css.ts | 33 +++++++++++++++++
src/ui/components/RichText/styles.css.ts | 24 +++++++++++++
src/ui/global.css | 2 +-
src/ui/screens/Docs/Doc/styles.css.ts | 8 +++++
src/ui/screens/Docs/Finder/styles.css.ts | 14 ++++++++
src/ui/screens/Docs/styles.css.ts | 8 ++++-
src/ui/screens/Home/Promo/styles.css.ts | 16 +++++++--
src/ui/screens/Home/Sponsorship/styles.css.ts | 7 ++++
.../screens/Home/Testimonials/styles.css.ts | 10 ++++--
11 files changed, 149 insertions(+), 15 deletions(-)
diff --git a/src/ui/components/Code/styles.css.ts b/src/ui/components/Code/styles.css.ts
index 17c55959..4ad7a67f 100644
--- a/src/ui/components/Code/styles.css.ts
+++ b/src/ui/components/Code/styles.css.ts
@@ -17,7 +17,7 @@ export const code = style({
'@media': {
'(prefers-color-scheme: dark)': {
color: '#c5c4c2',
- backgroundColor: '#1e0814',
+ backgroundColor: '#12000a',
},
},
})
@@ -27,11 +27,12 @@ export const pre = style({
border: '1px solid #b9a2b2',
backgroundColor: '#fffffe',
padding: '.25rem .5rem',
+ borderRadius: '4px',
'@media': {
'(prefers-color-scheme: dark)': {
- backgroundColor: '#1e0814',
- borderColor: '#361e2a',
+ backgroundColor: '#12000a',
+ borderColor: '#2c1622',
},
},
})
diff --git a/src/ui/components/Home/styles.css.ts b/src/ui/components/Home/styles.css.ts
index f417856f..e47750e7 100644
--- a/src/ui/components/Home/styles.css.ts
+++ b/src/ui/components/Home/styles.css.ts
@@ -3,6 +3,12 @@ import { style, globalStyle, styleVariants } from '@vanilla-extract/css'
export const action = style({
color: '#8c1b54',
marginTop: '20px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ff80c0',
+ },
+ },
})
export const buttonBase = style({
@@ -31,6 +37,13 @@ export const button = styleVariants({
background: 'transparent',
color: '#8c1b54',
border: '1px solid #8c1b54',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#bb8aa2',
+ borderColor: '#bb8aa2',
+ },
+ },
},
],
})
@@ -42,7 +55,7 @@ export const header = style({
'@media': {
'(prefers-color-scheme: dark)': {
- color: '#c79ab9',
+ color: '#ddd2d9',
},
},
})
@@ -54,7 +67,7 @@ export const subHeader = style({
'@media': {
'(prefers-color-scheme: dark)': {
- color: '#c79ab9',
+ color: '#fbd7a1',
},
},
})
@@ -73,7 +86,11 @@ export const link = style({
'@media': {
'(prefers-color-scheme: dark)': {
- color: '#ffe7f7',
+ color: '#e1a8c5',
+
+ ':hover': {
+ color: '#ff80c0',
+ },
},
},
})
@@ -114,15 +131,15 @@ export const block = style({
'@media': {
'(prefers-color-scheme: dark)': {
- borderColor: '#31292d',
+ borderColor: '#2c1622',
selectors: {
'&:nth-child(even)': {
- backgroundColor: '#240e19',
+ backgroundColor: '#1a030f',
},
'&:nth-child(odd)': {
- backgroundColor: '#160e12',
+ backgroundColor: '#12020a',
},
},
},
@@ -147,6 +164,12 @@ export const text = style({
textAlign: 'center',
color: '#4c193c',
maxWidth: '500px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#cbc0c7',
+ },
+ },
})
globalStyle(`${text} img`, {
diff --git a/src/ui/components/Item/styles.css.ts b/src/ui/components/Item/styles.css.ts
index bdf28c69..98d62a17 100644
--- a/src/ui/components/Item/styles.css.ts
+++ b/src/ui/components/Item/styles.css.ts
@@ -13,6 +13,17 @@ export const item = style({
':hover': {
background: '#fdf6f9',
},
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#120009',
+ borderColor: '#2c1622',
+
+ ':hover': {
+ background: '#3c001e',
+ },
+ },
+ },
})
export const icon = style({
@@ -30,6 +41,16 @@ export const active = style({
':hover': {
backgroundColor: '#fff0f3',
},
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#2c0016',
+
+ ':hover': {
+ backgroundColor: '#2c0016',
+ },
+ },
+ },
})
export const title = style({
@@ -37,6 +58,12 @@ export const title = style({
marginBottom: '0.4px',
wordBreak: 'break-all',
color: '#4c193c',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ddd2d9',
+ },
+ },
})
export const codeTitle = style({
@@ -52,4 +79,10 @@ export const summary = style({
WebkitLineClamp: 2,
overflow: 'hidden',
wordBreak: 'break-all',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#9d8995',
+ },
+ },
})
diff --git a/src/ui/components/RichText/styles.css.ts b/src/ui/components/RichText/styles.css.ts
index 470bf023..8413f58d 100644
--- a/src/ui/components/RichText/styles.css.ts
+++ b/src/ui/components/RichText/styles.css.ts
@@ -7,6 +7,12 @@ export const content = style({
globalStyle(`${content} a`, {
color: '#5d3861',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ff80c0',
+ },
+ },
})
globalStyle(`${content} h1`, {
@@ -15,6 +21,12 @@ globalStyle(`${content} h1`, {
marginBottom: '30px',
paddingBottom: '23px',
borderBottom: '1px solid rgba(88,68,82,0.1)',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#fff6fc',
+ },
+ },
})
globalStyle(`${content} h2`, {
@@ -24,6 +36,12 @@ globalStyle(`${content} h2`, {
paddingBottom: '10px',
marginTop: '30px',
borderBottom: '1px solid rgba(88,68,82,0.1)',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ddd2d9',
+ },
+ },
})
globalStyle(`${content} h3`, {
@@ -32,6 +50,12 @@ globalStyle(`${content} h3`, {
fontSize: '1.2rem',
marginBottom: '20px',
marginTop: '20px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ddd2d9',
+ },
+ },
})
globalStyle(`${content} ol`, {
diff --git a/src/ui/global.css b/src/ui/global.css
index 1f851f41..c7a4eadd 100644
--- a/src/ui/global.css
+++ b/src/ui/global.css
@@ -54,7 +54,7 @@ code:after {
@media (prefers-color-scheme: dark) {
:root {
color-scheme: dark;
- --icon-color: #dfc2d6;
+ --icon-color: #585056;
}
code {
diff --git a/src/ui/screens/Docs/Doc/styles.css.ts b/src/ui/screens/Docs/Doc/styles.css.ts
index e7ed6c84..967287f7 100644
--- a/src/ui/screens/Docs/Doc/styles.css.ts
+++ b/src/ui/screens/Docs/Doc/styles.css.ts
@@ -6,4 +6,12 @@ export const wrapper = style({
backgroundColor: '#fffdf9',
maxWidth: '55rem',
minHeight: '100%',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#1a030f',
+ color: '#cbc0c7',
+ borderRight: '1px solid #2c1622',
+ },
+ },
})
diff --git a/src/ui/screens/Docs/Finder/styles.css.ts b/src/ui/screens/Docs/Finder/styles.css.ts
index ac370022..c7a0b357 100644
--- a/src/ui/screens/Docs/Finder/styles.css.ts
+++ b/src/ui/screens/Docs/Finder/styles.css.ts
@@ -20,6 +20,14 @@ export const categoryHeader = style({
position: 'sticky',
top: '0',
backgroundColor: '#fffbf5',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#280215',
+ borderColor: '#2c1622',
+ color: '#ddd2d9',
+ },
+ },
})
export const container = style({
@@ -31,6 +39,12 @@ export const container = style({
alignItems: 'stretch',
borderRight: '1px solid #e6e0e6',
borderLeft: '1px solid #e6e0e6',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ },
+ },
})
export const content = style({
diff --git a/src/ui/screens/Docs/styles.css.ts b/src/ui/screens/Docs/styles.css.ts
index bdb1b98f..b41388b7 100644
--- a/src/ui/screens/Docs/styles.css.ts
+++ b/src/ui/screens/Docs/styles.css.ts
@@ -3,8 +3,14 @@ import { style } from '@vanilla-extract/css'
export const screen = style({
height: '100%',
width: '100%',
- overflowY: 'auto',
+ overflowY: 'scroll',
background: '#fffdf9',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#12020a',
+ },
+ },
})
export const content = style({
diff --git a/src/ui/screens/Home/Promo/styles.css.ts b/src/ui/screens/Home/Promo/styles.css.ts
index 1cc15f9a..aa401cd9 100644
--- a/src/ui/screens/Home/Promo/styles.css.ts
+++ b/src/ui/screens/Home/Promo/styles.css.ts
@@ -12,7 +12,7 @@ export const outer = style({
'@media': {
'(prefers-color-scheme: dark)': {
- borderBottom: '1px solid #31292d',
+ borderBottom: '1px solid #2c1622',
},
},
})
@@ -27,7 +27,7 @@ export const inner = style({
'@media': {
'(prefers-color-scheme: dark)': {
- background: 'linear-gradient(#34031bb3, #1e0b14)',
+ background: 'linear-gradient(#2a0517d6, #12020a)',
},
},
})
@@ -56,6 +56,12 @@ export const header = style({
fontSize: '20px',
marginTop: '2rem',
fontWeight: 300,
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#fff6fc',
+ },
+ },
})
export const text = style({
@@ -66,6 +72,12 @@ export const text = style({
marginTop: '1rem',
color: '#ffe9c9',
maxWidth: '500px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#cbc0c7',
+ },
+ },
})
export const gettingStarted = style({
diff --git a/src/ui/screens/Home/Sponsorship/styles.css.ts b/src/ui/screens/Home/Sponsorship/styles.css.ts
index cbfda2cc..4e9399a9 100644
--- a/src/ui/screens/Home/Sponsorship/styles.css.ts
+++ b/src/ui/screens/Home/Sponsorship/styles.css.ts
@@ -19,6 +19,7 @@ export const itemImageContainer = style({
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
+ backgroundColor: 'white',
})
export const tier = styleVariants({
@@ -63,4 +64,10 @@ export const subheader = style({
textAlign: 'center',
color: '#4c193c',
marginBottom: '25px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ddd2d9',
+ },
+ },
})
diff --git a/src/ui/screens/Home/Testimonials/styles.css.ts b/src/ui/screens/Home/Testimonials/styles.css.ts
index 7554dbf0..83efbd0d 100644
--- a/src/ui/screens/Home/Testimonials/styles.css.ts
+++ b/src/ui/screens/Home/Testimonials/styles.css.ts
@@ -14,7 +14,7 @@ export const avatarImage = style({
'@media': {
'(prefers-color-scheme: dark)': {
- borderColor: '1px solid #31292d',
+ borderColor: '#2c1622',
},
},
})
@@ -30,6 +30,12 @@ export const name = style({
fontWeight: '600',
fontSize: '17px',
marginBottom: '5px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ddd2d9',
+ },
+ },
})
export const quote = style({
@@ -42,7 +48,7 @@ export const quote = style({
'@media': {
'(prefers-color-scheme: dark)': {
- borderColor: '#31292d',
+ borderColor: '#2c1622',
backgroundColor: '#14070e',
},
},
From 5db0e0c603a8f979f499886f0d9683c2ede25763 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Mon, 3 Apr 2023 17:18:12 +0800
Subject: [PATCH 30/36] More dark theme styles
---
src/ui/components/DocUsage/styles.css.ts | 6 ++++
src/ui/components/Entities/styles.css.ts | 6 ++++
src/ui/components/RichText/styles.css.ts | 32 +++++++++++++++++++
src/ui/components/Search/styles.css.ts | 15 ++++++++-
.../Docs/Doc/TypeDoc/Constants/styles.css.ts | 6 ++++
.../Docs/Doc/TypeDoc/Types/styles.css.ts | 12 +++++++
src/ui/screens/Docs/Finder/styles.css.ts | 1 +
src/ui/screens/Docs/styles.css.ts | 2 +-
8 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/src/ui/components/DocUsage/styles.css.ts b/src/ui/components/DocUsage/styles.css.ts
index dd58efa3..22234359 100644
--- a/src/ui/components/DocUsage/styles.css.ts
+++ b/src/ui/components/DocUsage/styles.css.ts
@@ -47,4 +47,10 @@ export const optionSelect = style({
backgroundColor: 'transparent',
marginLeft: '0.25rem',
color: '#5d3861',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ },
+ },
})
diff --git a/src/ui/components/Entities/styles.css.ts b/src/ui/components/Entities/styles.css.ts
index 94f58cc1..64189770 100644
--- a/src/ui/components/Entities/styles.css.ts
+++ b/src/ui/components/Entities/styles.css.ts
@@ -12,6 +12,12 @@ export const miltiEntity = style({
border: '1px solid #5844521a',
padding: '1rem',
background: '#fffefd',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ },
+ },
})
globalStyle(`${miltiEntity} > :first-child > :first-child`, {
diff --git a/src/ui/components/RichText/styles.css.ts b/src/ui/components/RichText/styles.css.ts
index 8413f58d..92a330cc 100644
--- a/src/ui/components/RichText/styles.css.ts
+++ b/src/ui/components/RichText/styles.css.ts
@@ -110,6 +110,12 @@ globalStyle(`${content} table`, {
backgroundColor: '#fffffe',
borderRadius: '2px',
marginBottom: '10px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#12000a',
+ },
+ },
})
globalStyle(`${content} table table`, {
@@ -119,17 +125,36 @@ globalStyle(`${content} table table`, {
globalStyle(`${content} table table td`, {
border: '1px solid #d6cdd3',
padding: '3px 6px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ },
+ },
})
globalStyle(`${content} table table th`, {
backgroundColor: '#fdfdfd',
border: '1px solid #d6cdd3',
padding: '3px 6px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ backgroundColor: '#280215',
+ },
+ },
})
globalStyle(`${content} table td`, {
border: '1px solid #b9a2b2',
padding: '5px 10px',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ },
+ },
})
globalStyle(`${content} table th`, {
@@ -138,6 +163,13 @@ globalStyle(`${content} table th`, {
fontWeight: '600',
textAlign: 'left',
backgroundColor: '#faf6f0',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ backgroundColor: '#280215',
+ },
+ },
})
globalStyle(`${content} table:last-child`, {
diff --git a/src/ui/components/Search/styles.css.ts b/src/ui/components/Search/styles.css.ts
index 1531077d..dc2aef21 100644
--- a/src/ui/components/Search/styles.css.ts
+++ b/src/ui/components/Search/styles.css.ts
@@ -10,9 +10,14 @@ export const search = style({
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
- backgroundColor: '#faf6f0',
borderBottom: '1px solid #e6e0e6',
wordBreak: 'break-all',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ },
+ },
})
export const bordered = style({
@@ -36,4 +41,12 @@ export const input = style({
border: '0',
width: '100%',
fontSize: '1rem',
+ backgroundColor: 'white',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ backgroundColor: '#120009',
+ color: 'white',
+ },
+ },
})
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Constants/styles.css.ts b/src/ui/screens/Docs/Doc/TypeDoc/Constants/styles.css.ts
index b7f586d8..37b17751 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Constants/styles.css.ts
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Constants/styles.css.ts
@@ -4,6 +4,12 @@ export const list = style({
marginTop: '1rem',
borderTop: '1px solid #5844521a',
paddingTop: '1rem',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ },
+ },
})
export const search = style({
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts b/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts
index 29c1100f..02f3dd80 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts
@@ -63,6 +63,12 @@ globalStyle(`${content} h3`, {
marginBottom: '1rem',
paddingBottom: '0.5rem',
borderBottom: '1px solid #5844521a',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ },
+ },
})
export const header = style({
@@ -73,6 +79,12 @@ export const header = style({
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ },
+ },
})
export const headerText = style({
diff --git a/src/ui/screens/Docs/Finder/styles.css.ts b/src/ui/screens/Docs/Finder/styles.css.ts
index c7a0b357..9dafa550 100644
--- a/src/ui/screens/Docs/Finder/styles.css.ts
+++ b/src/ui/screens/Docs/Finder/styles.css.ts
@@ -43,6 +43,7 @@ export const container = style({
'@media': {
'(prefers-color-scheme: dark)': {
borderColor: '#2c1622',
+ background: '#120009',
},
},
})
diff --git a/src/ui/screens/Docs/styles.css.ts b/src/ui/screens/Docs/styles.css.ts
index b41388b7..1391cab3 100644
--- a/src/ui/screens/Docs/styles.css.ts
+++ b/src/ui/screens/Docs/styles.css.ts
@@ -18,11 +18,11 @@ export const content = style({
display: 'flex',
flexDirection: 'row',
alignItems: 'stretch',
- minHeight: '0',
position: 'relative',
maxWidth: '80rem',
margin: '0 auto',
width: '100%',
+ minHeight: '100%',
})
export const loading = style({
From 4e601571a0f6c87891a7980b6c9a9d370aae434e Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Tue, 2 May 2023 09:28:02 +0700
Subject: [PATCH 31/36] Finish dark mode
---
src/ui/components/HireWidget/styles.css.ts | 12 ++++++
src/ui/components/Item/img/icon.svg | 13 ------
src/ui/components/Item/index.tsx | 19 +++++++-
src/ui/components/Item/styles.css.ts | 3 --
.../JobsSubscribeWidget/styles.css.ts | 43 +++++++++++++++++++
src/ui/components/JobsWidget/styles.css.ts | 12 ++++++
src/ui/global.css | 8 ++++
src/ui/screens/Docs/NavBar/styles.css.ts | 2 +-
8 files changed, 94 insertions(+), 18 deletions(-)
delete mode 100644 src/ui/components/Item/img/icon.svg
diff --git a/src/ui/components/HireWidget/styles.css.ts b/src/ui/components/HireWidget/styles.css.ts
index 674af0d5..b61e4403 100644
--- a/src/ui/components/HireWidget/styles.css.ts
+++ b/src/ui/components/HireWidget/styles.css.ts
@@ -3,6 +3,12 @@ import { style } from '@vanilla-extract/css'
export const container = style({
background: '#f5d958',
padding: '0.25rem',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ background: '#641d03',
+ },
+ },
})
export const block = style({
@@ -12,6 +18,12 @@ export const block = style({
flexDirection: 'column',
color: 'black',
transition: 'background 150ms ease-out',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ background: '#411302',
+ },
+ },
})
export const blockContent = style({
diff --git a/src/ui/components/Item/img/icon.svg b/src/ui/components/Item/img/icon.svg
deleted file mode 100644
index 9eb6ad5e..00000000
--- a/src/ui/components/Item/img/icon.svg
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- Untitled
- Created with Sketch.
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ui/components/Item/index.tsx b/src/ui/components/Item/index.tsx
index 817eb816..82ebbf7f 100644
--- a/src/ui/components/Item/index.tsx
+++ b/src/ui/components/Item/index.tsx
@@ -41,6 +41,23 @@ export const Item: FunctionComponent = ({
)}
-
+
)
+
+function Icon() {
+ return (
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/src/ui/components/Item/styles.css.ts b/src/ui/components/Item/styles.css.ts
index 98d62a17..1fffc354 100644
--- a/src/ui/components/Item/styles.css.ts
+++ b/src/ui/components/Item/styles.css.ts
@@ -1,5 +1,4 @@
import { style } from '@vanilla-extract/css'
-import iconURL from './img/icon.svg'
export const item = style({
display: 'flex',
@@ -27,8 +26,6 @@ export const item = style({
})
export const icon = style({
- backgroundImage: `url('${iconURL}')`,
- backgroundSize: '16px',
width: '16px',
height: '16px',
flexShrink: '0',
diff --git a/src/ui/components/JobsSubscribeWidget/styles.css.ts b/src/ui/components/JobsSubscribeWidget/styles.css.ts
index d29ffb94..cc191cfc 100644
--- a/src/ui/components/JobsSubscribeWidget/styles.css.ts
+++ b/src/ui/components/JobsSubscribeWidget/styles.css.ts
@@ -3,12 +3,24 @@ import { style } from '@vanilla-extract/css'
export const container = style({
background: '#f5d958',
padding: '0.25rem',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ background: '#641d03',
+ },
+ },
})
export const header = style({
fontSize: '1.05rem',
lineHeight: '1.4',
fontWeight: '600',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ded7a9',
+ },
+ },
})
export const block = style({
@@ -18,6 +30,12 @@ export const block = style({
flexDirection: 'column',
color: 'black',
transition: 'background 150ms ease-out',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ background: '#411302',
+ },
+ },
})
export const footer = style({
@@ -27,6 +45,12 @@ export const footer = style({
display: 'block',
padding: '0.5rem 0',
fontSize: '0.8rem',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#a8a493',
+ },
+ },
})
export const blockContent = style({
@@ -49,6 +73,14 @@ export const input = style({
color: 'black',
marginRight: '0.5rem',
border: '1px solid black',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#290d03',
+ background: '#290d03',
+ color: 'white',
+ },
+ },
})
export const subscribeButton = style({
@@ -66,6 +98,17 @@ export const subscribeButton = style({
':hover': {
color: 'red',
},
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#ded7a9',
+ background: '#925603',
+
+ ':hover': {
+ color: 'white',
+ },
+ },
+ },
})
export const twitterIcon = style({
diff --git a/src/ui/components/JobsWidget/styles.css.ts b/src/ui/components/JobsWidget/styles.css.ts
index 4c1b144c..73aa53f1 100644
--- a/src/ui/components/JobsWidget/styles.css.ts
+++ b/src/ui/components/JobsWidget/styles.css.ts
@@ -7,6 +7,12 @@ export const block = style({
flexDirection: 'column',
color: 'black',
transition: 'background 150ms ease-out',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ background: '#411302',
+ },
+ },
})
export const blockClickable = style({
@@ -30,6 +36,12 @@ export const companyName = style({
export const container = style({
background: '#f5d958',
padding: '0.25rem',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ background: '#641d03',
+ },
+ },
})
export const footer = style({
diff --git a/src/ui/global.css b/src/ui/global.css
index c7a4eadd..9831d1ab 100644
--- a/src/ui/global.css
+++ b/src/ui/global.css
@@ -61,4 +61,12 @@ code:after {
background-color: #1e0814;
color: #c5c4c2;
}
+
+ body,
+ input,
+ select,
+ textarea,
+ button {
+ color: white;
+ }
}
diff --git a/src/ui/screens/Docs/NavBar/styles.css.ts b/src/ui/screens/Docs/NavBar/styles.css.ts
index f2e4886b..b19b8c40 100644
--- a/src/ui/screens/Docs/NavBar/styles.css.ts
+++ b/src/ui/screens/Docs/NavBar/styles.css.ts
@@ -4,7 +4,7 @@ import backgroundURL from './img/navBarBackground.png'
export const container = style({
color: '#ffe9c9',
background: '#5a0530',
- backgroundImage: `url('${backgroundURL}'})`,
+ backgroundImage: `url('${backgroundURL}')`,
backgroundSize: 'cover',
backgroundPosition: 'top center',
width: '100%',
From 64047c099252369e539e207191e0efdf3dd29892 Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Mon, 26 Jun 2023 15:06:41 +0800
Subject: [PATCH 32/36] Improve the dark theme
---
src/ui/components/DocUsage/styles.css.ts | 1 +
src/ui/components/Entities/styles.css.ts | 1 +
src/ui/components/Home/styles.css.ts | 4 +-
src/ui/components/Item/styles.css.ts | 4 +-
src/ui/components/ModalPortal/styles.css.ts | 8 ++++
src/ui/components/RichText/styles.css.ts | 12 ++++-
.../Docs/Doc/TypeDoc/Types/styles.css.ts | 45 +++++++++++++++++++
7 files changed, 69 insertions(+), 6 deletions(-)
diff --git a/src/ui/components/DocUsage/styles.css.ts b/src/ui/components/DocUsage/styles.css.ts
index 22234359..ee4cd7c9 100644
--- a/src/ui/components/DocUsage/styles.css.ts
+++ b/src/ui/components/DocUsage/styles.css.ts
@@ -51,6 +51,7 @@ export const optionSelect = style({
'@media': {
'(prefers-color-scheme: dark)': {
borderColor: '#2c1622',
+ color: 'white',
},
},
})
diff --git a/src/ui/components/Entities/styles.css.ts b/src/ui/components/Entities/styles.css.ts
index 64189770..bcdc41d0 100644
--- a/src/ui/components/Entities/styles.css.ts
+++ b/src/ui/components/Entities/styles.css.ts
@@ -16,6 +16,7 @@ export const miltiEntity = style({
'@media': {
'(prefers-color-scheme: dark)': {
borderColor: '#2c1622',
+ background: '#12000a',
},
},
})
diff --git a/src/ui/components/Home/styles.css.ts b/src/ui/components/Home/styles.css.ts
index e47750e7..a6e4c14b 100644
--- a/src/ui/components/Home/styles.css.ts
+++ b/src/ui/components/Home/styles.css.ts
@@ -6,7 +6,7 @@ export const action = style({
'@media': {
'(prefers-color-scheme: dark)': {
- color: '#ff80c0',
+ color: '#d397b6',
},
},
})
@@ -89,7 +89,7 @@ export const link = style({
color: '#e1a8c5',
':hover': {
- color: '#ff80c0',
+ color: '#d397b6',
},
},
},
diff --git a/src/ui/components/Item/styles.css.ts b/src/ui/components/Item/styles.css.ts
index 1fffc354..5e7f4581 100644
--- a/src/ui/components/Item/styles.css.ts
+++ b/src/ui/components/Item/styles.css.ts
@@ -41,10 +41,10 @@ export const active = style({
'@media': {
'(prefers-color-scheme: dark)': {
- backgroundColor: '#2c0016',
+ backgroundColor: '#35021b',
':hover': {
- backgroundColor: '#2c0016',
+ backgroundColor: '#35021b',
},
},
},
diff --git a/src/ui/components/ModalPortal/styles.css.ts b/src/ui/components/ModalPortal/styles.css.ts
index e105e441..4602e7fe 100644
--- a/src/ui/components/ModalPortal/styles.css.ts
+++ b/src/ui/components/ModalPortal/styles.css.ts
@@ -35,6 +35,14 @@ export const windowBase = style({
width: '100%',
margin: '0 auto',
overflow: 'hidden',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ border: '1px solid #2c1622',
+ color: 'white',
+ background: '#1a030f',
+ },
+ },
})
export const window = styleVariants({
diff --git a/src/ui/components/RichText/styles.css.ts b/src/ui/components/RichText/styles.css.ts
index 92a330cc..2952d1ac 100644
--- a/src/ui/components/RichText/styles.css.ts
+++ b/src/ui/components/RichText/styles.css.ts
@@ -10,7 +10,7 @@ globalStyle(`${content} a`, {
'@media': {
'(prefers-color-scheme: dark)': {
- color: '#ff80c0',
+ color: '#d397b6',
},
},
})
@@ -206,8 +206,16 @@ globalStyle(`${content} ul:last-child`, {
globalStyle(`${content} blockquote`, {
marginBottom: '10px',
borderLeft: '3px solid #b9a2b2',
- background: '#faf6f0',
+ background: '#35001d',
padding: '0.5rem 1rem',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ background: '#12000a',
+ border: '1px solid #2c1622',
+ borderLeftWidth: '3px',
+ },
+ },
})
globalStyle(`${content} mark`, {
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts b/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts
index 02f3dd80..1833fe19 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Types/styles.css.ts
@@ -13,6 +13,14 @@ export const title = style({
fontSize: '1rem',
fontWeight: 600,
color: '#7b6d77',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ background: '#280215',
+ borderColor: '#2c1622',
+ color: '#cbc0c7',
+ },
+ },
})
export const titleIcon = style({
@@ -21,6 +29,12 @@ export const titleIcon = style({
position: 'relative',
top: '2px',
marginRight: '.25rem',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#c99952',
+ },
+ },
})
export const titleParent = style({
@@ -43,6 +57,12 @@ export const nav = style({
display: 'grid',
gridTemplateRows: 'auto 1fr',
overflow: 'hidden',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ },
+ },
})
export const list = style({
@@ -83,6 +103,7 @@ export const header = style({
'@media': {
'(prefers-color-scheme: dark)': {
borderColor: '#2c1622',
+ color: '#fff6fc',
},
},
})
@@ -109,6 +130,14 @@ export const badge = styleVariants({
color: '#146066',
borderColor: '#5ae6f1',
backgroundColor: '#d5fcff',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#00b3b3',
+ borderColor: '#4d6a6a',
+ backgroundColor: '#0f1a1a',
+ },
+ },
},
],
@@ -118,6 +147,14 @@ export const badge = styleVariants({
color: '#004813',
borderColor: '#9dbfa6',
backgroundColor: '#e2f7e8',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#00b300',
+ borderColor: '#4d6a4d',
+ backgroundColor: '#0f1a0f',
+ },
+ },
},
],
@@ -127,6 +164,14 @@ export const badge = styleVariants({
color: '#786c07',
borderColor: '#ddd491',
backgroundColor: '#fffad7',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#b3a900',
+ borderColor: '#4d4d33',
+ backgroundColor: '#1a1a00',
+ },
+ },
},
],
})
From 2d5146a469003eba8a5770c2d29d4049261e8c7b Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Mon, 10 Jul 2023 12:51:52 +0800
Subject: [PATCH 33/36] FP submodule section & dark theme
---
package.json | 2 +-
.../components/HighlightQuery/styles.css.ts | 1 +
.../Docs/Doc/TypeDoc/Function/FP/index.tsx | 52 +++++++++++++++++++
.../Doc/TypeDoc/Function/FP/styles.css.ts | 25 +++++++++
.../Docs/Doc/TypeDoc/Function/index.tsx | 9 ++++
.../screens/Docs/NavBar/SubmoduleSelector.tsx | 5 ++
src/utils/docs/index.ts | 12 +++++
yarn.lock | 8 +--
8 files changed, 109 insertions(+), 5 deletions(-)
create mode 100644 src/ui/screens/Docs/Doc/TypeDoc/Function/FP/index.tsx
create mode 100644 src/ui/screens/Docs/Doc/TypeDoc/Function/FP/styles.css.ts
diff --git a/package.json b/package.json
index e0252c15..d47f21cb 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"start": "env NODE_ENV=development ts-node -r tsconfig-paths/register devServer.ts"
},
"dependencies": {
- "@date-fns/docs": "0.24.0",
+ "@date-fns/docs": "^0.25.0",
"@sentry/browser": "^5.30.0",
"@sentry/tracing": "^5.30.0",
"@switcher/preact": "2.3.0",
diff --git a/src/ui/components/HighlightQuery/styles.css.ts b/src/ui/components/HighlightQuery/styles.css.ts
index aac21fb8..18a03ad9 100644
--- a/src/ui/components/HighlightQuery/styles.css.ts
+++ b/src/ui/components/HighlightQuery/styles.css.ts
@@ -2,4 +2,5 @@ import { style } from '@vanilla-extract/css'
export const highlight = style({
backgroundColor: '#fffe25',
+ color: 'black',
})
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/FP/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/FP/index.tsx
new file mode 100644
index 00000000..614480d7
--- /dev/null
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/FP/index.tsx
@@ -0,0 +1,52 @@
+import { Fragment, FunctionComponent, h } from 'preact'
+import { RouterLink } from '~/ui/router'
+import { docLink } from '~/ui/router/docLink'
+import { parseMajorVersion } from '~/utils/docs'
+import * as styles from './styles.css'
+
+interface Props {
+ name: string
+ pure: boolean | undefined
+ selectedVersion: string
+ hasOptions: boolean
+}
+
+export const FP: FunctionComponent = ({
+ name,
+ pure,
+ selectedVersion,
+ hasOptions,
+}) => {
+ const version = selectedVersion && parseMajorVersion(selectedVersion)
+ if (!version || version < 3) return null
+
+ return pure ? (
+
+ 🦄 The function is also available in the FP submodule as{' '}
+ {name}
+ {hasOptions && (
+
+ {' '}
+ and {name}WithOptions
+
+ )}
+ .{' '}
+
+ Read more about it in the FP guide
+
+ .
+
+ ) : (
+
+ ⚠️ Please note that this function is not present in the FP submodule as it
+ uses Date.now()
internally hence impure and can't be safely
+ curried.
+
+ )
+}
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/FP/styles.css.ts b/src/ui/screens/Docs/Doc/TypeDoc/Function/FP/styles.css.ts
new file mode 100644
index 00000000..da5153a5
--- /dev/null
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/FP/styles.css.ts
@@ -0,0 +1,25 @@
+import { globalStyle, style } from '@vanilla-extract/css'
+
+export const fpNote = style({
+ marginTop: '0.75rem',
+ fontSize: '14px',
+ color: '#7c6973',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ color: '#9b838f',
+ },
+ },
+})
+
+globalStyle(`${fpNote} code`, {
+ border: '1px solid #5844521a',
+ background: '#fffefd',
+
+ '@media': {
+ '(prefers-color-scheme: dark)': {
+ borderColor: '#2c1622',
+ background: '#12000a',
+ },
+ },
+})
diff --git a/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx b/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
index b367e3fc..87263ef8 100644
--- a/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
+++ b/src/ui/screens/Docs/Doc/TypeDoc/Function/index.tsx
@@ -17,6 +17,7 @@ import { InlineTypeContext } from '~/ui/contexts/InlineTypeContext'
import {
extractCodeFromTagString,
findSource,
+ fnHasOptions,
generateUsage,
pageTypeHash,
pageTypeId,
@@ -24,6 +25,7 @@ import {
ParentTypesMap,
} from '~/utils/docs'
import { Signatures } from './Signatures'
+import { FP } from './FP'
interface TypeDocFunctionProps {
page: DateFnsDocs.TypeDocPage
@@ -61,6 +63,13 @@ export const TypeDocFunction: FunctionComponent = ({
+
+
{signatures && }
{examples && }
diff --git a/src/ui/screens/Docs/NavBar/SubmoduleSelector.tsx b/src/ui/screens/Docs/NavBar/SubmoduleSelector.tsx
index 913620ba..e317aede 100644
--- a/src/ui/screens/Docs/NavBar/SubmoduleSelector.tsx
+++ b/src/ui/screens/Docs/NavBar/SubmoduleSelector.tsx
@@ -4,6 +4,7 @@ import { docLink } from '~/ui/router/docLink'
import { useContext } from 'preact/hooks'
import { RouterContext } from '~/ui/router'
import * as styles from './styles.css'
+import { parseMajorVersion } from '~/utils/docs'
const SUBMODULE_LABELS: Record = {
default: 'Default',
@@ -31,6 +32,10 @@ export const SubmoduleSelector: FunctionComponent = ({
return null
}
+ // For v3 don't show submodule selector and render FP section instead
+ const version = parseMajorVersion(selectedVersion)
+ if (version >= 3) return null
+
return (
Submodule:
diff --git a/src/utils/docs/index.ts b/src/utils/docs/index.ts
index 2e5bf318..37adf34f 100644
--- a/src/utils/docs/index.ts
+++ b/src/utils/docs/index.ts
@@ -176,3 +176,15 @@ export function inlineTypeIdHighlightMatch(id: string, hash: string) {
function rand() {
return btoa(Math.random().toString().slice(2, 5)).slice(0, 3)
}
+
+export function parseMajorVersion(version: string) {
+ const majorVersionStr = version.match(/v(\d+)/)?.[1]
+ const majorVersion = majorVersionStr && parseInt(majorVersionStr)
+ return majorVersion || 1
+}
+
+export function fnHasOptions(fn: DeclarationReflection | undefined) {
+ return !!fn?.signatures?.find((sig) =>
+ sig.parameters?.find((param) => param.name === 'options')
+ )
+}
diff --git a/yarn.lock b/yarn.lock
index 2f8fed30..b3cb09f3 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -251,10 +251,10 @@
dependencies:
"@jridgewell/trace-mapping" "0.3.9"
-"@date-fns/docs@0.24.0":
- version "0.24.0"
- resolved "https://registry.yarnpkg.com/@date-fns/docs/-/docs-0.24.0.tgz#a69db423f5ffe78992cbbb2094c631da696c3cb0"
- integrity sha512-/mI63fs/kVMThANrSSDiLsHi8polkI9Ase4S7rkMh5r77pxmhvhSoA78m7mLIRyst5u5dlP9052hKspSxtf92A==
+"@date-fns/docs@^0.25.0":
+ version "0.25.0"
+ resolved "https://registry.yarnpkg.com/@date-fns/docs/-/docs-0.25.0.tgz#aab430671215386bd1bdb490a7b34abe114a8b2d"
+ integrity sha512-Tu+7Bme1SnAvh2xK1kUPRWZcacw2ThZ0XoRTvx3mFU383U9fWis3wTF7ihl2bF7tfmsqjLnSXKzZDhlPr5afuw==
dependencies:
firebase-admin "^11.4.1"
js-fns "^2.5.2"
From 0b0f6f937b6c125ac28cc38f5a2f3223888726ee Mon Sep 17 00:00:00 2001
From: Sasha Koss
Date: Fri, 21 Jul 2023 19:39:32 +0800
Subject: [PATCH 34/36] Improve signatures & debug
---
src/ui/components/Debug/index.tsx | 14 +++++++++-----
src/ui/components/Entities/styles.css.ts | 2 +-
src/ui/components/RichText/styles.css.ts | 3 ++-
src/ui/components/TypeDocInterface/index.tsx | 9 ++++-----
.../TypeDocReflection/Object/index.tsx | 2 --
src/ui/components/TypeDocType/index.tsx | 7 ++-----
.../Docs/Doc/TypeDoc/Constants/index.tsx | 3 +--
.../Doc/TypeDoc/Function/Signature/index.tsx | 19 +++++++++++++++----
.../Docs/Doc/TypeDoc/Function/index.tsx | 11 +++++------
.../screens/Docs/Doc/TypeDoc/Types/index.tsx | 5 ++---
src/utils/docs/index.ts | 5 +++++
11 files changed, 46 insertions(+), 34 deletions(-)
diff --git a/src/ui/components/Debug/index.tsx b/src/ui/components/Debug/index.tsx
index c1909bd7..8033c2e3 100644
--- a/src/ui/components/Debug/index.tsx
+++ b/src/ui/components/Debug/index.tsx
@@ -1,12 +1,16 @@
import { Fragment, FunctionComponent, h } from 'preact'
import { Code } from '../Code'
+import { debugTypeDoc } from '~/utils/docs'
interface DebugProps {
data: unknown
}
-export const Debug: FunctionComponent = ({ data }) => (
-
-)
+export const Debug: FunctionComponent = ({ data }) => {
+ if (!debugTypeDoc) return null
+ return (
+
+ )
+}
diff --git a/src/ui/components/Entities/styles.css.ts b/src/ui/components/Entities/styles.css.ts
index bcdc41d0..a4489a0a 100644
--- a/src/ui/components/Entities/styles.css.ts
+++ b/src/ui/components/Entities/styles.css.ts
@@ -3,7 +3,7 @@ import { style, globalStyle } from '@vanilla-extract/css'
export const entity = style({
selectors: {
'&:not(:last-child)': {
- marginBottom: '1rem',
+ marginBottom: '2rem',
},
},
})
diff --git a/src/ui/components/RichText/styles.css.ts b/src/ui/components/RichText/styles.css.ts
index 2952d1ac..a9fe41eb 100644
--- a/src/ui/components/RichText/styles.css.ts
+++ b/src/ui/components/RichText/styles.css.ts
@@ -19,12 +19,13 @@ globalStyle(`${content} h1`, {
color: '#770c56',
fontSize: '2.3rem',
marginBottom: '30px',
- paddingBottom: '23px',
+ paddingBottom: '12px',
borderBottom: '1px solid rgba(88,68,82,0.1)',
'@media': {
'(prefers-color-scheme: dark)': {
color: '#fff6fc',
+ borderColor: '#2c1622',
},
},
})
diff --git a/src/ui/components/TypeDocInterface/index.tsx b/src/ui/components/TypeDocInterface/index.tsx
index 6c7966b8..d1332223 100644
--- a/src/ui/components/TypeDocInterface/index.tsx
+++ b/src/ui/components/TypeDocInterface/index.tsx
@@ -1,5 +1,5 @@
import { joinCommentParts } from '@date-fns/docs/utils'
-import { Fragment, FunctionComponent, h } from 'preact'
+import { Fragment, h } from 'preact'
import { useContext } from 'preact/hooks'
import type {
DeclarationReflection,
@@ -7,7 +7,8 @@ import type {
TypeParameterReflection,
} from 'typedoc'
import { InlineTypeContext } from '~/ui/contexts/InlineTypeContext'
-import { findSource, ParentTypesMap } from '~/utils/docs'
+import { findSource } from '~/utils/docs'
+import { Debug } from '../Debug'
import { IdHightlight } from '../IdHighlight'
import { InlineCode } from '../InlineCode'
import { Markdown } from '../Markdown'
@@ -71,9 +72,7 @@ export function TypeDocInterface<
)}
-
- {JSON.stringify(item, null, 2)}
-
+