@topwrite/reader 1.0.21 → 1.0.22-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{267-75e650.js → 267-58e681.js} +1 -1
- package/dist/{7-5728bc.js → 7-774184.js} +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/types/components/asset.d.ts +6 -0
- package/types/components/breadcrumb.d.ts +5 -0
- package/types/components/catalog.d.ts +22 -8
- package/types/components/html/attachment.d.ts +1 -1
- package/types/components/html/audio.d.ts +1 -1
- package/types/components/html/img.d.ts +1 -1
- package/types/components/html/video.d.ts +1 -1
- package/types/components/logo.d.ts +0 -1
- package/types/components/main.d.ts +1 -2
- package/types/components/page.d.ts +1 -0
- package/types/components/powered-by.d.ts +0 -1
- package/types/components/to-first-article.d.ts +2 -0
- package/types/index.d.ts +4 -2
- package/types/lib/history.d.ts +8 -1
- package/types/lib/use-article.d.ts +1 -0
- package/types/models/index.d.ts +0 -1
- package/types/models/page.d.ts +17 -5
- package/types/typings.d.ts +3 -9
- package/types/lib/use-lfs.d.ts +0 -1
- package/types/models/file.d.ts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topwrite/reader",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22-alpha.10+95bc5a4",
|
|
4
4
|
"author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"crypto-browserify": "^3.12.0",
|
|
35
35
|
"path-browserify": "^1.0.1",
|
|
36
36
|
"process": "^0.11.10",
|
|
37
|
+
"query-string": "^7.1.1",
|
|
37
38
|
"rimraf": "^3.0.2",
|
|
38
39
|
"stream-browserify": "^3.0.0",
|
|
39
40
|
"typescript": "^4.3.5",
|
|
@@ -52,5 +53,5 @@
|
|
|
52
53
|
"optional": true
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "95bc5a48adc8b85eddc8e122fc89c9e05d176555"
|
|
56
57
|
}
|
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { ComponentType, FC, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { SummaryArticle, SummaryPart } from '@topwrite/common';
|
|
3
3
|
interface ItemProps {
|
|
4
4
|
item: SummaryArticle;
|
|
5
5
|
active: boolean;
|
|
6
6
|
activeDescendant: boolean;
|
|
7
7
|
disabled: boolean;
|
|
8
|
-
children:
|
|
9
|
-
}
|
|
10
|
-
export interface CatalogProps {
|
|
11
|
-
renderPart: (props: PartProps) => ReactElement<any, any> | null;
|
|
12
|
-
renderItem: (props: ItemProps) => ReactElement<any, any> | null;
|
|
8
|
+
children: ReactNode;
|
|
13
9
|
}
|
|
14
10
|
interface PartProps {
|
|
15
11
|
part: SummaryPart;
|
|
16
|
-
children:
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
interface ItemsProps {
|
|
15
|
+
part?: SummaryPart;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
interface DeprecatedCatalogProps {
|
|
19
|
+
renderPart?: (props: PartProps) => ReactElement<any, any> | null;
|
|
20
|
+
renderItem?: (props: ItemProps) => ReactElement<any, any> | null;
|
|
21
|
+
}
|
|
22
|
+
export interface CatalogProps {
|
|
23
|
+
partComponent: ComponentType<PartProps>;
|
|
24
|
+
itemComponent: ComponentType<ItemProps>;
|
|
25
|
+
itemsComponent?: ComponentType<ItemsProps>;
|
|
17
26
|
}
|
|
18
|
-
export
|
|
27
|
+
export declare const CatalogItems: FC<{
|
|
28
|
+
items: SummaryArticle[];
|
|
29
|
+
part?: SummaryPart;
|
|
30
|
+
itemsComponent?: ComponentType<ItemsProps>;
|
|
31
|
+
} & Pick<CatalogProps, 'itemComponent'>>;
|
|
32
|
+
export default function Catalog({ ...props }: CatalogProps & DeprecatedCatalogProps): JSX.Element;
|
|
19
33
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AttachmentHTMLAttributes } from 'react';
|
|
2
|
-
export default function Attachment(
|
|
2
|
+
export default function Attachment(props: AttachmentHTMLAttributes<HTMLAttachmentElement>): JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AudioHTMLAttributes } from 'react';
|
|
2
|
-
export default function Audio(
|
|
2
|
+
export default function Audio(props: AudioHTMLAttributes<HTMLAudioElement>): JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ImgHTMLAttributes } from 'react';
|
|
2
|
-
export default function Img(
|
|
2
|
+
export default function Img(props: ImgHTMLAttributes<HTMLImageElement>): JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { VideoHTMLAttributes } from 'react';
|
|
2
|
-
export default function Video(
|
|
2
|
+
export default function Video(props: VideoHTMLAttributes<HTMLVideoElement>): JSX.Element;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function Main(): JSX.Element;
|
|
1
|
+
export default function Main(): JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Page(): JSX.Element;
|
package/types/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from '@topwrite/common';
|
|
|
4
4
|
export { default as bootstrap } from './lib/bootstrap';
|
|
5
5
|
export { history } from './lib/history';
|
|
6
6
|
export { default as useTitle } from './lib/use-title';
|
|
7
|
+
export { default as useFile } from './lib/use-file';
|
|
7
8
|
export { default as useArticle, usePrevArticle, useNextArticle } from './lib/use-article';
|
|
8
9
|
export { default as useWindowSize, windowSizes } from './lib/use-window-size';
|
|
9
10
|
export { default as useLockBodyScroll } from './lib/use-lock-body-scroll';
|
|
@@ -12,8 +13,9 @@ export { default as Logo } from './components/logo';
|
|
|
12
13
|
export { default as Link } from './components/link';
|
|
13
14
|
export { default as Anchor } from './components/anchor';
|
|
14
15
|
export { default as Article } from './components/article';
|
|
15
|
-
export { default as Catalog } from './components/catalog';
|
|
16
|
-
export type { CatalogProps } from './components/catalog';
|
|
16
|
+
export { default as Catalog, type CatalogProps, CatalogItems } from './components/catalog';
|
|
17
17
|
export { default as Markdown } from './components/markdown';
|
|
18
|
+
export { default as Breadcrumb } from './components/breadcrumb';
|
|
19
|
+
export { default as ToFirstArticle } from './components/to-first-article';
|
|
18
20
|
export { Helmet } from 'react-helmet-async';
|
|
19
21
|
export type { SearchHandler, SearchResult } from './models/search';
|
package/types/lib/history.d.ts
CHANGED
|
@@ -2,7 +2,14 @@ import { History as H, Listener, To } from 'history';
|
|
|
2
2
|
export declare class History {
|
|
3
3
|
history: H;
|
|
4
4
|
constructor();
|
|
5
|
-
get location():
|
|
5
|
+
get location(): {
|
|
6
|
+
toString(): string;
|
|
7
|
+
state: any;
|
|
8
|
+
key: string;
|
|
9
|
+
pathname: string;
|
|
10
|
+
search: string;
|
|
11
|
+
hash: string;
|
|
12
|
+
};
|
|
6
13
|
listen(listener: Listener): void;
|
|
7
14
|
replace(location: To): void;
|
|
8
15
|
push(location: To): void;
|
|
@@ -4,3 +4,4 @@ export declare const ArticleContext: import("react").Context<SummaryArticle | un
|
|
|
4
4
|
export default function useArticle(): SummaryArticle | undefined;
|
|
5
5
|
export declare function useNextArticle(): SummaryArticle | undefined;
|
|
6
6
|
export declare function usePrevArticle(): SummaryArticle | undefined;
|
|
7
|
+
export declare function usePart(article: SummaryArticle): void;
|
package/types/models/index.d.ts
CHANGED
package/types/models/page.d.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import { ActionsType, Model } from '@topwrite/common';
|
|
1
|
+
import { ActionsType, File, Model, RequestConfig, RequestInstance } from '@topwrite/common';
|
|
2
2
|
interface PageState {
|
|
3
3
|
loading: boolean;
|
|
4
4
|
error?: Error;
|
|
5
|
+
request: RequestInstance;
|
|
6
|
+
config: RequestConfig;
|
|
7
|
+
file?: File;
|
|
8
|
+
lfs?: {
|
|
9
|
+
url: string;
|
|
10
|
+
files: {
|
|
11
|
+
[index: string]: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
5
14
|
}
|
|
15
|
+
declare type Interceptors = RequestInstance['interceptors'];
|
|
6
16
|
declare class Page extends Model<PageState> {
|
|
7
17
|
initialState: {
|
|
8
18
|
loading: boolean;
|
|
19
|
+
request: import("axios").AxiosInstance;
|
|
20
|
+
config: {};
|
|
9
21
|
};
|
|
10
|
-
subscription({ fetch }: ActionsType<Page
|
|
11
|
-
fetch(pathname: string): AsyncGenerator<import("redux").AnyAction
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
subscription({ fetch }: ActionsType<Page>, state: any): void;
|
|
23
|
+
fetch(pathname: string): AsyncGenerator<import("redux").AnyAction, void, unknown>;
|
|
24
|
+
intercept(handler: (interceptors: Interceptors) => void): Generator<import("redux").AnyAction, void, unknown>;
|
|
25
|
+
updateConfig(updater: (config: RequestConfig) => void): Generator<import("redux").AnyAction, void, unknown>;
|
|
14
26
|
}
|
|
15
27
|
export declare const page: Page;
|
|
16
28
|
export {};
|
package/types/typings.d.ts
CHANGED
|
@@ -10,17 +10,11 @@ declare module '@topwrite/common' {
|
|
|
10
10
|
}
|
|
11
11
|
interface ComponentsMap {
|
|
12
12
|
app: ComponentDescriptorType;
|
|
13
|
-
'article:before': ComponentDescriptorType;
|
|
14
|
-
'article:after': ComponentDescriptorType;
|
|
13
|
+
'page:article:before': ComponentDescriptorType;
|
|
14
|
+
'page:article:after': ComponentDescriptorType;
|
|
15
|
+
'page:asset': ComponentDescriptorType;
|
|
15
16
|
}
|
|
16
17
|
interface OptionsStateType {
|
|
17
|
-
lfs?: {
|
|
18
|
-
url: string;
|
|
19
|
-
files: {
|
|
20
|
-
[index: string]: string;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
search: string;
|
|
24
18
|
}
|
|
25
19
|
}
|
|
26
20
|
export {};
|
package/types/lib/use-lfs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useLfs(src?: string): string | undefined;
|
package/types/models/file.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsType, Model, File as FileType } from '@topwrite/common';
|
|
2
|
-
declare class File extends Model<FileType> {
|
|
3
|
-
onAction(action: GeneratorFunction, type: string, { update }: ActionsType<File>): any;
|
|
4
|
-
update(article: FileType): Generator<import("redux").AnyAction, void, unknown>;
|
|
5
|
-
}
|
|
6
|
-
export declare const file: File;
|
|
7
|
-
export {};
|