@topwrite/reader 1.0.58-alpha.0 → 1.0.59-alpha.0

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.
Files changed (45) hide show
  1. package/dist/267-61a847.js +1 -0
  2. package/dist/273-ca3c65.js +2 -0
  3. package/dist/273-ca3c65.js.map +1 -0
  4. package/dist/613-c7697a.js +2 -0
  5. package/dist/613-c7697a.js.map +1 -0
  6. package/dist/613.css +1 -0
  7. package/dist/7-646b8c.js +1 -0
  8. package/dist/913-aa0313.js +56 -0
  9. package/dist/913-aa0313.js.map +1 -0
  10. package/dist/913.css +1 -0
  11. package/dist/index.js +8 -8
  12. package/dist/index.js.map +1 -1
  13. package/package.json +6 -4
  14. package/types/components/loading-bar/index.d.ts +2 -0
  15. package/types/components/loading-bar/loading-bar.d.ts +3 -0
  16. package/types/components/search/constants.d.ts +1 -0
  17. package/types/components/search/doc-search-button.d.ts +3 -0
  18. package/types/components/search/doc-search-modal.d.ts +6 -0
  19. package/types/components/search/doc-search.d.ts +8 -0
  20. package/types/components/search/footer.d.ts +2 -0
  21. package/types/components/search/hooks/use-keyboard-events.d.ts +9 -0
  22. package/types/components/search/hooks/use-trap-focus.d.ts +5 -0
  23. package/types/components/search/icons/content-icon.d.ts +2 -0
  24. package/types/components/search/icons/control-key-icon.d.ts +2 -0
  25. package/types/components/search/icons/error-icon.d.ts +2 -0
  26. package/types/components/search/icons/go-to-external-icon.d.ts +2 -0
  27. package/types/components/search/icons/index.d.ts +11 -0
  28. package/types/components/search/icons/loading-icon.d.ts +2 -0
  29. package/types/components/search/icons/no-results-icon.d.ts +2 -0
  30. package/types/components/search/icons/recent-icon.d.ts +2 -0
  31. package/types/components/search/icons/reset-icon.d.ts +2 -0
  32. package/types/components/search/icons/search-icon.d.ts +2 -0
  33. package/types/components/search/icons/select-icon.d.ts +2 -0
  34. package/types/components/search/icons/star-icon.d.ts +2 -0
  35. package/types/components/search/index.d.ts +3 -0
  36. package/types/components/search/results.d.ts +14 -0
  37. package/types/components/search/screen-state.d.ts +10 -0
  38. package/types/components/search/screens/error-screen.d.ts +2 -0
  39. package/types/components/search/screens/no-result-screen.d.ts +2 -0
  40. package/types/components/search/screens/results-screen.d.ts +11 -0
  41. package/types/components/search/screens/start-screen.d.ts +6 -0
  42. package/types/components/search/search-box.d.ts +11 -0
  43. package/types/index.d.ts +2 -0
  44. package/dist/267-b5c5b0.js +0 -1
  45. package/dist/7-7d6f45.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topwrite/reader",
3
- "version": "1.0.58-alpha.0+f0a33e7",
3
+ "version": "1.0.59-alpha.0+a24528b",
4
4
  "author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
5
5
  "license": "ISC",
6
6
  "types": "types/index.d.ts",
@@ -14,11 +14,11 @@
14
14
  "build": "webpack --progress",
15
15
  "build:dev": "npm run build --env dev",
16
16
  "serve": "webpack serve --env dev",
17
- "extract": "formatjs extract src/**/*.{ts,tsx} --out-file src/lang/zh-CN.json --ignore src/global.d.ts --id-interpolation-pattern [sha512:contenthash:base64:6] --format simple",
17
+ "extract": "formatjs extract src/**/*.{ts,tsx} --out-file src/lang/zh-CN.json --ignore src/global.d.ts --id-interpolation-pattern [sha512:contenthash:base64:6] --additional-function-names $t --format simple",
18
18
  "prepack": "npm run build"
19
19
  },
20
20
  "dependencies": {
21
- "@topwrite/common": "^1.0.49-alpha.4+f0a33e7",
21
+ "@topwrite/common": "^1.0.49",
22
22
  "@types/lodash": "^4.14.168",
23
23
  "@types/node": "^16.4.13",
24
24
  "@types/react": "^17.0.4",
@@ -28,6 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/runtime": "^7.11.2",
31
+ "@docsearch/css": "^3.2.1",
31
32
  "@formatjs/cli": "^5.0.2",
32
33
  "@topthink/webpack-config-plugin": "^1.0.11",
33
34
  "crypto-browserify": "^3.12.0",
@@ -35,6 +36,7 @@
35
36
  "process": "^0.11.10",
36
37
  "query-string": "^7.1.1",
37
38
  "rc-tooltip": "^5.1.1",
39
+ "react-loading-bar": "^0.0.7",
38
40
  "rimraf": "^3.0.2",
39
41
  "stream-browserify": "^3.0.0",
40
42
  "typescript": "^4.3.5",
@@ -53,5 +55,5 @@
53
55
  "optional": true
54
56
  }
55
57
  },
56
- "gitHead": "f0a33e71df8258ba44d39cb688d9467035b4a406"
58
+ "gitHead": "a24528b02090fcce44a0f1f4754074ea96b036c3"
57
59
  }
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function LoadingBar(): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import 'react-loading-bar/dist/index.css';
3
+ export default function LoadingBar(): JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MAX_QUERY_SIZE = 64;
@@ -0,0 +1,3 @@
1
+ import { ComponentProps } from 'react';
2
+ export type DocSearchButtonProps = ComponentProps<'button'>;
3
+ export declare const DocSearchButton: import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { DocSearchProps } from './doc-search';
3
+ export interface DocSearchModalProps extends DocSearchProps {
4
+ onClose?(): void;
5
+ }
6
+ export declare function DocSearchModal({ onClose, onlyCurrentPart, }: DocSearchModalProps): JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { ElementType } from 'react';
2
+ import '@docsearch/css';
3
+ export interface DocSearchProps {
4
+ as?: ElementType;
5
+ className?: string;
6
+ onlyCurrentPart?: boolean;
7
+ }
8
+ export default function DocSearch({ as, className, ...props }: DocSearchProps): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function Footer(): JSX.Element;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface UseDocSearchKeyboardEventsProps {
3
+ isOpen: boolean;
4
+ onOpen(): void;
5
+ onClose(): void;
6
+ onInput?(event: KeyboardEvent): void;
7
+ searchButtonRef?: React.RefObject<HTMLButtonElement>;
8
+ }
9
+ export declare function useKeyboardEvents({ isOpen, onOpen, onClose, onInput, searchButtonRef, }: UseDocSearchKeyboardEventsProps): void;
@@ -0,0 +1,5 @@
1
+ interface UseTrapFocusProps {
2
+ container: HTMLElement | null;
3
+ }
4
+ export declare function useTrapFocus({ container }: UseTrapFocusProps): void;
5
+ export {};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function ContentIcon(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function ControlKeyIcon(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function ErrorIcon(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function GoToExternal(): JSX.Element;
@@ -0,0 +1,11 @@
1
+ export * from './go-to-external-icon';
2
+ export * from './loading-icon';
3
+ export * from './recent-icon';
4
+ export * from './reset-icon';
5
+ export * from './search-icon';
6
+ export * from './select-icon';
7
+ export * from './content-icon';
8
+ export * from './star-icon';
9
+ export * from './error-icon';
10
+ export * from './no-results-icon';
11
+ export * from './control-key-icon';
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function LoadingIcon(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function NoResultsIcon(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function RecentIcon(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function ResetIcon(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function SearchIcon(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function SelectIcon(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function StarIcon(): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { DocSearchProps } from '@/components/search/doc-search';
3
+ export default function Search(props: DocSearchProps): JSX.Element;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { SearchResult } from '@/models/search';
3
+ export interface ResultItem extends SearchResult {
4
+ id: number;
5
+ }
6
+ interface ResultsProps {
7
+ items: ResultItem[];
8
+ title: string;
9
+ activeIndex?: number;
10
+ onItemClick(item: ResultItem): void;
11
+ onActive(index: number): void;
12
+ }
13
+ export declare function Results({ title, items, ...props }: ResultsProps): JSX.Element;
14
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SearchResult } from '@/models/search';
3
+ export interface ScreenStateProps {
4
+ onlyCurrentPart: boolean;
5
+ activeIndex?: number;
6
+ inputRef: React.MutableRefObject<null | HTMLInputElement>;
7
+ onItemClick: (item: SearchResult) => void;
8
+ onActive: (index: number) => void;
9
+ }
10
+ export declare const ScreenState: ({ onlyCurrentPart, ...props }: ScreenStateProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function ErrorScreen(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function NoResultsScreen(): JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { SearchResult } from '@/models/search';
3
+ interface ResultsScreenProps {
4
+ activeIndex?: number;
5
+ inputRef: React.MutableRefObject<null | HTMLInputElement>;
6
+ onItemClick: (item: SearchResult) => void;
7
+ onActive: (index: number) => void;
8
+ collections: any;
9
+ }
10
+ export declare function ResultsScreen({ collections, ...props }: ResultsScreenProps): JSX.Element;
11
+ export {};
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface StartScreenProps {
3
+ hasCollections: boolean;
4
+ }
5
+ export declare function StartScreen(props: StartScreenProps): JSX.Element | null;
6
+ export {};
@@ -0,0 +1,11 @@
1
+ import { MutableRefObject } from 'react';
2
+ interface SearchBoxProps {
3
+ autoFocus: boolean;
4
+ inputRef: MutableRefObject<HTMLInputElement | null>;
5
+ isFromSelection: boolean;
6
+ placeholder?: string;
7
+ initialQuery: string;
8
+ onClose(): void;
9
+ }
10
+ export declare function SearchBox({ autoFocus, inputRef, isFromSelection, initialQuery, onClose, placeholder }: SearchBoxProps): JSX.Element;
11
+ export {};
package/types/index.d.ts CHANGED
@@ -15,6 +15,8 @@ export { default as useInPreview } from './lib/use-in-preview';
15
15
  export { default as PoweredBy } from './components/powered-by';
16
16
  export { default as Logo } from './components/logo';
17
17
  export { default as Link } from './components/link';
18
+ export { default as Search } from './components/search';
19
+ export { default as LoadingBar } from './components/loading-bar';
18
20
  export { default as Anchor } from './components/anchor';
19
21
  export { default as Article } from './components/article';
20
22
  export { default as Catalog, type CatalogProps, CatalogItems } from './components/catalog';
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_topwrite_reader=self.webpackChunk_topwrite_reader||[]).push([[267],{3267:e=>{e.exports=JSON.parse('{"4R5GEq":"首页","IHXx7d":"本文档使用 {link} 构建","fTNnxP":"回到顶部","n24ytq":"未命名文档"}')}}]);
package/dist/7-7d6f45.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_topwrite_reader=self.webpackChunk_topwrite_reader||[]).push([[7],{2007:e=>{e.exports=JSON.parse('{"4R5GEq":"Home","IHXx7d":"Powered By {link}","fTNnxP":"BackTop","n24ytq":"Untitled"}')}}]);